banking

package
v0.9.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrBankAccountNotFound message to return when bank account was not found
	ErrBankAccountNotFound = "bank account ID: %v not found"
	// ErrAccountCannotBeEmpty message to return when bank account number is empty
	ErrAccountCannotBeEmpty = "Bank Account Number cannot be empty"
	// ErrBankAccountDisabled message to return when bank account is disabled
	ErrBankAccountDisabled = "Bank Account is disabled"
	// ErrBSBRequiredForAUD message to return when currency is AUD but no bsb is set
	ErrBSBRequiredForAUD = "BSB must be set for AUD values"
	// ErrIBANSwiftNotSet message to return when no iban or swift value set
	ErrIBANSwiftNotSet = "IBAN/SWIFT values not set"
	// ErrCurrencyNotSupportedByAccount message to return when the requested
	// currency is not supported by the bank account
	ErrCurrencyNotSupportedByAccount = "requested currency is not supported by account"
)

Variables

This section is empty.

Functions

func AppendAccounts

func AppendAccounts(accs ...Account)

AppendAccounts safely adds to bank account slice

func SetAccounts

func SetAccounts(accs ...Account)

SetAccounts safely overwrites bank account slice

Types

type Account

type Account struct {
	Enabled             bool    `json:"enabled"`
	ID                  string  `json:"id,omitempty"`
	BankName            string  `json:"bankName"`
	BankAddress         string  `json:"bankAddress"`
	BankPostalCode      string  `json:"bankPostalCode"`
	BankPostalCity      string  `json:"bankPostalCity"`
	BankCountry         string  `json:"bankCountry"`
	AccountName         string  `json:"accountName"`
	AccountNumber       string  `json:"accountNumber"`
	SWIFTCode           string  `json:"swiftCode"`
	IBAN                string  `json:"iban"`
	BSBNumber           string  `json:"bsbNumber,omitempty"`
	BankCode            float64 `json:"bank_code,omitempty"`
	SupportedCurrencies string  `json:"supportedCurrencies"`
	SupportedExchanges  string  `json:"supportedExchanges,omitempty"`
}

Account holds differing bank account details by supported funding currency

func GetBankAccountByID

func GetBankAccountByID(id string) (*Account, error)

GetBankAccountByID Returns a bank account based on its ID

func (*Account) ExchangeSupported

func (b *Account) ExchangeSupported(exchange string) bool

ExchangeSupported Checks if exchange is supported by bank account

func (*Account) Validate

func (b *Account) Validate() error

Validate validates bank account settings

func (*Account) ValidateForWithdrawal

func (b *Account) ValidateForWithdrawal(exchange string, cur currency.Code) (err []string)

ValidateForWithdrawal confirms bank account meets minimum requirements to submit a withdrawal request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL