Documentation
¶
Index ¶
- Constants
- type AccountBalancesResponse
- type Balance
- type CoinLimit
- type CompleteCryptoOrderResponse
- type CreateCryptoTopUpRequest
- type CreateCryptoTopUpResponse
- type CreateNewFiatOrder
- type CreateNewFiatOrderResponse
- type CreateNewOrderRequest
- type CreateNewOrderResponse
- type CreatePaymentRequest
- type CreatePaymentResponse
- type CryptoCurrency
- type Currency
- type ErrorBody
- type EventType
- type Events
- type Filters
- func CompletedAtFrom(completedAtFrom time.Time) Filters
- func CompletedAtTo(completedAtTo time.Time) Filters
- func DateFrom(dateFrom time.Time) Filters
- func DateTo(dateTo time.Time) Filters
- func ExternalOrderID(externalOrderID string) Filters
- func OrderStatusID(orderStatusID string) Filters
- func Page(page int) Filters
- func PerPage(perPage int) Filters
- type GetCryptoOrderDetailsResponse
- type InvoiceCurrencies
- type ListCurrencies
- type Network
- type Option
- type Order
- type OrderStatusesListResponse
- type Pagination
- type ShowCryptoOrdersListResponse
- type ShowInvoiceCurrenciesForCryptoOrderCreationResponse
- type ShowInvoiceCurrenciesForFiatOrderCreationResponse
- type ShowOrderDetailsResponse
- type ShowOrdersListResponse
- type Status
- type StatusObject
- type StockOrder
- type Transaction
- type WalletOrderDetailResponse
- type WhitePay
- func (wp *WhitePay) CompleteCryptoOrder(ctx context.Context, orderID string) (*CompleteCryptoOrderResponse, error)
- func (wp *WhitePay) CreateCryptoTopUp(ctx context.Context, req *CreateCryptoTopUpRequest) (*CreateCryptoTopUpResponse, error)
- func (wp *WhitePay) CreateNewFiatOrder(ctx context.Context, req *CreateNewFiatOrder) (*CreateNewFiatOrderResponse, error)
- func (wp *WhitePay) CreateNewOrder(ctx context.Context, req *CreateNewOrderRequest) (*CreateNewOrderResponse, error)
- func (wp *WhitePay) CreatePayment(ctx context.Context, req *CreatePaymentRequest) (*CreatePaymentResponse, error)
- func (wp *WhitePay) GetListCurrencies(ctx context.Context) (*ListCurrencies, error)
- func (wp *WhitePay) GetWalletOrderDetail(ctx context.Context, orderID string) (*WalletOrderDetailResponse, error)
- func (wp *WhitePay) SetSlug(slug string)
- func (wp *WhitePay) ShowAccountBalances(ctx context.Context) (*AccountBalancesResponse, error)
- func (wp *WhitePay) ShowCryptoOrderDetails(ctx context.Context, orderID string) (*GetCryptoOrderDetailsResponse, error)
- func (wp *WhitePay) ShowCryptoOrdersList(ctx context.Context, filters ...Filters) (*ShowCryptoOrdersListResponse, error)
- func (wp *WhitePay) ShowInvoiceCurrenciesForCryptoOrderCreation(ctx context.Context) (*ShowInvoiceCurrenciesForCryptoOrderCreationResponse, error)
- func (wp *WhitePay) ShowInvoiceCurrenciesForCryptoTopUpOrderCreation(ctx context.Context) *ShowInvoiceCurrenciesForCryptoOrderCreationResponse
- func (wp *WhitePay) ShowInvoiceCurrenciesForFiatOrderCreation(ctx context.Context) (*ShowInvoiceCurrenciesForFiatOrderCreationResponse, error)
- func (wp *WhitePay) ShowOrderDetails(ctx context.Context, orderID string) (*ShowOrderDetailsResponse, error)
- func (wp *WhitePay) ShowOrderStatusesList(ctx context.Context) (*OrderStatusesListResponse, error)
- func (wp *WhitePay) ShowOrdersList(ctx context.Context, filters ...Filters) (*ShowOrdersListResponse, error)
- func (wp *WhitePay) SignOrder(payload []byte) string
- func (wp *WhitePay) SignTransaction(payload []byte) string
- func (wp *WhitePay) Updates() <-chan *Events
- func (wp *WhitePay) WebhookHandler() http.HandlerFunc
Constants ¶
const (
BaseURL = "https://api.whitepay.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalancesResponse ¶
type AccountBalancesResponse struct {
Balances []*Balance `json:"balances"`
}
type Balance ¶
type Balance struct { ID string `json:"id"` Value string `json:"value"` Currency Currency `json:"currency"` }
Balance represents a WhitePay balance.
type CompleteCryptoOrderResponse ¶
type CompleteCryptoOrderResponse struct {
Order `json:"order"`
}
CompleteCryptoOrderResponse body for CompleteCryptoOrder
type CreateCryptoTopUpRequest ¶
type CreateCryptoTopUpRequest struct {
CreateNewOrderRequest
}
CreateCryptoTopUpRequest body for CreateCryptoTopUp
type CreateCryptoTopUpResponse ¶
type CreateCryptoTopUpResponse struct {
Order `json:"order"`
}
CreateCryptoTopUpResponse response for CreateCryptoTopUp
type CreateNewFiatOrder ¶
type CreateNewFiatOrderResponse ¶
type CreateNewFiatOrderResponse struct {
Order `json:"order"`
}
type CreateNewOrderRequest ¶
type CreateNewOrderRequest struct { // Amount Min value depends on currency. Becomes required in case if “currency“ was specified. Amount string `json:"amount"` // Currency Becomes required in case if “amount“ was specified. Currency string `json:"currency"` // ExternalOrderId Unique order identifier in client Database (usually Internal Payment or Order ID used). Number of characters: min 1, max 255. Allowed symbols: aA-zZ, 0-9. Special characters: “-“, “_“. ExternalOrderID string `json:"external_order_id"` // SuccessfulLink Link used to redirect user from payment form after order completion. Has to be URL SuccessfulLink string `json:"successful_link"` // FailureLink Link used to redirect user from payment form after order failure. Has to be URL FailureLink string `json:"failure_link"` }
CreateNewOrderRequest body for CreateNewOrder
type CreateNewOrderResponse ¶
type CreateNewOrderResponse struct {
Order `json:"order"`
}
CreateNewOrderResponse body for CreateNewOrder
type CreatePaymentRequest ¶ added in v0.0.5
type CreatePaymentRequest struct { Amount int `json:"amount"` CurrencyID string `json:"currency_id"` Method string `json:"method"` Network string `json:"network"` }
CreatePaymentRequest represents a request to create a payment. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
type CreatePaymentResponse ¶ added in v0.0.5
type CreatePaymentResponse struct { Order struct { ID string `json:"id"` } `json:"order"` }
CreatePaymentResponse represents a response to create a payment. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
type CryptoCurrency ¶ added in v0.0.5
type CryptoCurrency struct { ID string `json:"id"` Precision int `json:"precision"` Icon string `json:"icon"` Ticker string `json:"ticker"` IsFiat bool `json:"is_fiat"` Limits map[string]CoinLimit `json:"limits"` Min string `json:"min"` Max string `json:"max"` IsStable bool `json:"is_stable"` Name string `json:"name"` Networks map[string]Network `json:"networks"` ExchangeRate string `json:"exchange_rate"` PresetDonationValues []interface{} `json:"preset_donation_values"` }
type Currency ¶
type Currency struct { // ID currency identifier ID string `json:"id"` // Ticker currency ticker Ticker string `json:"ticker"` // Title currency title Title string `json:"title"` // Value currency value Value string `json:"value"` }
Currency represents a WhitePay currency.
type ErrorBody ¶
type ErrorBody struct { Message string `json:"message"` Errors map[string][]string `json:"errors,omitempty"` }
ErrorBody represents an error response body.
type EventType ¶
type EventType string
EventType https://docs.whitepay.com/docs/webhooks/events#webhooks-settings
const ( EventWithdrawalCompleted EventType = "withdrawal::completed" EventWithdrawalDeclined EventType = "withdrawal::declined" EventRollbackToMerchant EventType = "rollback::to_merchant" EventRollbackToClient EventType = "rollback::to_client" EventOrderCompleted EventType = "order::completed" EventOrderDeclined EventType = "order::declined" EventOrderPartiallyFulfilled EventType = "order::partially_fulfilled" EventOrderFinalAmountWasReceived EventType = "order::final_amount_was_received" EventTransactionCompleted EventType = "transaction::complete" EventTransactionDeclined EventType = "transaction::decline" EventTransactionWasFinalExchange EventType = "transaction::was_final_exchange" )
type Events ¶ added in v0.0.6
type Events struct { Transaction *Transaction `json:"transaction,omitempty"` Order *Order `json:"order,omitempty"` EventType EventType `json:"event_type"` }
type Filters ¶
func CompletedAtFrom ¶
func CompletedAtTo ¶
func ExternalOrderID ¶
func OrderStatusID ¶
type GetCryptoOrderDetailsResponse ¶
type GetCryptoOrderDetailsResponse struct {
Order `json:"order"`
}
GetCryptoOrderDetailsResponse body for GetCryptoOrderDetails
type InvoiceCurrencies ¶
type InvoiceCurrencies struct { // ID currency identifier ID string `json:"id"` // Ticker currency ticker Ticker string `json:"ticker"` // IsFiat a parameter that determines whether the currency is fiat IsFiat bool `json:"is_fiat"` // Title currency title Title string `json:"title"` // MinAmount minimum amount for the currency (numeric) MinAmount string `json:"min_amount"` // MaxAmount maximum amount for the currency (numeric) MaxAmount string `json:"max_amount"` // Precision (numeric) currency precision - number of characters after the decimal point Precision string `json:"precision"` // Icon currency icon for acquiring form Icon string `json:"icon"` }
InvoiceCurrencies represents a WhitePay invoice currency.
type ListCurrencies ¶ added in v0.0.5
type ListCurrencies struct {
CryptoCurrency []CryptoCurrency `json:"crypto_currency"`
}
ListCurrencies represents a list of cryptocurrencies. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
type Option ¶
type Option func(*WhitePay)
func WithChannelSize ¶ added in v0.0.6
WithChannelSize sets the size of the updates channel.
func WithClient ¶
WithClient sets the HTTP client for the WhitePay client.
func WithMerchantSignatureToken ¶ added in v0.0.6
WithMerchantSignatureToken sets the merchant signature token for the WhitePay client.
func WithSlugSignatureToken ¶ added in v0.0.6
WithSlugSignatureToken sets the slug signature token for the WhitePay client.
type Order ¶
type Order struct { // ID internal order identifier ID string `json:"id"` // Currency invoice currency (ticker) Currency string `json:"currency"` // OrderNumber unique 9-digit numeric order identifier in WhitePay CRM system. OrderNumber string `json:"order_number"` // Value (numeric) invoice currency amount Value string `json:"value"` // ExpectedAmount (numeric) expected amount to be deposited ExpectedAmount string `json:"expected_amount"` // ReceivedTotal (numeric) received amount in balance currency ReceivedTotal string `json:"received_total"` // ExchangeRate (numeric) fixated exchange rate of invoice ExchangeRate string `json:"exchange_rate"` // CleanExchangeRate - CleanExchangeRate interface{} `json:"clean_exchange_rate"` // IsInternal identifies whether payment was made via WhiteBIT platform or not where true = WhiteBIT platform payment and false = any other platform. IsInternal bool `json:"is_internal"` DepositedCurrency interface{} `json:"deposited_currency"` // ReceivedCurrency balance currency (ticker) ReceivedCurrency string `json:"received_currency"` // Status order status label Status Status `json:"status"` // ExternalOrderID external order identifier ExternalOrderID string `json:"external_order_id"` // CreatedAt order creation date CreatedAt string `json:"created_at"` // CompletedAt order completion date CompletedAt string `json:"completed_at"` // AcquiringURL unique payment form url. Should be used to redirect website customer to the payment form. AcquiringURL string `json:"acquiring_url"` // SuccessfulLink Link used to redirect user from payment form after order completion. Has to be URL SuccessfulLink string `json:"successful_link"` // FailureLink Link used to redirect user from payment form after order failure. Has to be URL FailureLink string `json:"failure_link"` Transactions []*Transaction `json:"transactions"` }
Order represents a WhitePay order.
type OrderStatusesListResponse ¶
type OrderStatusesListResponse struct {
OrderStatuses []*StatusObject `json:"order_statuses"`
}
type Pagination ¶
type Pagination struct { PerPage int `json:"per_page"` LastPage int `json:"last_page"` Total int `json:"total"` }
func (*Pagination) Next ¶
func (p *Pagination) Next() bool
type ShowCryptoOrdersListResponse ¶
type ShowCryptoOrdersListResponse struct { Orders []*Order `json:"orders"` Meta Pagination `json:"meta"` }
ShowCryptoOrdersListResponse body for ShowCryptoOrdersList
func (*ShowCryptoOrdersListResponse) Next ¶
func (s *ShowCryptoOrdersListResponse) Next() bool
type ShowInvoiceCurrenciesForCryptoOrderCreationResponse ¶
type ShowInvoiceCurrenciesForCryptoOrderCreationResponse struct {
Currencies []*Currency `json:"currencies"`
}
type ShowInvoiceCurrenciesForFiatOrderCreationResponse ¶
type ShowInvoiceCurrenciesForFiatOrderCreationResponse struct {
Currencies []*Currency `json:"currencies"`
}
type ShowOrderDetailsResponse ¶ added in v0.0.7
type ShowOrderDetailsResponse struct {
Order `json:"order"`
}
type ShowOrdersListResponse ¶
type ShowOrdersListResponse struct { Orders []*Order `json:"orders"` Meta Pagination `json:"meta"` }
func (*ShowOrdersListResponse) Next ¶
func (s *ShowOrdersListResponse) Next() bool
type StatusObject ¶ added in v0.0.7
StatusObject represents a WhitePay status.
type StockOrder ¶
type StockOrder struct { Amount string `json:"amount"` Status Status `json:"status"` Pair string `json:"pair"` Date string `json:"date"` Time string `json:"time"` ExchangeRate string `json:"exchange_rate"` CreatedAt string `json:"created_at"` }
StockOrder represents a WhitePay stock order.
type Transaction ¶
type Transaction struct { // ID transaction identifier ID string `json:"id"` // Currency transaction currency (ticker) Currency string `json:"currency"` // Value transaction amount Value string `json:"value"` // Status transaction status label Status Status `json:"status"` // Hash transaction hash Hash string `json:"hash"` // IsInternal identifies whether payment was made via WhiteBIT platform or not where true = WhiteBIT platform payment and false = any other platform. IsInternal bool `json:"is_internal"` // CreatedAt transaction creation date CreatedAt string `json:"created_at"` // CompletedAt transaction completion date CompletedAt string `json:"completed_at"` // StockOrders stock orders StockOrders []*StockOrder `json:"stock_orders,omitempty"` }
Transaction represents a WhitePay transaction.
type WalletOrderDetailResponse ¶ added in v0.0.5
type WalletOrderDetailResponse struct { Address string `json:"address"` Network string `json:"network"` Memo string `json:"memo,omitempty"` }
WalletOrderDetailResponse represents a response to get wallet order details. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
type WhitePay ¶
type WhitePay struct {
// contains filtered or unexported fields
}
WhitePay represents a WhitePay client.
func (*WhitePay) CompleteCryptoOrder ¶
func (wp *WhitePay) CompleteCryptoOrder(ctx context.Context, orderID string) (*CompleteCryptoOrderResponse, error)
CompleteCryptoOrder Complete Crypto Order
func (*WhitePay) CreateCryptoTopUp ¶
func (wp *WhitePay) CreateCryptoTopUp(ctx context.Context, req *CreateCryptoTopUpRequest) (*CreateCryptoTopUpResponse, error)
CreateCryptoTopUp Create Crypto Top Up
func (*WhitePay) CreateNewFiatOrder ¶
func (wp *WhitePay) CreateNewFiatOrder(ctx context.Context, req *CreateNewFiatOrder) (*CreateNewFiatOrderResponse, error)
CreateNewFiatOrder Create New Fiat Order
func (*WhitePay) CreateNewOrder ¶
func (wp *WhitePay) CreateNewOrder(ctx context.Context, req *CreateNewOrderRequest) (*CreateNewOrderResponse, error)
CreateNewOrder Create New Crypto Order
func (*WhitePay) CreatePayment ¶ added in v0.0.5
func (wp *WhitePay) CreatePayment(ctx context.Context, req *CreatePaymentRequest) (*CreatePaymentResponse, error)
CreatePayment creates a payment. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
func (*WhitePay) GetListCurrencies ¶ added in v0.0.5
func (wp *WhitePay) GetListCurrencies(ctx context.Context) (*ListCurrencies, error)
GetListCurrencies gets a list of currencies. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
func (*WhitePay) GetWalletOrderDetail ¶ added in v0.0.5
func (wp *WhitePay) GetWalletOrderDetail(ctx context.Context, orderID string) (*WalletOrderDetailResponse, error)
GetWalletOrderDetail gets wallet order details. Deprecated: DO NOT USE THIS METHODS RIGHT NOW
func (*WhitePay) ShowAccountBalances ¶
func (wp *WhitePay) ShowAccountBalances(ctx context.Context) (*AccountBalancesResponse, error)
ShowAccountBalances Get Show Account Balances
func (*WhitePay) ShowCryptoOrderDetails ¶
func (wp *WhitePay) ShowCryptoOrderDetails(ctx context.Context, orderID string) (*GetCryptoOrderDetailsResponse, error)
ShowCryptoOrderDetails Get Show Crypto Order Details
func (*WhitePay) ShowCryptoOrdersList ¶
func (wp *WhitePay) ShowCryptoOrdersList(ctx context.Context, filters ...Filters) (*ShowCryptoOrdersListResponse, error)
ShowCryptoOrdersList Get Show Crypto Orders List
func (*WhitePay) ShowInvoiceCurrenciesForCryptoOrderCreation ¶
func (wp *WhitePay) ShowInvoiceCurrenciesForCryptoOrderCreation(ctx context.Context) (*ShowInvoiceCurrenciesForCryptoOrderCreationResponse, error)
ShowInvoiceCurrenciesForCryptoOrderCreation Get Show Invoice Currencies For Crypto Order Creation
func (*WhitePay) ShowInvoiceCurrenciesForCryptoTopUpOrderCreation ¶
func (wp *WhitePay) ShowInvoiceCurrenciesForCryptoTopUpOrderCreation(ctx context.Context) *ShowInvoiceCurrenciesForCryptoOrderCreationResponse
ShowInvoiceCurrenciesForCryptoTopUpOrderCreation Get Show Crypto Top Up Details
func (*WhitePay) ShowInvoiceCurrenciesForFiatOrderCreation ¶
func (wp *WhitePay) ShowInvoiceCurrenciesForFiatOrderCreation(ctx context.Context) (*ShowInvoiceCurrenciesForFiatOrderCreationResponse, error)
ShowInvoiceCurrenciesForFiatOrderCreation Get Show Invoice Currencies For Fiat Order Creation
func (*WhitePay) ShowOrderDetails ¶
func (wp *WhitePay) ShowOrderDetails(ctx context.Context, orderID string) (*ShowOrderDetailsResponse, error)
ShowOrderDetails Show Order Details
func (*WhitePay) ShowOrderStatusesList ¶
func (wp *WhitePay) ShowOrderStatusesList(ctx context.Context) (*OrderStatusesListResponse, error)
ShowOrderStatusesList Get Show Statuses List
func (*WhitePay) ShowOrdersList ¶
func (wp *WhitePay) ShowOrdersList(ctx context.Context, filters ...Filters) (*ShowOrdersListResponse, error)
ShowOrdersList Get Show Orders List
func (*WhitePay) SignTransaction ¶ added in v0.0.8
func (*WhitePay) Updates ¶ added in v0.0.6
Updates returns a channel that can be used to receive WhitePay events.
func (*WhitePay) WebhookHandler ¶ added in v0.0.6
func (wp *WhitePay) WebhookHandler() http.HandlerFunc
WebhookHandler returns a http.HandlerFunc that can be used to handle WhitePay webhooks.