dtone

package
v0.214.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, key, secret string) flows.AirtimeService

NewService creates a new DTOne airtime service

Types

type Client

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

Client is a DTOne client, see https://dvs-api-doc.dtone.com/ for API docs

func NewClient

func NewClient(httpClient *http.Client, httpRetries *httpx.RetryConfig, key, secret string) *Client

NewClient creates a new DT One client

func (*Client) LookupMobileNumber added in v0.114.0

func (c *Client) LookupMobileNumber(tel string) ([]*Operator, *httpx.Trace, error)

LookupMobileNumber see https://dvs-api-doc.dtone.com/#tag/Mobile-Number

func (*Client) Products added in v0.114.0

func (c *Client) Products(_type string, operatorID int) ([]*Product, *httpx.Trace, error)

Products see https://dvs-api-doc.dtone.com/#tag/Products

func (*Client) TransactionSync added in v0.114.0

func (c *Client) TransactionSync(externalID string, productID int, mobileNumber string) (*Transaction, *httpx.Trace, error)

TransactionSync see https://dvs-api-doc.dtone.com/#tag/Transactions

type Operator added in v0.114.0

type Operator struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Country struct {
		Name    string `json:"name"`
		ISOCode string `json:"iso_code"`
		Regions []struct {
			Name string `json:"name"`
			Code string `json:"code"`
		} `json:"regions"`
	} `json:"country"`
	Identified bool `json:"identified"`
}

Operator is a mobile operator

type Product added in v0.114.0

type Product struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Service     struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"service"`
	Operator struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"operator"`
	Type   string `json:"type"`
	Source struct {
		Amount   decimal.Decimal `json:"amount"`
		Unit     string          `json:"unit"`
		UnitType string          `json:"unit_type"`
	} `json:"source"`
	Destination struct {
		Amount   decimal.Decimal `json:"amount"`
		Unit     string          `json:"unit"`
		UnitType string          `json:"unit_type"`
	} `json:"destination"`
}

Product is an available digital services product

type StatusCID added in v0.115.2

type StatusCID int
const (

	// see https://dvs-api-doc.dtone.com/#section/Overview/Transactions
	StatusCIDCreated   StatusCID = 1
	StatusCIDConfirmed StatusCID = 2
	StatusCIDRejected  StatusCID = 3
	StatusCIDCancelled StatusCID = 4
	StatusCIDSubmitted StatusCID = 5
	StatusCIDCompleted StatusCID = 7
	StatusCIDReversed  StatusCID = 8
	StatusCIDDeclined  StatusCID = 9
)

type Transaction added in v0.114.0

type Transaction struct {
	ID                         int64  `json:"id"`
	ExternalID                 string `json:"external_id"`
	CreationDate               string `json:"creation_date"`
	ConfirmationExpirationDate string `json:"confirmation_expiration_date"`
	ConfirmationDate           string `json:"confirmation_date"`
	Status                     struct {
		ID      int    `json:"id"`
		Message string `json:"message"`
		Class   struct {
			ID      StatusCID `json:"id"`
			Message string    `json:"message"`
		}
	} `json:"status"`
}

Transaction is a product sent to a beneficiary

Jump to

Keyboard shortcuts

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