reloadly

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSuggestedAmount

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

func GimmeString

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

func TestServer

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

func TestServerMux

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) AddStatus added in v0.0.20

func (e APIError) AddStatus(status int) APIError

func (APIError) AsError

func (e APIError) AsError() error

func (APIError) Empty

func (e APIError) Empty() bool

func (APIError) Error

func (e APIError) Error() string

type Card added in v0.0.14

type Card struct {
	CardNumber string `json:"cardNumber,omitempty"`
	PinCode    string `json:"pinCode,omitempty"`
}

type Country

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

type Discount added in v0.0.14

type Discount struct {
	*Product           `json:"product,omitempty"`
	DiscountPercentage float64 `json:"discountPercentage,omitempty"`
}

type DiscountsPage added in v0.0.14

type DiscountsPage struct {
	Content []Discount `json:"content,omitempty"`
	Page    int64      `json:"page,omitempty"`
	Size    int64      `json:"size,omitempty"`
}

type Fx

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

type GiftCardOrder added in v0.0.14

type GiftCardOrder struct {
	ProductID        int64   `json:"productId" validate:"required"`
	CountryCode      string  `json:"countryCode" validate:"required"`
	Quantity         int64   `json:"quantity" validate:"required"`
	UnitPrice        float64 `json:"unitPrice" validate:"required"`
	CustomIdentifier string  `json:"customIdentifier"`
	SenderName       string  `json:"senderName" validate:"required"`
	RecipientEmail   string  `json:"recipientEmail" validate:"required"`
	ID               string  `json:"id"`
}

type GiftCardsService added in v0.0.14

type GiftCardsService struct {
	*Service
}

func (*GiftCardsService) DiscountByProduct added in v0.0.14

func (s *GiftCardsService) DiscountByProduct(productId int64) (Discount, error)

func (*GiftCardsService) Discounts added in v0.0.14

func (s *GiftCardsService) Discounts(page int64, size int64) (DiscountsPage, error)

func (*GiftCardsService) GetRedeemCode added in v0.0.14

func (s *GiftCardsService) GetRedeemCode(transactionId int64) ([]Card, error)

func (*GiftCardsService) Order added in v0.0.14

func (s *GiftCardsService) Order(order GiftCardOrder) (Transaction, error)

func (*GiftCardsService) Product added in v0.0.14

func (s *GiftCardsService) Product(productId int64) (Product, error)

func (*GiftCardsService) Products added in v0.0.14

func (s *GiftCardsService) Products(page int64, size int64) (ProductsPage, error)

func (*GiftCardsService) ProductsByCountry added in v0.0.14

func (s *GiftCardsService) ProductsByCountry(country string) ([]Product, error)

func (*GiftCardsService) RedeemInstructions added in v0.0.14

func (s *GiftCardsService) RedeemInstructions() ([]RedeemInstructions, error)

func (*GiftCardsService) RedeemInstructionsByBrand added in v0.0.14

func (s *GiftCardsService) RedeemInstructionsByBrand(brandId int64) (RedeemInstructions, error)

func (*GiftCardsService) Transaction added in v0.0.14

func (s *GiftCardsService) Transaction(transactionId int64) (Transaction, error)

func (*GiftCardsService) Transactions added in v0.0.14

func (s *GiftCardsService) Transactions(page int64, size int64) (TransactionsPage, error)

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 Product added in v0.0.14

type Product struct {
	ProductID                   int64     `json:"productId,omitempty"`
	ProductName                 string    `json:"productName,omitempty"`
	Global                      bool      `json:"global,omitempty"`
	SenderFee                   float64   `json:"senderFee,omitempty"`
	DiscountPercentage          float64   `json:"discountPercentage,omitempty"`
	DenominationType            string    `json:"denominationType,omitempty"`
	RecipientCurrencyCode       string    `json:"recipientCurrencyCode,omitempty"`
	MinRecipientDenomination    float64   `json:"minRecipientDenomination,omitempty"`
	MaxRecipientDenomination    float64   `json:"maxRecipientDenomination,omitempty"`
	SenderCurrencyCode          string    `json:"senderCurrencyCode,omitempty"`
	MinSenderDenomination       float64   `json:"minSenderDenomination,omitempty"`
	MaxSenderDenomination       float64   `json:"maxSenderDenomination,omitempty"`
	FixedRecipientDenominations []float64 `json:"fixedRecipientDenominations,omitempty"`
	FixedSenderDenominations    []float64 `json:"fixedSenderDenominations,omitempty"`
	FixedRecipientToSender      int64     `json:"fixedRecipientToSender,omitempty"`
	LogoUrls                    []string  `json:"logoUrls,omitempty"`
	BrandID                     int64     `json:"brandId,omitempty"`
	BrandName                   string    `json:"brandName,omitempty"`
	IsoName                     string    `json:"isoName,omitempty"`
	Name                        string    `json:"name,omitempty"`
	CountryCode                 string    `json:"countryCode,omitempty"`
}

