reloadly

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSuggestedAmount added in v0.0.11

func GetSuggestedAmount(operator *Operator, amount float64, tolerance float64) (float64, error)

func GimmeString added in v0.0.9

func GimmeString(i interface{}) (interface{}, error)

func NormalizeNumber added in v0.0.11

func NormalizeNumber(number string) (string, error)

func TestServer

func TestServer(handler func(http.ResponseWriter, *http.Request)) (*httptest.Server, *sling.Sling)

func TestServerMux added in v0.0.6

func TestServerMux() (*httptest.Server, *http.ServeMux)

Types

type APIError

type APIError struct {
	ErrorCode string `json:"errorCode,omitempty"`
	Message   string `json:"message,omitempty"`
	// TimeStamp *Timestamp `json:"timeStamp,omitempty"`
	InfoLink   string              `json:"infoLink,omitempty"`
	Path       string              `json:"path,omitempty"`
	StatusCode int                 `json:"statusCode,omitempty"`
	Details    []map[string]string `json:"details,omitempty"`
}

func (APIError) AsError

func (e APIError) AsError() error

func (APIError) Empty added in v0.0.5

func (e APIError) Empty() bool

func (APIError) Error

func (e APIError) Error() string

type Country

type Country struct {
	IsoName string `json:"isoName,omitempty"`
	Name    string `json:"name,omitempty"`
}

type Fx

type Fx struct {
	Rate         float64 `json:"rate,omitempty"`
	CurrencyCode string  `json:"currencyCode,omitempty"`
}

type JSTimestamp

type JSTimestamp time.Time

func (*JSTimestamp) UnmarshalJSON

func (t *JSTimestamp) UnmarshalJSON(b []byte) error

type OAuthRequest

type OAuthRequest struct {
	ID        string `json:"client_id,omitempty"`
	Secret    string `json:"client_secret,omitempty"`
	Audience  string `json:"audience,omitempty"`
	GrantType string `json:"grant_type,omitempty"`
}

type Operator

type Operator struct {
	OperatorID                int64     `json:"operatorId,omitempty"`
	Name                      string    `json:"name,omitempty"`
	Bundle                    bool      `json:"bundle,omitempty"`
	Data                      bool      `json:"data,omitempty"`
	Pin                       bool      `json:"pin,omitempty"`
	SupportsLocalAmounts      bool      `json:"supportsLocalAmounts,omitempty"`
	DenominationType          string    `json:"denominationType,omitempty"`
	SenderCurrencyCode        string    `json:"senderCurrencyCode,omitempty"`
	SenderCurrencySymbol      string    `json:"senderCurrencySymbol,omitempty"`
	DestinationCurrencyCode   string    `json:"destinationCurrencyCode,omitempty"`
	DestinationCurrencySymbol string    `json:"destinationCurrencySymbol,omitempty"`
	Commission                float64   `json:"commission,omitempty"`
	InternationalDiscount     float64   `json:"internationalDiscount,omitempty"`
	LocalDiscount             float64   `json:"localDiscount,omitempty"`
	MostPopularAmount         float64   `json:"mostPopularAmount,omitempty"`
	MostPopularLocalAmount    float64   `json:"mostPopularLocalAmount,omitempty"`
	MinAmount                 float64   `json:"minAmount,omitempty"`
	MaxAmount                 float64   `json:"maxAmount,omitempty"`
	LocalMinAmount            float64   `json:"localMinAmount,omitempty"`
	LocalMaxAmount            float64   `json:"localMaxAmount,omitempty"`
	Country                   Country   `json:"country,omitempty"`
	Fx                        Fx        `json:"fx,omitempty"`
	LogoUrls                  []string  `json:"logoUrls,omitempty"`
	FixedAmounts              []float64 `json:"fixedAmounts,omitempty"`
	// FixedAmountsDescriptions  {
	// } `json:"fixedAmountsDescriptions,omitempty"`
	LocalFixedAmounts []float64 `json:"localFixedAmounts,omitempty"`
	// LocalFixedAmountsDescriptions struct {
	// } `json:"localFixedAmountsDescriptions,omitempty"`
	SuggestedAmounts    []float64           `json:"suggestedAmounts,omitempty"`
	SuggestedAmountsMap SuggestedAmountsMap `json:"suggestedAmountsMap,omitempty"`
}

