Documentation ¶
Index ¶
- type Account
- type AccountResp
- type BalanceResp
- type Card
- type CardResp
- type Client
- func (cl *Client) CreateCard(data CreateCardData) (CreateCardResp, error)
- func (cl *Client) CreditCard(data PaymentData) (CardResp, error)
- func (cl *Client) DebitCard(data PaymentData) (CardResp, error)
- func (cl *Client) FreezeCard(cardId string) (CardResp, error)
- func (cl *Client) GetCard(cardId string) (CardResp, error)
- func (cl *Client) GetFloat() (BalanceResp, error)
- func (cl *Client) GetTransaction(trxId string) (TransactionResp, error)
- func (cl Client) Health() (string, error)
- func (cl *Client) ListCards(limit, page int, userId string) ([]CardResp, error)
- func (cl *Client) ListTransactions(cardId string, param Param) (TransactionsResp, error)
- func (cl *Client) ListUsers(limit, page int) (UsersResp, error)
- func (cl *Client) MockTransaction(data MockTransactionData, cardId string) (Resp, error)
- func (cl *Client) RegisterAccount(data RegisterAccountData) (AccountResp, error)
- func (cl *Client) RegisterUser(data RegisterUserData, accountId string) (UserResp, error)
- func (cl *Client) SetAPIVersion(version string)
- func (cl *Client) SetAuth(apiKey string) error
- func (cl *Client) SetBaseURL(baseURL string)
- func (cl *Client) SetDebug(debug bool)
- func (cl *Client) SetHTTPClient(httpClient HTTPClient)
- func (cl *Client) TopUpFloat(amount int) (Resp, error)
- func (cl *Client) UnfreezeCard(cardId string) (CardResp, error)
- func (cl *Client) UpdateAccount(webhook, businessAddress, domain string) (AccountResp, error)
- type CreateCardData
- type CreateCardResp
- type Error
- type HTTPClient
- type MockTransactionData
- type Param
- type PaymentData
- type RegisterAccountData
- type RegisterUserData
- type Resp
- type TopUpFloatData
- type Transaction
- type TransactionResp
- type TransactionsResp
- type UpdateAccountData
- type UsdcAddress
- type User
- type UserAddress
- type UserResp
- type UsersResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { BusinessAddress string `json:"business_address"` BusinessName string `json:"business_name"` Chain string `json:"chain"` ContactNumber string `json:"contact_number"` Country string `json:"country"` Domain string `json:"domain"` Email string `json:"email"` FirstName string `json:"first_name"` FloatCurrencies []string `json:"float_currencies"` Id string `json:"id"` LastName string `json:"last_name"` RegistrationNumber string `json:"registration_number"` UsdcAddress UsdcAddress `json:"usdc_address"` }
type AccountResp ¶
type AccountResp struct {
Data Account `json:"data"`
}
type BalanceResp ¶ added in v1.0.3
type Card ¶
type Card struct { Balance int `json:"balance"` BusinessId string `json:"business_id"` CardName string `json:"card_name"` CardNumber string `json:"card_number"` CardType string `json:"card_type"` Currency string `json:"currency"` Cvv2 string `json:"cvv2"` DesignType string `json:"design_type"` Expiry time.Time `json:"expiry"` Id string `json:"id"` Provider string `json:"provider"` SingleUse bool `json:"single_use"` Status string `json:"status"` UserId string `json:"user_id"` Valid string `json:"valid"` }
type CardResp ¶
type CardResp struct { Balance int `json:"balance"` CardNumber string `json:"card_number"` CardType string `json:"card_type"` Cvv2 string `json:"cvv2"` Expiry time.Time `json:"expiry"` Id string `json:"id"` SingleUse bool `json:"single_use"` Status string `json:"status"` Valid string `json:"valid"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client ...
func NewClient ¶
func NewClient() *Client
NewClient creates a new Spend-Juice API client with the default base URL.
func (*Client) CreateCard ¶
func (cl *Client) CreateCard(data CreateCardData) (CreateCardResp, error)
CreateCard creates a card for a user
func (*Client) CreditCard ¶
func (cl *Client) CreditCard(data PaymentData) (CardResp, error)
CreditCard top-up a card for a user
func (*Client) DebitCard ¶
func (cl *Client) DebitCard(data PaymentData) (CardResp, error)
DebitCard debits a card for a user
func (*Client) FreezeCard ¶
FreezeCard freezes a card for a user
func (*Client) GetFloat ¶ added in v1.0.3
func (cl *Client) GetFloat() (BalanceResp, error)
GetFloat allows an integrator get their float balance
func (*Client) GetTransaction ¶
func (cl *Client) GetTransaction(trxId string) (TransactionResp, error)
GetTransaction gets a particular transaction
func (*Client) ListTransactions ¶
func (cl *Client) ListTransactions(cardId string, param Param) (TransactionsResp, error)
ListTransactions gets paginated transactions for the given card
func (*Client) MockTransaction ¶ added in v1.0.4
func (cl *Client) MockTransaction(data MockTransactionData, cardId string) (Resp, error)
MockTransaction mocks card transaction. This endpoint is only available in the sandbox environment.
func (*Client) RegisterAccount ¶
func (cl *Client) RegisterAccount(data RegisterAccountData) (AccountResp, error)
RegisterAccount creates a card integrator account
func (*Client) RegisterUser ¶
func (cl *Client) RegisterUser(data RegisterUserData, accountId string) (UserResp, error)
RegisterUser creates an account for user requesting a card
func (*Client) SetAPIVersion ¶
SetAPIVersion overrides the default base URL. For internal use.
func (*Client) SetBaseURL ¶
SetBaseURL overrides the default base URL. For internal use.
func (*Client) SetDebug ¶
SetDebug enables or disables debug mode. In debug mode, HTTP requests and responses will be logged.
func (*Client) SetHTTPClient ¶
func (cl *Client) SetHTTPClient(httpClient HTTPClient)
SetHTTPClient sets the HTTP client that will be used for API calls.
func (*Client) TopUpFloat ¶ added in v1.0.3
TopUpFloat allows an integrator to top up float balance. This endpoint is only available in the sandbox environment.
func (*Client) UnfreezeCard ¶
UnfreezeCard unfreezes a card for a user
func (*Client) UpdateAccount ¶
func (cl *Client) UpdateAccount(webhook, businessAddress, domain string) (AccountResp, error)
UpdateAccount updates the card integrator account
type CreateCardData ¶
type CreateCardResp ¶
type CreateCardResp struct {
Data Card `json:"data"`
}
type Error ¶
type Error struct { Errors interface{} `json:"errors"` Message string `json:"message"` }
type MockTransactionData ¶ added in v1.0.4
type PaymentData ¶
type RegisterAccountData ¶
type RegisterAccountData struct { FloatCurrencies []string `json:"float_currencies"` BusinessAddress string `json:"business_address"` BusinessName string `json:"business_name"` Chain string `json:"chain"` ContactNumber string `json:"contact_number"` Country string `json:"country"` Domain string `json:"domain"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Password string `json:"password"` RegistrationNumber string `json:"registration_number"` WebhookUrl string `json:"webhook_url"` }
type RegisterUserData ¶
type RegisterUserData struct { Address UserAddress `json:"address"` Email string `json:"email"` FirstName string `json:"first_name"` IdNumber string `json:"id_number"` IdType string `json:"id_type"` LastName string `json:"last_name"` PhoneNumber string `json:"phone_number"` UserPhoto string `json:"user_photo,omitempty"` }
type TopUpFloatData ¶ added in v1.0.3
type TopUpFloatData struct {
Amount int `json:"amount"`
}
type Transaction ¶
type Transaction struct { Amount int `json:"amount"` CardBalanceAfter int `json:"card_balance_after"` CardBalanceBefore int `json:"card_balance_before"` ConversionRate int `json:"conversion_rate"` CreatedAt time.Time `json:"created_at"` Currency string `json:"currency"` Id string `json:"id"` Narrative interface{} `json:"narrative"` Type string `json:"type"` }
type TransactionResp ¶
type TransactionResp struct { Data Transaction `json:"data"` Message string `json:"message"` }
type TransactionsResp ¶
type TransactionsResp struct { Data []Transaction `json:"data"` Message string `json:"message"` NextPage interface{} `json:"next_page"` }
type UpdateAccountData ¶
type UsdcAddress ¶
type User ¶
type User struct { Address UserAddress `json:"address"` Archived bool `json:"archived"` CardIntegratorId string `json:"card_integrator_id"` Email string `json:"email"` FirstName string `json:"first_name"` Id string `json:"id"` IdNumber string `json:"id_number"` IdType string `json:"id_type"` LastName string `json:"last_name"` PhoneNumber string `json:"phone_number"` Verified bool `json:"verified"` }