client

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVDecimals

type CSVDecimals []decimal.Decimal

CSVDecimals is a list of decimals which can be automatically unmarshalled from a CSV list

func (*CSVDecimals) UnmarshalJSON

func (l *CSVDecimals) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals this list from a CSV string

type CSVStrings

type CSVStrings []string

CSVStrings is a list of strings which can be automatically unmarshalled from a CSV list

func (*CSVStrings) UnmarshalJSON

func (l *CSVStrings) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals this list from a CSV string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a TransferTo client see https://shop.transferto.com/shop/v3/doc/TransferTo_API.pdf for API docs

func NewTransferToClient

func NewTransferToClient(login string, token string, httpClient *utils.HTTPClient) *Client

NewTransferToClient creates a new TransferTo client

func (*Client) MSISDNInfo

func (c *Client) MSISDNInfo(destinationMSISDN string, currency string, deliveredAmountInfo string) (*MSISDNInfo, error)

MSISDNInfo fetches information about the given MSISDN

func (*Client) Ping

func (c *Client) Ping() error

Ping just verifies the credentials

func (*Client) ReserveID

func (c *Client) ReserveID() (int, error)

ReserveID reserves a transaction ID for a future topup

func (*Client) SetAPIURL

func (c *Client) SetAPIURL(url string)

SetAPIURL sets the API URL used by this client

func (*Client) Topup

func (c *Client) Topup(reservedID int, msisdn string, destinationMSISDN string, product string, skuid string) (*Topup, error)

Topup makes an actual airtime transfer

type MSISDNInfo

type MSISDNInfo struct {
	Country             string      `json:"country"`
	CountryID           int         `json:"country_id,string"`
	Operator            string      `json:"operator"`
	OperatorID          int         `json:"operator_id,string"`
	ConnectionStatus    int         `json:"connection_status,string"`
	DestinationCurrency string      `json:"destination_currency"`
	ProductList         CSVStrings  `json:"product_list"`
	ServiceFeeList      CSVDecimals `json:"service_fee_list"`
	SKUIDList           CSVStrings  `json:"skuid_list"`
	LocalInfoValueList  CSVDecimals `json:"local_info_value_list"`

	// if operator supports open-range transfers...
	OpenRange                           bool            `json:"open_range"`
	SKUID                               string          `json:"skuid"`
	OpenRangeMinimumAmountLocalCurrency decimal.Decimal `json:"open_range_minimum_amount_local_currency"`
	OpenRangeMaximumAmountLocalCurrency decimal.Decimal `json:"open_range_maximum_amount_local_currency"`
	OpenRangeIncrementLocalCurrency     decimal.Decimal `json:"open_range_increment_local_currency"`
	// contains filtered or unexported fields
}

MSISDNInfo is a response to a msisdn_info request

func (*MSISDNInfo) ErrorCode

func (r *MSISDNInfo) ErrorCode() int

func (*MSISDNInfo) ErrorTxt

func (r *MSISDNInfo) ErrorTxt() string

type Response

type Response interface {
	ErrorCode() int
	ErrorTxt() string
}

Response is a base interface for all responses

type Topup

type Topup struct {
	DestinationCurrency string          `json:"destination_currency"`
	OriginatingCurrency string          `json:"originating_currency"`
	ProductRequested    decimal.Decimal `json:"product_requested"`
	ActualProductSent   decimal.Decimal `json:"actual_product_sent"`
	SMSSent             string          `json:"sms_sent"`
	SMS                 string          `json:"sms"`
	WholesalePrice      decimal.Decimal `json:"wholesale_price"`
	ServiceFee          decimal.Decimal `json:"service_fee"`
	RetailPrice         decimal.Decimal `json:"retail_price"`
	LocalInfoAmount     decimal.Decimal `json:"local_info_amount"`
	LocalInfoValue      decimal.Decimal `json:"local_info_value"`
	Balance             decimal.Decimal `json:"balance"`
	// contains filtered or unexported fields
}

Topup is a response to a topup request

func (*Topup) ErrorCode

func (r *Topup) ErrorCode() int

func (*Topup) ErrorTxt

func (r *Topup) ErrorTxt() string

Jump to

Keyboard shortcuts

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