Documentation ¶
Index ¶
Constants ¶
const Kind = "quote"
Kind identifies this message kind
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOption ¶
type CreateOption func(*createOptions)
CreateOption defines a type for functions that can modify the createOptions struct.
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 { ExpiresAt string `json:"expiresAt,omitmepty"` Payin QuoteDetails `json:"payin,omitempty"` Payout QuoteDetails `json:"payout,omitempty"` }
Data encapsulates the data content of a quote.
type PaymentInstruction ¶
type PaymentInstruction struct { Link string `json:"link,omitempty"` Instruction string `json:"instruction,omitempty"` }
PaymentInstruction contains instructions with plain text and/or a link
func NewPaymentInstruction ¶
func NewPaymentInstruction(opts ...PaymentInstructionOptions) *PaymentInstruction
NewPaymentInstruction creates a new PaymentInstruction using the provided options.
type PaymentInstructionOptions ¶
type PaymentInstructionOptions func(*paymentInstructionOptions)
PaymentInstructionOptions defines a type for functions that can modify the paymentInstructionOptions struct.
func Instruction ¶
func Instruction(instruction string) PaymentInstructionOptions
Instruction is an option for NewPaymentInstruction that allows setting custom text.
func InstructionLink ¶
func InstructionLink(link string) PaymentInstructionOptions
InstructionLink is an option for NewPaymentInstruction that allows setting a custom link.
type Quote ¶
type Quote struct { Metadata message.Metadata `json:"metadata,omitempty"` Data Data `json:"data,omitempty"` Signature string `json:"signature,omitempty"` }
Quote represents a quote message within the exchange.
func Create ¶
func Create(fromDID did.BearerDID, to, exchangeID, expiresAt string, payin, payout QuoteDetails, opts ...CreateOption) (Quote, error)
Create generates a new Quote with the specified parameters and options.
func Parse ¶ added in v0.10.0
Parse validates, parses input data into an Quote, and verifies the signature.
func (Quote) GetMetadata ¶ added in v0.13.0
GetMetadata returns the metadata of the message
func (Quote) GetValidNext ¶ added in v0.13.0
GetValidNext returns the valid message kinds that can follow a Quote.
func (*Quote) UnmarshalJSON ¶
UnmarshalJSON validates and unmarshals the input data into an Quote.
type QuoteDetails ¶
type QuoteDetails struct { CurrencyCode string `json:"currencyCode,omitempty"` Amount string `json:"amount,omitempty"` Fee string `json:"fee,omitempty,omitempty"` PaymentInstruction *PaymentInstruction `json:"paymentInstruction,omitempty"` }
QuoteDetails describes the relevant information of a currency that is being sent or received
func NewQuoteDetails ¶
func NewQuoteDetails(currencyCode string, amount string, opts ...QuoteDetailsOption) QuoteDetails
NewQuoteDetails creates a QuoteDetails object with the specified currency code, amount, and optional modifications provided through QuoteDetailsOption functions.
type QuoteDetailsOption ¶
type QuoteDetailsOption func(*quoteDetailsOptions)
QuoteDetailsOption defines a type for functions that can modify the quoteDetailsOptions struct.
func DetailsFee ¶
func DetailsFee(fee string) QuoteDetailsOption
DetailsFee is an option for NewQuoteDetails that allows setting a custom fee for a QuoteDetails.
func DetailsInstruction ¶
func DetailsInstruction(p *PaymentInstruction) QuoteDetailsOption
DetailsInstruction is an option for NewQuoteDetails that allows setting a custom PaymentInstruction for a QuoteDetails.