withdraw

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrStrAmountMustBeGreaterThanZero message to return when requested amount is less than 0
	ErrStrAmountMustBeGreaterThanZero = "amount must be greater than 0"
	// ErrStrAddressNotSet message to return when address is empty
	ErrStrAddressNotSet = "address cannot be empty"
	// ErrStrNoCurrencySet message to return when no currency is set
	ErrStrNoCurrencySet = "currency not set"
	// ErrStrCurrencyNotCrypto message to return when requested currency is not crypto
	ErrStrCurrencyNotCrypto = "requested currency is not a cryptocurrency"
	// ErrStrCurrencyNotFiat message to return when requested currency is not fiat
	ErrStrCurrencyNotFiat = "requested currency is not fiat"
	// ErrStrFeeCannotBeNegative message to return when fee amount is negative
	ErrStrFeeCannotBeNegative = "fee amount cannot be negative"
)

Variables

View Source
var (
	// ErrRequestCannotBeNil message to return when a request is nil
	ErrRequestCannotBeNil = errors.New("request cannot be nil")
	// ErrExchangeNameUnset message to return when an exchange name is unset
	ErrExchangeNameUnset = errors.New("exchange name unset")
	// ErrInvalidRequest message to return when a request type is invalid
	ErrInvalidRequest = errors.New("invalid request type")
	// ErrStrAddressNotWhiteListed occurs when a withdrawal attempts to withdraw from a non-whitelisted address
	ErrStrAddressNotWhiteListed = errors.New("address is not whitelisted for withdrawals")
	// ErrStrExchangeNotSupportedByAddress message to return when attemptign to withdraw to an unsupported exchange
	ErrStrExchangeNotSupportedByAddress = errors.New("address is not supported by exchange")
	// CacheSize cache size to use for withdrawal request history
	CacheSize uint64 = 25
	// Cache LRU cache for recent requests
	Cache = cache.New(CacheSize)
	// DryRunID uuid to use for dryruns
	DryRunID, _ = uuid.FromString("3e7e2c25-5a0b-429b-95a1-0960079dce56")
)

Functions

This section is empty.

Types

type CryptoRequest

type CryptoRequest struct {
	Address    string
	AddressTag string
	Chain      string
	FeeAmount  float64
}

CryptoRequest stores the info required for a crypto withdrawal request

type ExchangeResponse

type ExchangeResponse struct {
	Name   string `json:"name"`
	UUID   uuid.UUID
	ID     string `json:"id"`
	Status string `json:"status"`
}

ExchangeResponse holds information returned from an exchange

type FiatRequest

type FiatRequest struct {
	Bank banking.Account

	IsExpressWire bool
	// Intermediary bank information
	RequiresIntermediaryBank      bool
	IntermediaryBankAccountNumber float64
	IntermediaryBankName          string
	IntermediaryBankAddress       string
	IntermediaryBankCity          string
	IntermediaryBankCountry       string
	IntermediaryBankPostalCode    string
	IntermediarySwiftCode         string
	IntermediaryBankCode          float64
	IntermediaryIBAN              string
	WireCurrency                  string
}

FiatRequest used for fiat withdrawal requests

type Request

type Request struct {
	Exchange    string        `json:"exchange"`
	Currency    currency.Code `json:"currency"`
	Description string        `json:"description"`
	Amount      float64       `json:"amount"`
	Type        RequestType   `json:"type"`

	TradePassword   string
	OneTimePassword int64
	PIN             int64

	Crypto CryptoRequest `json:",omitempty"`
	Fiat   FiatRequest   `json:",omitempty"`
}

Request holds complete details for request

func (*Request) Validate

func (r *Request) Validate(opt ...validate.Checker) (err error)

Validate takes interface and passes to asset type to check the request meets requirements to submit

type RequestType

type RequestType uint8

RequestType used for easy matching of int type to Word

const (
	// Crypto request type
	Crypto RequestType = iota
	// Fiat request type
	Fiat
	// Unknown request type
	Unknown
)

type Response

type Response struct {
	ID uuid.UUID `json:"id"`

	Exchange       ExchangeResponse `json:"exchange"`
	RequestDetails Request          `json:"request_details"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Response holds complete details for Response

Jump to

Keyboard shortcuts

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