Documentation ¶
Index ¶
Constants ¶
const Kind = "rfq"
Kind identifies this message kind
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOption ¶
type CreateOption func(*createOptions)
CreateOption is a function type used to apply options to RFQ creation.
func Claims ¶
func Claims(claims []string) CreateOption
Claims can be passed to Create to provide claims if required by the offering.
func CreatedAt ¶
func CreatedAt(t time.Time) CreateOption
CreatedAt can be passed to Create to provide a custom created at time.
func ExternalID ¶
func ExternalID(externalID string) CreateOption
ExternalID can be passed to Create to provide a custom external id.
type Data ¶
type Data struct { OfferingID string `json:"offeringId"` Payin ScrubbedPayinMethod `json:"payin"` Payout ScrubbedPayoutMethod `json:"payout"` ClaimsHash string `json:"claimsHash,omitempty"` }
Data encapsulates the data content of a request for quote.
type PayinMethod ¶
type PayinMethod struct { Amount string `json:"amount"` Kind string `json:"kind"` PaymentDetails PaymentMethodDetails `json:"paymentDetails"` }
PayinMethod is used to create the payin method for an RFQ
func Payin ¶
func Payin(amount, kind string, opts ...PaymentMethodOption) PayinMethod
Payin can be passed to Create to provide a payin method.
func (*PayinMethod) Scrub ¶
func (p *PayinMethod) Scrub(salt string, privateData *PrivateData) (ScrubbedPayinMethod, error)
Scrub extracts the private data from the payin method and replaces it with a hash
type PaymentMethodDetails ¶
PaymentMethodDetails is a map populated with the required payment details specified by an offering
type PaymentMethodOption ¶
type PaymentMethodOption func(*paymentMethodOptions)
PaymentMethodOption is a function type used to apply options to payment methods.
func PaymentDetails ¶
func PaymentDetails(details map[string]any) PaymentMethodOption
PaymentDetails can be passed to Payin or Payout to provide arbitrary payment details.
type PayoutMethod ¶
type PayoutMethod struct { Kind string `json:"kind"` PaymentDetails PaymentMethodDetails `json:"paymentDetails"` }
PayoutMethod is used to create the payout method for an RFQ
func Payout ¶
func Payout(kind string, opts ...PaymentMethodOption) PayoutMethod
Payout can be passed to Create to provide a payout method.
func (*PayoutMethod) Scrub ¶
func (p *PayoutMethod) Scrub(salt string, privateData *PrivateData) (ScrubbedPayoutMethod, error)
Scrub extracts the private data from the payout method and replaces it with a hash
type PrivateData ¶
type PrivateData struct { Salt string `json:"salt,omitempty"` Claims []string `json:"claims,omitempty"` Payin PrivatePaymentDetails `json:"payin,omitempty"` Payout PrivatePaymentDetails `json:"payout,omitempty"` }
PrivateData contains data which can be detached from the payload without disrupting integrity.
type PrivatePaymentDetails ¶
type PrivatePaymentDetails struct {
PaymentDetails PaymentMethodDetails `json:"paymentDetails,omitempty"`
}
PrivatePaymentDetails contains the private payment details. used in PrivateData
type RFQ ¶
type RFQ struct { Metadata message.Metadata `json:"metadata,omitempty"` Data Data `json:"data,omitempty"` PrivateData *PrivateData `json:"privateData,omitempty"` Signature string `json:"signature,omitempty"` }
RFQ represents a request for quote message within the exchange.
func Create ¶
func Create(fromDID did.BearerDID, to, offeringID string, payin PayinMethod, payout PayoutMethod, opts ...CreateOption) (RFQ, error)
Create creates an RFQ
An RFQ is a resource created by a customer of the PFI to request a quote ¶
func Parse ¶ added in v0.10.0
Parse validates, parses input data into an RFQ, and verifies the signature and private data.
func (RFQ) GetMetadata ¶ added in v0.13.0
GetMetadata returns the metadata of the message
func (RFQ) GetValidNext ¶ added in v0.13.0
GetValidNext returns the valid message kinds that can follow a RFQ.
func (*RFQ) UnmarshalJSON ¶
UnmarshalJSON validates and unmarshals the input data into an RFQ.
type ScrubbedPayinMethod ¶
type ScrubbedPayinMethod struct { Amount string `json:"amount"` Kind string `json:"kind"` PaymentDetailsHash string `json:"paymentDetailsHash,omitempty"` }
ScrubbedPayinMethod represents the chosen method for the pay-in
type ScrubbedPayoutMethod ¶
type ScrubbedPayoutMethod struct { Kind string `json:"kind"` PaymentDetailsHash string `json:"paymentDetailsHash,omitempty"` }
ScrubbedPayoutMethod represents the chosen method for the pay-out