type ProductsPage added in v0.0.14

type ProductsPage struct {
	Content []Product `json:"content,omitempty"`
	Page    int64     `json:"page,omitempty"`
	Size    int64     `json:"size,omitempty"`
}

type RecipientPhone

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

type RedeemInstructions added in v0.0.14

type RedeemInstructions struct {
	BrandID   int64  `json:"brandId,omitempty"`
	BrandName string `json:"brandName,omitempty"`
	Concise   string `json:"concise,omitempty"`
	Verbose   string `json:"verbose,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 NewGiftCards added in v0.0.14

func NewGiftCards() *Service

func NewTopups added in v0.0.14

func NewTopups() *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) GiftCards added in v0.0.14

func (s *Service) GiftCards() *GiftCardsService

func (*Service) ReAuth

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

func (s *Service) Sandbox()

func (*Service) Topups

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

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

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

type TopupWorker Service

func (*TopupWorker) Do

func (*TopupWorker) DoJob

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

func (*TopupWorker) Work

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

type TopupWorkerResponse

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

func (*TopupWorkerResponse) SetError

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

type TopupsService

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

func (*TopupsService) AutoDetect

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

func (*TopupsService) AutoFallback

func (s *TopupsService) AutoFallback() *TopupsService

func (*TopupsService) FindOperator

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

func (*TopupsService) GetSetOperator

func (s *TopupsService) GetSetOperator() *Operator

func (*TopupsService) New

func (s *TopupsService) New() *TopupsService

func (*TopupsService) Operator

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

func (*TopupsService) OperatorsAutoDetect added in v0.0.14

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

func (*TopupsService) OperatorsByCountry added in v0.0.14

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

func (*TopupsService) SearchOperator added in v0.0.14

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

func (*TopupsService) SuggestedAmount

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

func (*TopupsService) Topup

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

type Transaction added in v0.0.14

type Transaction struct {
	TransactionId          int64                   `json:"transactionId,omitempty"`
	Amount                 float64                 `json:"amount,omitempty"`
	Discount               float64                 `json:"discount,omitempty"`
	CurrencyCode           string                  `json:"currencyCode,omitempty"`
	Fee                    float64                 `json:"fee,omitempty"`
	RecipientEmail         string                  `json:"recipientEmail,omitempty"`
	CustomIdentifier       string                  `json:"customIdentifier,omitempty"`
	Status                 string                  `json:"status,omitempty"`
	TransactionCreatedTime *TransactionCreatedTime `json:"transactionCreatedTime,omitempty"`
	ProductID              int64                   `json:"productId,omitempty"`
	ProductName            string                  `json:"productName,omitempty"`
	CountryCode            string                  `json:"countryCode,omitempty"`
	Quantity               int64                   `json:"quantity,omitempty"`
	UnitPrice              float64                 `json:"unitPrice,omitempty"`
	TotalPrice             float64                 `json:"totalPrice,omitempty"`
	BrandID                int64                   `json:"brandId,omitempty"`
	BrandName              string                  `json:"brandName,omitempty"`
}

type TransactionCreatedTime added in v0.0.16

type TransactionCreatedTime time.Time

func (*TransactionCreatedTime) UnmarshalJSON added in v0.0.16

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

type TransactionDate

type TransactionDate time.Time

func (*TransactionDate) MarshalCSV

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

func (*TransactionDate) MarshalJSON

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

func (*TransactionDate) UnmarshalJSON

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

type TransactionsPage added in v0.0.14

type TransactionsPage struct {
	Content []Transaction `json:"content,omitempty"`
	Page    int64         `json:"page,omitempty"`
	Size    int64         `json:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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