Documentation
¶
Index ¶
- func GenerateTxRef(tx *custodian.Transaction) string
- type Account
- type AccountListPayload
- type Balance
- type BalancesPayload
- type BulkPayoutPayload
- type CheckTxPayload
- type Client
- type ClientWithPrometheus
- func (_d ClientWithPrometheus) CheckTxStatus(ctx context.Context, APIKEY string, clientID string, txRef string) (pp1 *PayoutResult, err error)
- func (_d ClientWithPrometheus) FetchAccountList(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (aap1 *[]Account, err error)
- func (_d ClientWithPrometheus) FetchBalances(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (bap1 *[]Balance, err error)
- func (_d ClientWithPrometheus) FetchValidatedAccount(ctx context.Context, verificationToken string, recipientID string) (v1 ValidatedAccount, err error)
- func (_d ClientWithPrometheus) UploadBulkPayout(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (pap1 *[]PayoutResult, err error)
- type Conf
- type HTTPClient
- func (c *HTTPClient) CheckTxStatus(ctx context.Context, APIKey string, clientID string, txRef string) (*PayoutResult, error)
- func (c *HTTPClient) FetchAccountList(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (*[]Account, error)
- func (c *HTTPClient) FetchBalances(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (*[]Balance, error)
- func (c *HTTPClient) FetchValidatedAccount(ctx context.Context, verificationToken, recipientID string) (ValidatedAccount, error)
- func (c *HTTPClient) UploadBulkPayout(ctx context.Context, APIKey string, signer cryptography.HMACKey, ...) (*[]PayoutResult, error)
- type PayoutPayload
- type PayoutResult
- type PrivateRequestSequence
- type ValidDocument
- type ValidateAccountReq
- type ValidatedAccount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTxRef ¶
func GenerateTxRef(tx *custodian.Transaction) string
GenerateTxRef generates a deterministic transaction reference id for idempotency
Types ¶
type Account ¶
type Account struct { Name string `json:"name"` Class string `json:"account"` Type string `json:"type"` CounterpartyID string `json:"counterparty_id"` CreatedAt int64 `json:"created"` }
Account holds account info
type AccountListPayload ¶
AccountListPayload retrieves all accounts associated with a gemini key
func NewAccountListPayload ¶
func NewAccountListPayload() AccountListPayload
NewAccountListPayload generate a new account list payload
type Balance ¶
type Balance struct { Type string `json:"type"` Currency string `json:"currency"` Amount decimal.Decimal `json:"amount"` Available decimal.Decimal `json:"available"` AvailableForWithdrawal decimal.Decimal `json:"availableForWithdrawal"` }
Balance holds balance info
type BalancesPayload ¶
type BalancesPayload struct { Request string `json:"request"` Nonce int64 `json:"nonce"` Account *string `json:"account,omitempty"` }
BalancesPayload retrieves all accounts associated with a gemini key
func NewBalancesPayload ¶
func NewBalancesPayload(account *string) BalancesPayload
NewBalancesPayload generate a new account list payload
type BulkPayoutPayload ¶
type BulkPayoutPayload struct { Request string `json:"request"` Nonce int64 `json:"nonce"` Payouts []PayoutPayload `json:"payouts"` OauthClientID string `json:"client_id"` Account *string `json:"account,omitempty"` }
BulkPayoutPayload the payload to be base64'd
func NewBulkPayoutPayload ¶
func NewBulkPayoutPayload(account *string, oauthClientID string, payouts *[]PayoutPayload) BulkPayoutPayload
NewBulkPayoutPayload generate a new bulk payout payload
type CheckTxPayload ¶
CheckTxPayload get the tx status payload structure
func NewCheckTxPayload ¶
func NewCheckTxPayload(url string) CheckTxPayload
NewCheckTxPayload generate a new payload for the check tx api
type Client ¶
type Client interface { // FetchValidatedAccount given a verificationToken validate the token is authentic and get the unique account id FetchValidatedAccount(ctx context.Context, verificationToken, recipientID string) (ValidatedAccount, error) // FetchAccountList requests account information to scope future requests FetchAccountList(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (*[]Account, error) // FetchBalances requests balance information for a given account FetchBalances(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (*[]Balance, error) // UploadBulkPayout posts a signed bulk layout to gemini UploadBulkPayout(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (*[]PayoutResult, error) // CheckTxStatus checks the status of a transaction CheckTxStatus(ctx context.Context, APIKEY string, clientID string, txRef string) (*PayoutResult, error) }
Client abstracts over the underlying client
type ClientWithPrometheus ¶
type ClientWithPrometheus struct {
// contains filtered or unexported fields
}
ClientWithPrometheus implements Client interface with all methods wrapped with Prometheus metrics
func NewClientWithPrometheus ¶
func NewClientWithPrometheus(base Client, instanceName string) ClientWithPrometheus
NewClientWithPrometheus returns an instance of the Client decorated with prometheus summary metric
func (ClientWithPrometheus) CheckTxStatus ¶
func (_d ClientWithPrometheus) CheckTxStatus(ctx context.Context, APIKEY string, clientID string, txRef string) (pp1 *PayoutResult, err error)
CheckTxStatus implements Client
func (ClientWithPrometheus) FetchAccountList ¶
func (_d ClientWithPrometheus) FetchAccountList(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (aap1 *[]Account, err error)
FetchAccountList implements Client
func (ClientWithPrometheus) FetchBalances ¶
func (_d ClientWithPrometheus) FetchBalances(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (bap1 *[]Balance, err error)
FetchBalances implements Client
func (ClientWithPrometheus) FetchValidatedAccount ¶
func (_d ClientWithPrometheus) FetchValidatedAccount(ctx context.Context, verificationToken string, recipientID string) (v1 ValidatedAccount, err error)
FetchValidatedAccount implements Client
func (ClientWithPrometheus) UploadBulkPayout ¶
func (_d ClientWithPrometheus) UploadBulkPayout(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (pap1 *[]PayoutResult, err error)
UploadBulkPayout implements Client
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient wraps http.Client for interacting with the cbr server
func (*HTTPClient) CheckTxStatus ¶
func (c *HTTPClient) CheckTxStatus(ctx context.Context, APIKey string, clientID string, txRef string) (*PayoutResult, error)
CheckTxStatus uploads the bulk payout for gemini
func (*HTTPClient) FetchAccountList ¶
func (c *HTTPClient) FetchAccountList( ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string, ) (*[]Account, error)
FetchAccountList fetches the list of accounts associated with the given api key
func (*HTTPClient) FetchBalances ¶
func (c *HTTPClient) FetchBalances( ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string, ) (*[]Balance, error)
FetchBalances fetches the list of accounts associated with the given api key
func (*HTTPClient) FetchValidatedAccount ¶
func (c *HTTPClient) FetchValidatedAccount(ctx context.Context, verificationToken, recipientID string) (ValidatedAccount, error)
func (*HTTPClient) UploadBulkPayout ¶
func (c *HTTPClient) UploadBulkPayout(ctx context.Context, APIKey string, signer cryptography.HMACKey, payload string) (*[]PayoutResult, error)
UploadBulkPayout uploads the bulk payout for gemini
type PayoutPayload ¶
type PayoutPayload struct { TxRef string `json:"tx_ref"` Amount decimal.Decimal `json:"amount"` Currency string `json:"currency"` Destination string `json:"destination"` Account *string `json:"account,omitempty"` }
PayoutPayload contains details about transactions to be confirmed
func SettlementTransactionToPayoutPayload ¶
func SettlementTransactionToPayoutPayload(tx *custodian.Transaction) PayoutPayload
SettlementTransactionToPayoutPayload converts to a payout request
type PayoutResult ¶
type PayoutResult struct { Result string `json:"result"` // OK or Error TxRef string `json:"tx_ref"` Amount *decimal.Decimal `json:"amount"` Currency *string `json:"currency"` Destination *string `json:"destination"` Status *string `json:"status"` Reason *string `json:"reason"` }
PayoutResult contains details about a newly created or fetched issuer
func (PayoutResult) GenerateLog ¶
func (pr PayoutResult) GenerateLog() string
GenerateLog creates a log
type PrivateRequestSequence ¶
type PrivateRequestSequence struct { // the baseline object, corresponds to the signature in the first item // must update the nonce before sending otherwise invalid signature will be encountered Base BulkPayoutPayload `json:"base"` Signatures []string `json:"signatures"` // a list of hex encoded singatures APIKey string `json:"apikey"` // the api key that corresponds to the checksum server side Account *string `json:"account,omitempty"` }
PrivateRequestSequence handles the ability to sign a request multiple times
type ValidDocument ¶
type ValidDocument struct { Type string `json:"type"` IssuingCountry string `json:"issuingCountry"` }
ValidDocument represent a valid proof of identity document type.
type ValidateAccountReq ¶
type ValidateAccountReq struct { Token string `url:"token"` RecipientID string `url:"recipient_id"` }
ValidateAccountReq - request structure for inputs to validate account client call
func (*ValidateAccountReq) GenerateQueryString ¶
func (v *ValidateAccountReq) GenerateQueryString() (url.Values, error)
GenerateQueryString - implement the QueryStringBody interface
type ValidatedAccount ¶
type ValidatedAccount struct { ID string `json:"id"` CountryCode string `json:"countryCode"` ValidDocuments []ValidDocument `json:"validDocuments"` }
ValidatedAccount represents an account that has been validated by Gemini.