Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrencyAmount ¶
type CurrencyAmount struct { CurrencyFrom string `json:"currency_from"` CurrencyTo string `json:"currency_to"` Amount float64 `json:"min_amount"` }
CurrencyAmount has info about minimum payment amount for a specific pair.
func MinimumAmount ¶
func MinimumAmount(currencyFrom, currencyTo string) (*CurrencyAmount, error)
MinimumAmount returns the minimum payment amount for a specific pair.
type Estimate ¶
type Estimate struct { CurrencyFrom string `json:"currency_from"` CurrencyTo string `json:"currency_to"` AmountFrom float64 `json:"amount_from"` EstimatedAmount string `json:"estimated_amount"` }
Estimate holds the estimated amount of crypto for a given Fiat value.
func EstimatedPrice ¶
EstimatedPrice calculates the approximate price in cryptocurrency for a given value in Fiat currency. Need to provide the initial cost in the Fiat currency (amount, currency_from) and the necessary cryptocurrency (currency_to). Currently following fiat currencies are available: usd, eur, nzd, brl.
type Invoice ¶
type Invoice struct { InvoiceArgs // FIXME: inconsistency on their side: should be a float64, like // the field used for a payment. PriceAmount string `json:"price_amount"` ID string `json:"id"` CreatedAt string `json:"created_at,omitempty"` InvoiceURL string `json:"invoice_url,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` }
Invoice describes an invoice. InvoiceURL is the URL to follow to make the payment.
type InvoiceArgs ¶
type InvoiceArgs struct { PaymentAmount CancelURL string `json:"cancel_url,omitempty"` SuccessURL string `json:"success_url,omitempty"` }
InvoiceArgs are the arguments used to make an invoice.
type InvoicePaymentArgs ¶
type InvoicePaymentArgs struct { InvoiceID string `json:"iid"` PayCurrency string `json:"pay_currency"` PurchaseID string `json:"purchase_id,omitempty"` OrderDescription string `json:"order_description,omitempty"` CustomerEmail string `json:"customer_email,omitempty"` PayoutCurrency string `json:"payout_currency,omitempty"` PayoutExtraID string `json:"payout_extra_id,omitempty"` PayoutAddress string `json:"payout_address,omitempty"` }
type LatestEstimate ¶
type LatestEstimate struct { PaymentID string `json:"id"` TokenID string `json:"token_id"` PayAmount float64 `json:"pay_amount"` ExpirationDate string `json:"expiration_estimate_date"` }
LatestEstimate holds info about the last price estimation.
func RefreshEstimatedPrice ¶
func RefreshEstimatedPrice(paymentID string) (*LatestEstimate, error)
RefreshEstimatedPrice gets the current estimate on the payment and update the current estimate.
type ListOption ¶
type ListOption struct { DateFrom string DateTo string Limit int OrderBy string Page int SortBy string }
ListOption are options applying to the list of transactions.
type Payment ¶
type Payment struct { PaymentAmount ID string `json:"payment_id"` AmountReceived float64 `json:"amount_received"` BurningPercent int `json:"burning_percent"` CreatedAt string `json:"created_at"` ExpirationEstimateDate string `json:"expiration_estimate_date"` Network string `json:"network"` NetworkPrecision int `json:"network_precision"` PayAddress string `json:"pay_address"` PayinExtraID string `json:"payin_extra_id"` PurchaseID string `json:"purchase_id"` SmartContract string `json:"smart_contract"` Status string `json:"payment_status"` TimeLimit string `json:"time_limit"` UpdatedAt string `json:"updated_at"` }
Payment holds payment related information once we get a response from the server. FIXME: the API doc misses information about returned fields. Misses also HTTP return codes. Why is purchase_id an int instead of a string (payment status response)? Another inconsistency: list of all payments returns a payment ID as an int instead of a string https://documenter.getpostman.com/view/7907941/S1a32n38?version=latest#5e37f3ad-0fa1-4292-af51-5c7f95730486
func NewFromInvoice ¶
func NewFromInvoice(ipa *InvoicePaymentArgs) (*Payment, error)
NewFromInvoice creates a payment from an existing invoice. ID is the invoice's identifier.
type PaymentAmount ¶
type PaymentAmount struct { PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PayCurrency string `json:"pay_currency"` CallbackURL string `json:"ipn_callback_url,omitempty"` OrderID string `json:"order_id,omitempty"` OrderDescription string `json:"order_description,omitempty"` }
PaymentAmount defines common fields used in PaymentArgs and Payment structs.
type PaymentArgs ¶
type PaymentArgs struct { PaymentAmount FeePaidByUser bool `json:"is_fee_paid_by_user,omitempty"` FixedRate bool `json:"fixed_rate,omitempty"` PayoutAddress string `json:"payout_address,omitempty"` PayAmount float64 `json:"pay_amount,omitempty"` PayoutCurrency string `json:"payout_currency,omitempty"` PayoutExtraID string `json:"payout_extra_id,omitempty"` PurchaseID string `json:"purchase_id,omitempty"` }
PaymentArgs are the arguments used to make a payment.
type PaymentHack ¶
type PaymentHack struct { Payment // Using ID as an int instead a string as a quick work around. ID int `json:"payment_id"` }
PaymentHack has all the fields from Payment except the ID field which has a different type due to an API inconsistency on their side.
func List ¶
func List(o *ListOption) ([]*PaymentHack, error)
List returns a list of all transactions for a given API key, depending on the supplied options (which can be nil).
type PaymentStatus ¶
type PaymentStatus struct { ActuallyPaid float64 `json:"actually_paid"` // CreatedAt looks like 2019-04-18T13:39:27.982Z. CreatedAt string `json:"created_at"` OutcomeAmount float64 `json:"outcome_amount"` OutcomeCurrency string `json:"outcome_currency"` PayAddress string `json:"pay_address"` PayAmount float64 `json:"pay_amount"` PayCurrency string `json:"pay_currency"` PriceAmount float64 `json:"price_amount"` PriceCurrency string `json:"price_currency"` PurchaseID int `json:"purchase_id"` Status string `json:"payment_status"` UpdatedAt string `json:"updated_at"` }
PaymentStatus is the actual information about a payment.
func Status ¶
func Status(paymentID string) (*PaymentStatus, error)
Status gets the actual information about the payment. You need to provide the ID of the payment in the request. Note that unlike what the official doc says, a Bearer JWTtoken is required for this endpoint to work.