Documentation
¶
Index ¶
- Constants
- type BalancesResponse
- type BalancesResponseData
- type BalancesResponseDataItem
- type BanksBranchesFilter
- type BanksBranchesResponse
- type BanksBranchesResponseData
- type BanksBranchesResponseDataItem
- type BanksFilter
- type BanksResource
- type BanksResponse
- type BanksResponseData
- type BanksResponseDataItem
- type Client
- func (c *Client) Banks() *BanksResource
- func (c *Client) Collections() *CollectionsResource
- func (c *Client) Merchants() *MerchantsResource
- func (c *Client) Payouts() *PayoutsResource
- func (c *Client) Providers() *ProvidersResource
- func (c *Client) Refunds() *RefundsResource
- func (c *Client) Webhooks() *WebhooksResource
- type CollectionRequest
- type CollectionResponse
- type CollectionResponseData
- type CollectionWebhook
- type CollectionsResource
- type Config
- type CountryCode
- type CurrencyCode
- type IncomingWebhookInterface
- type MerchantsResource
- type PayoutRequest
- type PayoutResponse
- type PayoutResponseData
- type PayoutWebhook
- type PayoutsResource
- type ProvidersFilter
- type ProvidersResource
- type ProvidersResponse
- type ProvidersResponseData
- type ProvidersResponseDataItem
- type RefundRequest
- type RefundResponse
- type RefundResponseData
- type RefundWebhook
- type RefundsResource
- type RequestBuilder
- type ResourceAbstract
- type ResponseBody
- type SignatureValidator
- type TransactionMethodCode
- type TransactionStatusCode
- type TransactionTypeCode
- type Transport
- func (tr *Transport) Get(ctx context.Context, path string, query map[string]interface{}) (resp *http.Response, err error)
- func (tr *Transport) Post(ctx context.Context, path string, body map[string]interface{}, ...) (resp *http.Response, err error)
- func (tr *Transport) SendRequest(ctx context.Context, method string, path string, query map[string]interface{}, ...) (resp *http.Response, err error)
- type WebhookResponse
- type WebhookResponseData
- type WebhookResponsePayload
- type WebhooksResource
Constants ¶
const ProdAPIUrl = "https://api.dusupay.com"
ProdAPIUrl production ENV API url
const SandboxAPIUrl = "https://sandbox.dusupay.com"
SandboxAPIUrl sandbox ENV API url
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalancesResponse ¶
type BalancesResponse struct { ResponseBody Data *BalancesResponseData `json:"data,omitempty"` }
BalancesResponse struct
type BalancesResponseData ¶
type BalancesResponseData []*BalancesResponseDataItem
BalancesResponseData struct
func (*BalancesResponseData) UnmarshalJSON ¶
func (brd *BalancesResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshal json data
type BalancesResponseDataItem ¶
type BalancesResponseDataItem struct { Currency string `json:"currency"` Balance float64 `json:"balance"` }
BalancesResponseDataItem struct
type BanksBranchesFilter ¶
type BanksBranchesFilter struct { //ISO-2 country code from those supported Country CountryCode `json:"country_code"` Bank string `json:"bank_code"` }
BanksBranchesFilter branches list filter (see https://docs.dusupay.com/sending-money/payouts/bank-branches)
type BanksBranchesResponse ¶
type BanksBranchesResponse struct { ResponseBody Data *BanksBranchesResponseData `json:"data,omitempty"` }
BanksBranchesResponse struct
type BanksBranchesResponseData ¶
type BanksBranchesResponseData []*BanksBranchesResponseDataItem
BanksBranchesResponseData struct
func (*BanksBranchesResponseData) UnmarshalJSON ¶
func (rsp *BanksBranchesResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshal json data
type BanksBranchesResponseDataItem ¶
BanksBranchesResponseDataItem struct
type BanksFilter ¶
type BanksFilter struct { TransactionType TransactionTypeCode `json:"transaction_type"` //ISO-2 country code from those supported Country CountryCode `json:"country_code"` }
BanksFilter (see https://docs.dusupay.com/sending-money/payouts/bank-codes)
type BanksResource ¶
type BanksResource struct {
ResourceAbstract
}
BanksResource wrapper
func (*BanksResource) GetBranchesList ¶
func (r *BanksResource) GetBranchesList(ctx context.Context, filter *BanksBranchesFilter) (*BanksBranchesResponse, *http.Response, error)
GetBranchesList get banks branches list (see https://docs.dusupay.com/sending-money/payouts/bank-branches)
func (*BanksResource) GetList ¶
func (r *BanksResource) GetList(ctx context.Context, filter *BanksFilter) (*BanksResponse, *http.Response, error)
GetList get banks list (see https://docs.dusupay.com/sending-money/payouts/bank-codes)
type BanksResponse ¶
type BanksResponse struct { ResponseBody Data *BanksResponseData `json:"data,omitempty"` }
BanksResponse struct
type BanksResponseData ¶
type BanksResponseData []*BanksResponseDataItem
BanksResponseData struct
func (*BanksResponseData) UnmarshalJSON ¶
func (rsp *BanksResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshal json data
type BanksResponseDataItem ¶
type BanksResponseDataItem struct { Id string `json:"id"` Name string `json:"name"` TransactionCurrency string `json:"transaction_currency"` MinAmount float64 `json:"min_amount"` MaxAmount float64 `json:"max_amount"` BankCode string `json:"bank_code"` Available bool `json:"available"` SandboxTestAccounts struct { Success string `json:"success"` Failure string `json:"failure"` } `json:"sandbox_test_accounts,omitempty"` }
BanksResponseDataItem struct
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func NewClientFromConfig ¶
NewClientFromConfig Create new client from config
func (*Client) Collections ¶
func (c *Client) Collections() *CollectionsResource
Collections resource
type CollectionRequest ¶
type CollectionRequest struct { Currency CurrencyCode `json:"currency"` Amount float64 `json:"amount"` Method TransactionMethodCode `json:"method"` ProviderId string `json:"provider_id"` AccountNumber string `json:"account_number"` MerchantReference string `json:"merchant_reference"` Narration string `json:"narration"` MobileMoneyHpp bool `json:"mobile_money_hpp"` RedirectUrl string `json:"redirect_url"` AccountName string `json:"account_name"` AccountEmail string `json:"account_email"` Voucher string `json:"voucher"` }
CollectionRequest struct
type CollectionResponse ¶
type CollectionResponse struct { ResponseBody Data *CollectionResponseData `json:"data,omitempty"` }
CollectionResponse struct
type CollectionResponseData ¶
type CollectionResponseData struct { ID int64 `json:"id"` RequestAmount float64 `json:"request_amount"` RequestCurrency string `json:"request_currency"` AccountAmount float64 `json:"account_amount"` AccountCurrency string `json:"account_currency"` TransactionFee float64 `json:"transaction_fee"` TotalCredit float64 `json:"total_credit"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` InternalReference string `json:"internal_reference"` TransactionStatus string `json:"transaction_status"` TransactionType string `json:"transaction_type"` Message string `json:"message"` CustomerCharged bool `json:"customer_charged"` PaymentURL string `json:"payment_url"` Instructions []struct { StepNo string `json:"step_no"` Description string `json:"description"` } `json:"instructions"` }
CollectionResponseData struct
type CollectionWebhook ¶
type CollectionWebhook struct { ID int64 `json:"id"` RequestAmount float64 `json:"request_amount"` RequestCurrency string `json:"request_currency"` AccountAmount float64 `json:"account_amount"` AccountCurrency string `json:"account_currency"` TransactionFee float64 `json:"transaction_fee"` TotalCredit float64 `json:"total_credit"` CustomerCharged bool `json:"customer_charged"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` InternalReference string `json:"internal_reference"` TransactionStatus string `json:"transaction_status"` TransactionType string `json:"transaction_type"` Message string `json:"message"` AccountNumber string `json:"account_number"` AccountName string `json:"account_name"` InstitutionName string `json:"institution_name"` }
CollectionWebhook struct
func (*CollectionWebhook) BuildPayloadString ¶ added in v0.0.8
func (cw *CollectionWebhook) BuildPayloadString(url string) string
type CollectionsResource ¶
type CollectionsResource struct {
ResourceAbstract
}
CollectionsResource wrapper
func (*CollectionsResource) Create ¶
func (r *CollectionsResource) Create(ctx context.Context, req *CollectionRequest) (*CollectionResponse, *http.Response, error)
Create collection request (see https://docs.dusupay.com/receiving-money/collections/post-collection-request)
type Config ¶
type Config struct { Uri string `json:"uri"` PublicKey string `json:"public_key"` SecretKey string `json:"secret_key"` WebhookHash string `json:"webhook_hash"` }
Config structure
func NewConfigSandbox ¶
NewConfigSandbox Create new config from credentials (Sandbox version)
type CountryCode ¶
type CountryCode string
CountryCode type
const CountryCodeBurundi CountryCode = "BI"
CountryCodeBurundi type
const CountryCodeCameroon CountryCode = "CM"
CountryCodeCameroon type
const CountryCodeEurope CountryCode = "EU"
CountryCodeEurope type
const CountryCodeGhana CountryCode = "GH"
CountryCodeGhana type
const CountryCodeKenya CountryCode = "KE"
CountryCodeKenya type
const CountryCodeNigeria CountryCode = "NG"
CountryCodeNigeria type
const CountryCodeRwanda CountryCode = "RW"
CountryCodeRwanda type
const CountryCodeSouthAfrica CountryCode = "ZA"
CountryCodeSouthAfrica type
const CountryCodeTanzania CountryCode = "TZ"
CountryCodeTanzania type
const CountryCodeUSA CountryCode = "US"
CountryCodeUSA type
const CountryCodeUganda CountryCode = "UG"
CountryCodeUganda type
const CountryCodeUnitedKingdom CountryCode = "GB"
CountryCodeUnitedKingdom type
const CountryCodeZambia CountryCode = "ZM"
CountryCodeZambia type
type CurrencyCode ¶
type CurrencyCode string
CurrencyCode type
const CurrencyCodeBIF CurrencyCode = "BIF"
CurrencyCodeBIF type
const CurrencyCodeEUR CurrencyCode = "EUR"
CurrencyCodeEUR type
const CurrencyCodeGBP CurrencyCode = "GBP"
CurrencyCodeGBP type
const CurrencyCodeGHS CurrencyCode = "GHS"
CurrencyCodeGHS type
const CurrencyCodeKES CurrencyCode = "KES"
CurrencyCodeKES type
const CurrencyCodeNGN CurrencyCode = "NGN"
CurrencyCodeNGN type
const CurrencyCodeRWF CurrencyCode = "RWF"
CurrencyCodeRWF type
const CurrencyCodeTZS CurrencyCode = "TZS"
CurrencyCodeTZS type
const CurrencyCodeUGX CurrencyCode = "UGX"
CurrencyCodeUGX type
const CurrencyCodeUSD CurrencyCode = "USD"
CurrencyCodeUSD type
const CurrencyCodeXAF CurrencyCode = "XAF"
CurrencyCodeXAF type
const CurrencyCodeZAR CurrencyCode = "ZAR"
CurrencyCodeZAR type
const CurrencyCodeZMW CurrencyCode = "ZMW"
CurrencyCodeZMW type
type IncomingWebhookInterface ¶ added in v0.0.8
IncomingWebhookInterface interface
type MerchantsResource ¶
type MerchantsResource struct {
ResourceAbstract
}
MerchantsResource wrapper
func (*MerchantsResource) GetBalances ¶
func (r *MerchantsResource) GetBalances(ctx context.Context) (*BalancesResponse, *http.Response, error)
GetBalances get balances list (see https://docs.dusupay.com/appendix/account-balance)
type PayoutRequest ¶
type PayoutRequest struct { Currency CurrencyCode `json:"currency"` Amount float64 `json:"amount"` Method TransactionMethodCode `json:"method"` ProviderId string `json:"provider_id"` AccountNumber string `json:"account_number"` AccountName string `json:"account_name"` AccountEmail string `json:"account_email"` MerchantReference string `json:"merchant_reference"` Narration string `json:"narration"` ExtraParams struct { BankCode string `json:"bank_code"` BankBranchCode string `json:"branch_code"` } `json:"extra_params"` }
PayoutRequest struct
type PayoutResponse ¶
type PayoutResponse struct { ResponseBody Data *PayoutResponseData `json:"data,omitempty"` }
PayoutResponse struct
type PayoutResponseData ¶
type PayoutResponseData struct { ID int64 `json:"id"` RequestAmount float64 `json:"request_amount"` RequestCurrency string `json:"request_currency"` AccountAmount float64 `json:"account_amount"` AccountCurrency string `json:"account_currency"` TransactionFee float64 `json:"transaction_fee"` TotalDebit float64 `json:"total_debit"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` InternalReference string `json:"internal_reference"` TransactionStatus string `json:"transaction_status"` TransactionType string `json:"transaction_type"` Message string `json:"message"` }
PayoutResponseData struct
type PayoutWebhook ¶
type PayoutWebhook struct { ID int64 `json:"id"` RequestAmount float64 `json:"request_amount"` RequestCurrency string `json:"request_currency"` AccountAmount float64 `json:"account_amount"` AccountCurrency string `json:"account_currency"` TransactionFee float64 `json:"transaction_fee"` TotalDebit float64 `json:"total_debit"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` InternalReference string `json:"internal_reference"` TransactionStatus string `json:"transaction_status"` TransactionType string `json:"transaction_type"` Message string `json:"message"` AccountNumber string `json:"account_number"` AccountName string `json:"account_name"` InstitutionName string `json:"institution_name"` }
PayoutWebhook struct
func (*PayoutWebhook) BuildPayloadString ¶ added in v0.0.8
func (pw *PayoutWebhook) BuildPayloadString(url string) string
type PayoutsResource ¶
type PayoutsResource struct {
ResourceAbstract
}
PayoutsResource wrapper
func (*PayoutsResource) Create ¶
func (r *PayoutsResource) Create(ctx context.Context, req *PayoutRequest) (*PayoutResponse, *http.Response, error)
Create payout request (see https://docs.dusupay.com/sending-money/payouts/post-payout-request)
type ProvidersFilter ¶
type ProvidersFilter struct { TransactionType TransactionTypeCode `json:"transaction_type"` Method TransactionMethodCode `json:"method"` Country CountryCode `json:"country"` }
ProvidersFilter list of providers filter
type ProvidersResource ¶
type ProvidersResource struct {
ResourceAbstract
}
ProvidersResource wrapper
func (*ProvidersResource) GetList ¶
func (r *ProvidersResource) GetList(ctx context.Context, filter *ProvidersFilter) (*ProvidersResponse, *http.Response, error)
GetList Get providers list (see https://docs.dusupay.com/appendix/payment-options/payment-providers)
type ProvidersResponse ¶
type ProvidersResponse struct { ResponseBody Data *ProvidersResponseData `json:"data,omitempty"` }
ProvidersResponse struct
type ProvidersResponseData ¶
type ProvidersResponseData []*ProvidersResponseDataItem
ProvidersResponseData struct
func (*ProvidersResponseData) UnmarshalJSON ¶
func (rsp *ProvidersResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON method
type ProvidersResponseDataItem ¶
type ProvidersResponseDataItem struct { ID string `json:"id"` Name string `json:"name"` TransactionCurrency string `json:"transaction_currency"` MinAmount float64 `json:"min_amount"` MaxAmount float64 `json:"max_amount"` Available bool `json:"available"` SandboxTestAccounts struct { Success string `json:"success"` Failure string `json:"failure"` } `json:"sandbox_test_accounts,omitempty"` }
ProvidersResponseDataItem struct
type RefundRequest ¶
type RefundRequest struct { Amount float64 `json:"amount"` InternalReference string `json:"internal_reference"` }
RefundRequest struct
type RefundResponse ¶
type RefundResponse struct { ResponseBody Data *RefundResponseData `json:"data,omitempty"` }
RefundResponse struct
type RefundResponseData ¶
type RefundResponseData struct { ID int64 `json:"id"` RefundAmount float64 `json:"refund_amount"` RefundCurrency string `json:"refund_currency"` TransactionFee float64 `json:"transaction_fee"` TotalDebit float64 `json:"total_debit"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` CollectionReference string `json:"collection_reference"` InternalReference string `json:"internal_reference"` TransactionType string `json:"transaction_type"` TransactionStatus string `json:"transaction_status"` AccountNumber string `json:"account_number"` Message string `json:"message"` }
RefundResponseData struct
type RefundWebhook ¶
type RefundWebhook struct { ID int64 `json:"id"` RefundAmount float64 `json:"refund_amount"` RefundCurrency string `json:"refund_currency"` TransactionFee float64 `json:"transaction_fee"` TotalDebit float64 `json:"total_debit"` ProviderID string `json:"provider_id"` CollectionReference string `json:"collection_reference"` InternalReference string `json:"internal_reference"` TransactionType string `json:"transaction_type"` TransactionStatus string `json:"transaction_status"` AccountNumber string `json:"account_number"` Message string `json:"message"` }
RefundWebhook struct
func (*RefundWebhook) BuildPayloadString ¶ added in v0.0.8
func (rw *RefundWebhook) BuildPayloadString(url string) string
type RefundsResource ¶
type RefundsResource struct {
ResourceAbstract
}
RefundsResource wrapper
func (*RefundsResource) Create ¶
func (r *RefundsResource) Create(ctx context.Context, req *RefundRequest) (*RefundResponse, *http.Response, error)
Create refund request (see https://docs.dusupay.com/appendix/refunds)
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder handler
type ResourceAbstract ¶
type ResourceAbstract struct {
// contains filtered or unexported fields
}
ResourceAbstract base resource
func NewResourceAbstract ¶
func NewResourceAbstract(transport *Transport, config *Config) ResourceAbstract
NewResourceAbstract Create new resource abstract
type ResponseBody ¶
type ResponseBody struct { Code int `json:"code"` Status string `json:"status"` Message string `json:"message"` }
ResponseBody struct
type SignatureValidator ¶ added in v0.0.8
type SignatureValidator struct {
// contains filtered or unexported fields
}
SignatureValidator struct
func NewSignatureValidator ¶ added in v0.0.8
func NewSignatureValidator(publicKeyBytes []byte) (*SignatureValidator, error)
NewSignatureValidator method
func (*SignatureValidator) ValidateSignature ¶ added in v0.0.8
func (sv *SignatureValidator) ValidateSignature(webhook IncomingWebhookInterface, webhookUrl string, signature string) error
ValidateSignature method (see https://docs.dusupay.com/webhooks-and-redirects/webhooks/signature-verification)
type TransactionMethodCode ¶
type TransactionMethodCode string
TransactionMethodCode type
const TransactionMethodBank TransactionMethodCode = "BANK"
TransactionMethodBank type
const TransactionMethodCard TransactionMethodCode = "CARD"
TransactionMethodCard type
const TransactionMethodCrypto TransactionMethodCode = "CRYPTO"
TransactionMethodCrypto type
const TransactionMethodMobileMoney TransactionMethodCode = "MOBILE_MONEY"
TransactionMethodMobileMoney type
type TransactionStatusCode ¶
type TransactionStatusCode string
TransactionStatusCode type
const TransactionStatusCancelled TransactionStatusCode = "CANCELLED"
TransactionStatusCancelled const
const TransactionStatusCompleted TransactionStatusCode = "COMPLETED"
TransactionStatusCompleted const
const TransactionStatusFailed TransactionStatusCode = "FAILED"
TransactionStatusFailed const
const TransactionStatusPending TransactionStatusCode = "PENDING"
TransactionStatusPending const
type TransactionTypeCode ¶
type TransactionTypeCode string
TransactionTypeCode type
const TransactionTypeCollection TransactionTypeCode = "COLLECTION"
TransactionTypeCollection const
const TransactionTypePayout TransactionTypeCode = "PAYOUT"
TransactionTypePayout const
const TransactionTypeRefund TransactionTypeCode = "REFUND"
TransactionTypeRefund const
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport wrapper
func NewHttpTransport ¶
NewHttpTransport create new http transport
func (*Transport) Get ¶
func (tr *Transport) Get(ctx context.Context, path string, query map[string]interface{}) (resp *http.Response, err error)
Get method
type WebhookResponse ¶
type WebhookResponse struct { ResponseBody Data *WebhookResponseData `json:"data,omitempty"` }
WebhookResponse struct
type WebhookResponseData ¶
type WebhookResponseData struct {
Payload *WebhookResponsePayload `json:"payload,omitempty"`
}
WebhookResponseData struct
type WebhookResponsePayload ¶
type WebhookResponsePayload struct { ID int64 `json:"id"` RequestAmount float64 `json:"request_amount"` RequestCurrency string `json:"request_currency"` AccountAmount float64 `json:"account_amount"` AccountCurrency string `json:"account_currency"` TransactionFee float64 `json:"transaction_fee"` ProviderID string `json:"provider_id"` MerchantReference string `json:"merchant_reference"` InternalReference string `json:"internal_reference"` TransactionStatus string `json:"transaction_status"` TransactionType string `json:"transaction_type"` Message string `json:"message"` }
WebhookResponsePayload struct
type WebhooksResource ¶
type WebhooksResource struct {
ResourceAbstract
}
WebhooksResource wrapper
func (*WebhooksResource) SendCallback ¶
func (r *WebhooksResource) SendCallback(ctx context.Context, internalReference string) (*WebhookResponse, *http.Response, error)
SendCallback (see https://docs.dusupay.com/appendix/webhooks/webhook-trigger)