Documentation ¶
Overview ¶
Package storage provides models and interfaces for persistent storage of records.
Index ¶
Constants ¶
const DefaultLimit = 10
DefaultLimit is the default limit on the number of Payments returned by ReadAll.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlreadyExistsError ¶
AlreadyExistsError is returned when a Payment with a given ID exists.
func (*AlreadyExistsError) Error ¶
func (aee *AlreadyExistsError) Error() string
type BeneficiaryParty ¶
type BeneficiaryParty struct { AccountName string `bson:"account_name" json:"account_name"` AccountNumber string `bson:"account_number" json:"account_number"` AccountNumberCode string `bson:"account_number_code" json:"account_number_code"` AccountType int `bson:"account_type" json:"account_type"` Address string `bson:"address" json:"address"` BankID string `bson:"bank_id" json:"bank_id"` BankIDCode string `bson:"bank_id_code" json:"bank_id_code"` Name string `bson:"name" json:"name"` }
BeneficiaryParty details the party being credited from the payment transaction.
type ChargesInformation ¶
type ChargesInformation struct { BearerCode string `bson:"bearer_code" json:"bearer_code"` ReceiverChargesAmount float64 `bson:"receiver_charges_amount" json:"receiver_charges_amount,string"` ReceiverChargesCurrency string `bson:"receiver_charges_currency" json:"receiver_charges_currency"` SenderCharges []SenderCharges `bson:"sender_charges" json:"sender_charges"` }
ChargesInformation describes the charges involved with processing the payment transaction.
type DebtorParty ¶
type DebtorParty struct { AccountName string `bson:"account_name" json:"account_name"` AccountNumber string `bson:"account_number" json:"account_number"` AccountNumberCode string `bson:"account_number_code" json:"account_number_code"` Address string `bson:"address" json:"address"` BankID string `bson:"bank_id" json:"bank_id"` BankIDCode string `bson:"bank_id_code" json:"bank_id_code"` Name string `bson:"name" json:"name"` }
DebtorParty details the party being debited for the payment transaction.
type Fx ¶
type Fx struct { ContractReference string `bson:"contract_reference" json:"contract_reference"` ExchangeRate float64 `bson:"exchange_rate" json:"exchange_rate,string"` OriginalAmount float64 `bson:"original_amount" json:"original_amount,string"` OriginalCurrency string `bson:"original_currency" json:"original_currency"` }
Fx describes the foreign exchange details salient to the payment transaction.
type NotFoundError ¶
NotFoundError is returned when a Payment with a given ID cannot be found.
func (*NotFoundError) Error ¶
func (nfe *NotFoundError) Error() string
type OffsetOutOfBoundsError ¶
type OffsetOutOfBoundsError struct {
Offset uint
}
OffsetOutOfBoundsError is returned when the 'offset' parameter inside a ReadAllOptions struct exceeds the number of elements available in PaymentStorage.
func (*OffsetOutOfBoundsError) Error ¶
func (ooob *OffsetOutOfBoundsError) Error() string
type Payment ¶
type Payment struct { Amount float64 `bson:"amount" json:"amount,string"` BeneficiaryParty BeneficiaryParty `bson:"beneficiary_party" json:"beneficiary_party"` ChargesInformation ChargesInformation `bson:"charges_information" json:"charges_information"` Currency string `bson:"currency" json:"currency"` DebtorParty DebtorParty `bson:"debtor_party" json:"debtor_party"` EndToEndReference string `bson:"end_to_end_reference" json:"end_to_end_reference"` Fx Fx `bson:"fx" json:"fx"` NumericReference string `bson:"numeric_reference" json:"numeric_reference"` PaymentID string `bson:"payment_id" json:"payment_id"` PaymentPurpose string `bson:"payment_purpose" json:"payment_purpose"` PaymentScheme string `bson:"payment_scheme" json:"payment_scheme"` PaymentType string `bson:"payment_type" json:"payment_type"` ProcessingDate string `bson:"processing_date" json:"processing_date"` Reference string `bson:"reference" json:"reference"` SchemePaymentSubType string `bson:"scheme_payment_sub_type" json:"scheme_payment_sub_type"` SchemePaymentType string `bson:"scheme_payment_type" json:"scheme_payment_type"` SponsorParty SponsorParty `bson:"sponsor_party" json:"sponsor_party"` }
Payment is the top-level struct of a payment record containing transaction details.
type PaymentStorage ¶
type PaymentStorage interface { Initialise() error Terminate(...bool) error Create(Payment) (uuid.UUID, error) CreateSpecificID(uuid.UUID, Payment) error Read(uuid.UUID) (Payment, error) ReadAll(ReadAllOptions) (map[uuid.UUID]Payment, error) Update(uuid.UUID, Payment) error Delete(uuid.UUID) error }
PaymentStorage allows storage, retrieval, updating, and deletion of Payment structs.
type ReadAllOptions ¶
ReadAllOptions is a config struct for supplying optional parameters to ReadAll.
type SenderCharges ¶
type SenderCharges struct { Amount float64 `bson:"amount" json:"amount,string"` Currency string `bson:"currency" json:"currency"` }
SenderCharges stores the currency and amount charged to the payment sender.
type SponsorParty ¶
type SponsorParty struct { AccountNumber string `bson:"account_number" json:"account_number"` BankID string `bson:"bank_id" json:"bank_id"` BankIDCode string `bson:"bank_id_code" json:"bank_id_code"` }
SponsorParty details the party sponsoring the payment transaction.