Documentation
¶
Index ¶
- Constants
- func VerifyWebhookSignature(body []byte, signature, secretKey string) bool
- type BalanceResponse
- type Bank
- type BaseResponse
- type Client
- func (c *Client) CreateH2H(request CreateH2HRequest) (*H2HResponse, error)
- func (c *Client) CreateInvoice(request CreateInvoiceRequest) (*InvoiceResponse, error)
- func (c *Client) CreatePayoff(request CreatePayoffRequest) (*PayoffResponse, error)
- func (c *Client) GetBalance(userID string) (*BalanceResponse, error)
- func (c *Client) GetInvoiceInfo(request GetInvoiceInfoRequest) (*InvoiceInfoResponse, error)
- func (c *Client) GetPaymentTariffs(request GetPaymentTariffsRequest) (*PaymentTariffsResponse, error)
- func (c *Client) GetPayoffInfo(request GetPayoffInfoRequest) (*PayoffInfoResponse, error)
- func (c *Client) GetSbpBankList(request GetSbpBankListRequest) (*SbpBankListResponse, error)
- type Config
- type CreateH2HRequest
- type CreateInvoiceRequest
- type CreatePayoffRequest
- type Currency
- type GetInvoiceInfoRequest
- type GetPaymentTariffsRequest
- type GetPayoffInfoRequest
- type GetSbpBankListRequest
- type H2HResponse
- type InvoiceInfoResponse
- type InvoiceResponse
- type PaymentData
- type PaymentMethod
- type PaymentTariffsResponse
- type PayoffData
- type PayoffInfoResponse
- type PayoffResponse
- type SbpBankListResponse
- type Tariff
Constants ¶
const ( DefaultBaseURL = "https://api.enot.io" DefaultRequestTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func VerifyWebhookSignature ¶
VerifyWebhookSignature проверяет сигнатуру Webhook'а.
Входные параметры:
- body: тело Webhook'а в формате JSON.
- signature: сигнатура из заголовка x-api-sha256-signature.
- secretKey: секретный ключ для проверки подписи.
Возвращаемое значение: true, если сигнатура верна, иначе false.
Types ¶
type BalanceResponse ¶
type BaseResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateH2H ¶
func (c *Client) CreateH2H(request CreateH2HRequest) (*H2HResponse, error)
CreateH2H создает платеж h2h. [https://docs.enot.io/e/new/create-invoice-h2h#info]
Входные параметры:
- request: структура CreateH2HRequest.
Возвращаемое значение: структура H2HResponse и ошибка, если она возникла.
func (*Client) CreateInvoice ¶
func (c *Client) CreateInvoice(request CreateInvoiceRequest) (*InvoiceResponse, error)
CreateInvoice создает новый инвойс. [https://docs.enot.io/e/new/create-invoice#request]
Входные параметры:
- request: структура CreateInvoiceRequest.
Возвращаемое значение: структура InvoiceResponse и ошибка, если она возникла.
func (*Client) CreatePayoff ¶
func (c *Client) CreatePayoff(request CreatePayoffRequest) (*PayoffResponse, error)
CreatePayoff создает заявку на вывод средств. [https://docs.enot.io/e/new/new-create-withdraw#payoff-request]
Входные параметры:
- request: структура CreatePayoffRequest.
Возвращаемое значение: структура PayoffResponse и ошибка, если она возникла.
func (*Client) GetBalance ¶
func (c *Client) GetBalance(userID string) (*BalanceResponse, error)
GetBalance получает баланс пользователя. [https://docs.enot.io/e/new/new-get-balance#request]
Входные параметры:
- userID: идентификатор пользователя.
Возвращаемое значение: структура BalanceResponse и ошибка, если она возникла.
func (*Client) GetInvoiceInfo ¶
func (c *Client) GetInvoiceInfo(request GetInvoiceInfoRequest) (*InvoiceInfoResponse, error)
GetInvoiceInfo получает информацию о платеже. [https://docs.enot.io/e/new/invoice-info-new#request]
Входные параметры:
- request: структура GetInvoiceInfoRequest.
Возвращаемое значение: структура InvoiceInfoResponse и ошибка, если она возникла.
func (*Client) GetPaymentTariffs ¶
func (c *Client) GetPaymentTariffs(request GetPaymentTariffsRequest) (*PaymentTariffsResponse, error)
GetPaymentTariffs получает список доступных методов оплаты. [https://docs.enot.io/e/new/payments-methods-new#request]
Входные параметры:
- request: структура GetPaymentTariffsRequest.
Возвращаемое значение: структура PaymentTariffsResponse и ошибка, если она возникла.
func (*Client) GetPayoffInfo ¶
func (c *Client) GetPayoffInfo(request GetPayoffInfoRequest) (*PayoffInfoResponse, error)
GetPayoffInfo получает информацию о выводе. [https://docs.enot.io/e/new/new-payment-info#get-payoff-info]
Входные параметры:
- request: структура GetPayoffInfoRequest.
Возвращаемое значение: структура PayoffInfoResponse и ошибка, если она возникла.
func (*Client) GetSbpBankList ¶
func (c *Client) GetSbpBankList(request GetSbpBankListRequest) (*SbpBankListResponse, error)
GetSbpBankList получает список банков для СБП. [https://docs.enot.io/e/new/get-sbp-bank-list#get-list-bank]
Входные параметры:
- request: структура GetSbpBankListRequest.
Возвращаемое значение: структура SbpBankListResponse и ошибка, если она возникла.
type CreateH2HRequest ¶
type CreateH2HRequest struct {
InvoiceID string `json:"invoice_id"`
ShopID string `json:"shop_id"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
PaymentData PaymentData `json:"payment_data"`
}
type CreateInvoiceRequest ¶
type CreateInvoiceRequest struct {
Amount float64 `json:"amount"`
OrderID string `json:"order_id"`
Currency Currency `json:"currency"`
ShopID string `json:"shop_id"`
HookURL string `json:"hook_url,omitempty"`
CustomFields string `json:"custom_fields,omitempty"`
Comment string `json:"comment,omitempty"`
FailURL string `json:"fail_url,omitempty"`
SuccessURL string `json:"success_url,omitempty"`
Expire int `json:"expire,omitempty"`
IncludeService []PaymentMethod `json:"include_service,omitempty"`
ExcludeService []PaymentMethod `json:"exclude_service,omitempty"`
}
type CreatePayoffRequest ¶
type CreatePayoffRequest struct {
UserID string `json:"user_id"`
Service string `json:"service"`
WalletTo string `json:"wallet_to"`
Amount float64 `json:"amount"`
OrderID string `json:"order_id,omitempty"`
Comment string `json:"comment,omitempty"`
HookURL string `json:"hook_url,omitempty"`
Subtract int `json:"subtract,omitempty"`
PayoffData PayoffData `json:"payoff_data,omitempty"`
}
type Currency ¶
type Currency string
const ( CurrencyRUB Currency = "RUB" CurrencyUSD Currency = "USD" CurrencyEUR Currency = "EUR" CurrencyUAH Currency = "UAH" CurrencyKZT Currency = "KZT" CurrencyBTC Currency = "BTC" CurrencyLTC Currency = "LTC" CurrencyUSDT_TRC20 Currency = "USDT_TRC20" CurrencyUSDT_ERC20 Currency = "USDT_ERC20" CurrencyTRX Currency = "TRX" CurrencyTON Currency = "TON" CurrencyDASH Currency = "DASH" CurrencyETH Currency = "ETH" CurrencyZCASH Currency = "ZCASH" CurrencyBTC_CASH Currency = "BTC_CASH" )
type GetInvoiceInfoRequest ¶
type GetPaymentTariffsRequest ¶
type GetPaymentTariffsRequest struct {
ShopID string `json:"shop_id"`
}
type GetPayoffInfoRequest ¶
type GetSbpBankListRequest ¶
type GetSbpBankListRequest struct {
UserID string `json:"user_id"`
}
type H2HResponse ¶
type H2HResponse struct {
StepTwoType string `json:"step_two_type"`
Wallet string `json:"wallet"`
ReceiverName string `json:"receiver_name"`
Bank string `json:"bank"`
Amount string `json:"amount"`
TimeEnd string `json:"time_end"`
URL string `json:"url"`
Type string `json:"type"`
IsRedirect bool `json:"is_redirect"`
Fingerprint bool `json:"fingerprint"`
IsNeedGetInfo bool `json:"is_need_get_info"`
}
type InvoiceInfoResponse ¶
type InvoiceInfoResponse struct {
InvoiceID string `json:"invoice_id"`
OrderID string `json:"order_id"`
ShopID string `json:"shop_id"`
Status string `json:"status"`
InvoiceAmount float64 `json:"invoice_amount"`
Credited *float64 `json:"credited"`
Currency string `json:"currency"`
PayService *string `json:"pay_service"`
PayerDetails *string `json:"payer_details"`
CommissionAmount float64 `json:"commission_amount"`
CommissionPercent float64 `json:"commission_percent"`
ShopCommissionAmount float64 `json:"shop_commission_amount"`
UserCommissionAmount float64 `json:"user_commission_amount"`
UserCommissionPercent float64 `json:"user_commission_percent"`
CustomField string `json:"custom_field"`
CreatedAt string `json:"created_at"`
ExpiredAt string `json:"expired_at"`
PaidAt string `json:"paid_at"`
}
type InvoiceResponse ¶
type PaymentData ¶
type PaymentData struct {
Bank string `json:"bank"`
}
type PaymentMethod ¶
type PaymentMethod string
const ( PaymentMethodCard PaymentMethod = "card" PaymentMethodMirCard PaymentMethod = "mir_card" PaymentMethodQiwi PaymentMethod = "qiwi" PaymentMethodPerfectMoney PaymentMethod = "perfect_money" PaymentMethodYoomoney PaymentMethod = "yoomoney" PaymentMethodSbp PaymentMethod = "sbp" PaymentMethodZcash PaymentMethod = "zcash" PaymentMethodAdvcash PaymentMethod = "advcash" PaymentMethodWebmoney PaymentMethod = "webmoney" PaymentMethodGooglePay PaymentMethod = "google_pay" PaymentMethodApplePay PaymentMethod = "apple_pay" PaymentMethodBitcoin PaymentMethod = "bitcoin" PaymentMethodEthereum PaymentMethod = "ethereum" PaymentMethodDash PaymentMethod = "dash" PaymentMethodLitecoin PaymentMethod = "litecoin" PaymentMethodUsdtTrc20 PaymentMethod = "usdt_trc20" PaymentMethodUsdtErc20 PaymentMethod = "usdt_erc20" PaymentMethodTrx PaymentMethod = "trx" PaymentMethodTon PaymentMethod = "ton" PaymentMethodBitcoinCash PaymentMethod = "bitcoin_cash" PaymentMethodP2PCard PaymentMethod = "p2p_card" PaymentMethodP2PSbp PaymentMethod = "p2p_sbp" )
type PaymentTariffsResponse ¶
type PaymentTariffsResponse struct {
Tariffs []Tariff `json:"tariffs"`
}
type PayoffData ¶
type PayoffData struct {
SbpBankType string `json:"sbp_bank_type,omitempty"`
}
type PayoffInfoResponse ¶
type PayoffInfoResponse struct {
PayoffID string `json:"payoff_id"`
Status string `json:"status"`
OrderID string `json:"order_id"`
Service string `json:"service"`
Wallet *string `json:"wallet"`
Type string `json:"type"`
Subtract string `json:"subtract"`
Amount float64 `json:"amount"`
AmountWithdrawRub float64 `json:"amount_withdraw_rub"`
CommissionRub float64 `json:"commission_rub"`
ReceiveCurrency string `json:"receive_currency"`
AmountReceive string `json:"amount_receive"`
Comment *string `json:"comment"`
CreatedAt string `json:"created_at"`
PaidAt string `json:"paid_at"`
ErrorMessage string `json:"error_message"`
}
type PayoffResponse ¶
type SbpBankListResponse ¶
type SbpBankListResponse struct {
Banks []Bank `json:"banks"`
}
type Tariff ¶
type Tariff struct {
Percent float64 `json:"percent"`
Fix float64 `json:"fix"`
MinSum float64 `json:"min_sum"`
MaxSum float64 `json:"max_sum"`
ShopPercent float64 `json:"shop_percent"`
UserPercent float64 `json:"user_percent"`
Service string `json:"service"`
ServiceLabel string `json:"service_label"`
Currency string `json:"currency"`
Status string `json:"status"`
}