type OperatorsParams

type OperatorsParams struct {
	SuggestedAmounts    bool `url:"suggestedAmounts,omitempty"`
	SuggestedAmountsMap bool `url:"suggestedAmountsMap,omitempty"`
	IncludeBundles      bool `url:"includeBundles,omitempty"`
	IncludeData         bool `url:"includeData,omitempty"`
	IncludePin          bool `url:"includePin,omitempty"`
}

type RecipientPhone

type RecipientPhone struct {
	CountryCode string `json:"countryCode,omitempty"`
	Number      string `json:"number,omitempty"`
}

type ReloadlyError

type ReloadlyError struct {
	ErrorCode string
	Message   string
}

func (ReloadlyError) Error

func (e ReloadlyError) Error() string

type SenderPhone

type SenderPhone struct {
	CountryCode string `json:"countryCode,omitempty"`
	Number      string `json:"number,omitempty"`
}

type Service

type Service struct {
	Client  *http.Client
	BaseUrl string
	AuthUrl string
	Token   *Token
	// contains filtered or unexported fields
}

func New

func New() *Service

func (*Service) Auth

func (s *Service) Auth(clientId, clientSecret string) error

func (*Service) GetOAuthToken

func (s *Service) GetOAuthToken(clientId, clientSecret string) (*Token, error)

func (*Service) OperatorsAutoDetect

func (s *Service) OperatorsAutoDetect(mobile, country string) (*Operator, error)

func (*Service) OperatorsByCountry

func (s *Service) OperatorsByCountry(country string) ([]Operator, error)

func (*Service) ReAuth added in v0.0.10

func (s *Service) ReAuth() error

func (*Service) Request

func (s *Service) Request(method, path string, params interface{}, resp interface{}) (*http.Response, error)

func (*Service) Sandbox added in v0.0.5

func (s *Service) Sandbox()

func (*Service) SearchOperator

func (s *Service) SearchOperator(country, name string) (*Operator, error)

func (*Service) Topups added in v0.0.6

func (s *Service) Topups() *TopupsService

type SuggestedAmount

type SuggestedAmount struct {
	Pay  float64
	Sent float64
}

type SuggestedAmountsMap

type SuggestedAmountsMap []SuggestedAmount

func (*SuggestedAmountsMap) UnmarshalJSON

func (s *SuggestedAmountsMap) UnmarshalJSON(b []byte) error

type TestTransport

type TestTransport func(req *http.Request) (*http.Response, error)

func (TestTransport) RoundTrip

