coinpayments

package
v0.0.0-...-09e029e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIParams

type APIParams struct {
	Version string `url:"version"`
	Command string `url:"cmd"`
	Key     string `url:"key"`
}

type AccountInfo

type AccountInfo struct {
	Username   string `json:"username"`
	MerchantID string `json:"merchant_id"`
	Email      string `json:"email"`
	PublicName string `json:"public_name"`
	TimeJoined int64  `json:"time_joined"`
}

type AccountInfoResponse

type AccountInfoResponse struct {
	Error  string       `json:"error"`
	Result *AccountInfo `json:"result"`
}

type AccountInfoService

type AccountInfoService struct {
	ApiPublicKey string
	Params       APIParams
	// contains filtered or unexported fields
}

func (*AccountInfoService) Show

type Balance

type Balance struct {
	// Balance    uint64 `json:"balance,string"`
	BalanceF   string `json:"balancef"`
	CoinStatus string `json:"coin_status"`
	Status     string `json:"status"`
}

Balances struct for JSON Response `Balance` field is commented because the response has a mix of types for the field "balance" (satoshi)

func (*Balance) GetSatoshi

func (b *Balance) GetSatoshi() uint64

type BalanceBodyParams

type BalanceBodyParams struct {
	APIParams
	BalanceParams
}

type BalanceParams

type BalanceParams struct {
	All uint8 `url:"all"`
}

type BalanceResponse

type BalanceResponse struct {
	Error  string             `json:"error"`
	Result map[string]Balance `json:"result"`
}

type BalanceService

type BalanceService struct {
	ApiPublicKey string
	Params       BalanceBodyParams
	// contains filtered or unexported fields
}

func (*BalanceService) Show

func (s *BalanceService) Show(balanceParams *BalanceParams) (BalanceResponse, *http.Response, error)

type CallbackAddressBodyParams

type CallbackAddressBodyParams struct {
	APIParams
	CallbackAddressParams
}

type CallbackAddressParams

type CallbackAddressParams struct {
	Currency string `url:"currency"`
	IPNUrl   string `url:"ipn_url"`
}

type Client

type Client struct {
	AccountInfo      *AccountInfoService
	Rates            *RateService
	Balances         *BalanceService
	DepositAddresses *DepositAddressService
	Transactions     *TransactionService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(publicKey string, privateKey string, httpClient *http.Client) *Client

type DepositAddress

type DepositAddress struct {
	Address string `json:"address"`
	PubKey  string `json:"pubkey"`
	DestTag string `json:"dest_tag"`
}

type DepositAddressBodyParams

type DepositAddressBodyParams struct {
	APIParams
	DepositAddressParams
}

type DepositAddressParams

type DepositAddressParams struct {
	Currency string `url:"currency"`
}

type DepositAddressResponse

type DepositAddressResponse struct {
	Error  string          `json:"error"`
	Result *DepositAddress `json:"result"`
}

type DepositAddressService

type DepositAddressService struct {
	ApiPublicKey string
	Params       DepositAddressBodyParams
	// contains filtered or unexported fields
}

func (*DepositAddressService) GetNewAddress

func (s *DepositAddressService) GetNewAddress(depositAddressParams *DepositAddressParams) (DepositAddressResponse,
	*http.Response,
	error)

func (*DepositAddressService) GetNewCallbackAddress

func (s *DepositAddressService) GetNewCallbackAddress(callbackAddressParams *CallbackAddressParams) (DepositAddressResponse, *http.Response, error)

type RateBodyParams

type RateBodyParams struct {
	APIParams
	RateParams
}

type RateInfo

type RateInfo struct {
	IsFiat         uint8    `json:"is_fiat"`
	RateBTC        string   `json:"rate_btc"`
	LastUpdate     string   `json:"last_update"`
	TransactionFee string   `json:"tx_fee"`
	Name           string   `json:"name"`
	Confirms       string   `json:"confirms"`
	CanConvert     uint8    `json:"can_convert"`
	Status         string   `json:"status"`
	Capabilities   []string `json:"capabilities"`
}

type RateParams

type RateParams struct {
	Short    uint8 `url:"short"`
	Accepted uint8 `url:"accepted"`
}

type RateResponse

type RateResponse struct {
	Error  string              `json:"error"`
	Result map[string]RateInfo `json:"result"`
}

type RateService

type RateService struct {
	ApiPublicKey string
	Params       RateBodyParams
	// contains filtered or unexported fields
}

func (*RateService) Show

func (s *RateService) Show(params *RateParams) (RateResponse, *http.Response, error)

type Transaction

type Transaction struct {
	Amount         string `json:"amount"`
	Address        string `url:"address"`
	TXNId          string `json:"txn_id"`
	ConfirmsNeeded string `json:"confirms_needed"`
	Timeout        uint32 `json:"timeout"`
	StatusUrl      string `json:"status_url"`
	QRCodeUrl      string `json:"qrcode_url"`
}

type TransactionBodyParams

type TransactionBodyParams struct {
	APIParams
	TransactionParams
}

type TransactionParams

type TransactionParams struct {
	Amount     float64 `url:"amount"`
	Currency1  string  `url:"currency1"`
	Currency2  string  `url:"currency2"`
	Address    string  `url:"address"`
	BuyerEmail string  `url:"buyer_email"`
	BuyerName  string  `url:"buyer_name"`
	ItemName   string  `url:"item_name"`
	ItemNumber string  `url:"item_number"`
	Invoice    string  `url:"invoice"`
	Custom     string  `url:"custom"`
	IPNUrl     string  `url:"ipn_url"`
}

type TransactionResponse

type TransactionResponse struct {
	Error  string       `json:"error"`
	Result *Transaction `json:"result"`
}

type TransactionResponseError

type TransactionResponseError struct {
	Error  string         `json:"error"`
	Result []*Transaction `json:"result"`
}

type TransactionService

type TransactionService struct {
	ApiPublicKey string
	Params       TransactionBodyParams
	// contains filtered or unexported fields
}

func (*TransactionService) NewTransaction

func (s *TransactionService) NewTransaction(transactionParams *TransactionParams) (TransactionResponse, *http.Response, error)

TODO: if we generate an error in the sling POST request, we get the error: json: cannot unmarshal array into Go struct field TransactionResponse.result of type coinpayments.Transaction" if you change TransactionResponse.Result to be of type []*Transaction then you can see the error message but when we don't get an error, it is a single *Transaction and the slice will throw an error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL