dtone

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: AGPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(httpClient *http.Client, login, apiToken, currency string) flows.AirtimeService

NewService creates a new DTOne airtime service

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 DTOne client see https://tshop-app.dtone.com/shop/v3/doc/Airtime_API.pdf for API docs

func NewClient

func NewClient(httpClient *http.Client, login string, token string) *Client

NewClient creates a new TransferTo client

func (*Client) MSISDNInfo

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

MSISDNInfo fetches information about the given MSISDN

func (*Client) Ping

func (c *Client) Ping() (*httpx.Trace, error)

Ping just verifies the credentials

func (*Client) ReserveID

func (c *Client) ReserveID() (*ReserveID, *httpx.Trace, error)

ReserveID reserves a transaction ID for a future topup

func (*Client) Topup

func (c *Client) Topup(reservedID int, msisdn string, destinationMSISDN string, product string, skuid string) (*Topup, *httpx.Trace, 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" validate:"required"`
	ProductList         CSVStrings  `json:"product_list" validate:"required"`
	ServiceFeeList      CSVDecimals `json:"service_fee_list"`
	SKUIDList           CSVStrings  `json:"skuid_list"`
	LocalInfoValueList  CSVDecimals `json:"local_info_value_list" validate:"required"`
	// contains filtered or unexported fields
}

MSISDNInfo is a response to a msisdn_info request

func (*MSISDNInfo) Error added in v0.53.0

func (r *MSISDNInfo) Error() error

type ReserveID added in v0.52.0

type ReserveID struct {
	ReservedID int `json:"reserved_id,string" validate:"required"`
	// contains filtered or unexported fields
}

ReserveID is a response to a reserve_id request

func (*ReserveID) Error added in v0.53.0

func (r *ReserveID) Error() error

type Response

type Response interface {
	Error() error
}

type Topup

type Topup struct {
	DestinationCurrency string          `json:"destination_currency" validate:"required"`
	OriginatingCurrency string          `json:"originating_currency"`
	ProductRequested    decimal.Decimal `json:"product_requested"`
	ActualProductSent   decimal.Decimal `json:"actual_product_sent" validate:"required"`
	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) Error added in v0.53.0

func (r *Topup) Error() error

Jump to

Keyboard shortcuts

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