func (r TestTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Timestamp

type Timestamp time.Time

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

type Token

type Token struct {
	TokenType   string `json:"token_type,omitempty"`
	AccessToken string `json:"access_token,omitempty"`
	Scope       string `json:"scope,omitempty"`
	ExpiresIn   int64  `json:"expires_in,omitempty"`
}

type TopupJob added in v0.0.7

type TopupJob struct {
	Number    string  `csv:"number" json:"number" validate:"required"`
	Amount    float64 `csv:"amount" json:"amount" validate:"required"`
	Country   string  `csv:"country" json:"country" validate:"required"`
	Tolerance float64 `csv:"tolerance,omitempty" json:"tolerance,omitempty"`
	Operator  string  `csv:"operator,omitempty" json:"operator,omitempty"`
	ID        string  `csv:"id,omitempty" json:"id,omitempty"`
}

func (*TopupJob) UnmarshalJSON added in v0.0.9

func (j *TopupJob) UnmarshalJSON(b []byte) error

type TopupRequest

type TopupRequest struct {
	RecipientPhone   *RecipientPhone `json:"recipientPhone,omitempty"`
	SenderPhone      *SenderPhone    `json:"senderPhone,omitempty"`
	OperatorID       int64           `json:"operatorId,omitempty"`
	Amount           float64         `json:"amount,omitempty"`
	CustomIdentifier string          `json:"customIdentifier,omitempty"`
}

type TopupResponse

type TopupResponse struct {
	TransactionID               int64            `csv:"transactionId" json:"transactionId,omitempty"`
	OperatorTransactionID       string           `csv:"operatorTransactionId" json:"operatorTransactionId,omitempty"`
	CustomIdentifier            string           `csv:"customIdentifier" json:"customIdentifier,omitempty"`
	RecipientPhone              string           `csv:"recipientPhone" json:"recipientPhone,omitempty"`
	RecipientEmail              string           `csv:"recipientEmail" json:"recipientEmail,omitempty"`
	SenderPhone                 string           `csv:"senderPhone" json:"senderPhone,omitempty"`
	CountryCode                 string           `csv:"countryCode" json:"countryCode,omitempty"`
	OperatorID                  int64            `csv:"operatorId" json:"operatorId,omitempty"`
	OperatorName                string           `csv:"operatorName" json:"operatorName,omitempty"`
	Discount                    float64          `csv:"discount" json:"discount,omitempty"`
	DiscountCurrencyCode        string           `csv:"discountCurrencyCode" json:"discountCurrencyCode,omitempty"`
	RequestedAmount             float64          `csv:"requestedAmount" json:"requestedAmount,omitempty"`
	RequestedAmountCurrencyCode string           `csv:"requestedAmountCurrencyCode" json:"requestedAmountCurrencyCode,omitempty"`
	DeliveredAmount             float64          `csv:"deliveredAmount" json:"deliveredAmount,omitempty"`
	DeliveredAmountCurrencyCode string           `csv:"deliveredAmountCurrencyCode" json:"deliveredAmountCurrencyCode,omitempty"`
	TransactionDate             *TransactionDate `csv:"transactionDate" json:"transactionDate,omitempty"`
}

type TopupWorker added in v0.0.6

type TopupWorker Service

func (*TopupWorker) Do added in v0.0.7

func (*TopupWorker) DoJob added in v0.0.7

func (t *TopupWorker) DoJob(d *TopupJob) (*TopupResponse, error)

func (*TopupWorker) Work added in v0.0.6

func (t *TopupWorker) Work(i interface{}) interface{}

type TopupWorkerResponse added in v0.0.7

type TopupWorkerResponse struct {
	*TopupResponse
	ErrorMessage string `csv:"errrorMessage" json:"errorMessage,omitempty"`
	ErrorCode    string `csv:"errorCode" json:"errorCode,omitempty"`
}

func (*TopupWorkerResponse) SetError added in v0.0.7

func (r *TopupWorkerResponse) SetError(err error) *TopupWorkerResponse

type TopupsService added in v0.0.6

type TopupsService struct {
	*Service
	// contains filtered or unexported fields
}

func (*TopupsService) AutoDetect added in v0.0.6

func (s *TopupsService) AutoDetect(country string) *TopupsService

func (*TopupsService) AutoFallback added in v0.0.6

func (s *TopupsService) AutoFallback() *TopupsService

func (*TopupsService) FindOperator added in v0.0.6

func (s *TopupsService) FindOperator(country, name string) *TopupsService

func (*TopupsService) GetSetOperator added in v0.0.6

func (s *TopupsService) GetSetOperator() *Operator

func (*TopupsService) New added in v0.0.6

func (s *TopupsService) New() *TopupsService

func (*TopupsService) Operator added in v0.0.6

func (s *TopupsService) Operator(operator *Operator) *TopupsService

func (*TopupsService) SuggestedAmount added in v0.0.6

func (s *TopupsService) SuggestedAmount(tolerance float64) *TopupsService

func (*TopupsService) Topup added in v0.0.6

func (s *TopupsService) Topup(mobile string, requested_amount float64) (*TopupResponse, error)

type TransactionDate added in v0.0.7

type TransactionDate time.Time

func (*TransactionDate) MarshalCSV added in v0.0.7

func (t *TransactionDate) MarshalCSV() ([]byte, error)

func (*TransactionDate) MarshalJSON added in v0.0.7

func (t *TransactionDate) MarshalJSON() ([]byte, error)

func (*TransactionDate) UnmarshalJSON added in v0.0.7

func (t *TransactionDate) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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