Documentation ¶
Index ¶
- func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, ...) flows.AirtimeService
- type CSVDecimals
- type CSVStrings
- type Client
- func (c *Client) MSISDNInfo(destinationMSISDN string, currency string, deliveredAmountInfo string) (*MSISDNInfo, *httpx.Trace, error)
- func (c *Client) Ping() (*httpx.Trace, error)
- func (c *Client) ReserveID() (*ReserveID, *httpx.Trace, error)
- func (c *Client) Topup(reservedID int, msisdn string, destinationMSISDN string, product string, ...) (*Topup, *httpx.Trace, error)
- type MSISDNInfo
- type ReserveID
- type Response
- type Topup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, login, token, currency string) flows.AirtimeService
NewService creates a new DTOne airtime service
Types ¶
type CSVDecimals ¶
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, httpRetries *httpx.RetryConfig, 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
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
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
type Response ¶
type Response interface {
Error() error
}
Response is base interface for any DTOne API response
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