Documentation
¶
Index ¶
- func GetSuggestedAmount(operator *Operator, amount float64, tolerance float64) (float64, error)
- func GimmeString(i interface{}) (interface{}, error)
- func TestServer(handler func(http.ResponseWriter, *http.Request)) (*httptest.Server, *sling.Sling)
- func TestServerMux() (*httptest.Server, *http.ServeMux)
- type APIError
- type Card
- type Country
- type Discount
- type DiscountsPage
- type Fees
- type Fx
- type GeographicalRechargePlan
- type GiftCardOrder
- type GiftCardsService
- func (s *GiftCardsService) DiscountByProduct(productId int64) (Discount, error)
- func (s *GiftCardsService) Discounts(page int64, size int64) (DiscountsPage, error)
- func (s *GiftCardsService) GetRedeemCode(transactionId int64) ([]Card, error)
- func (s *GiftCardsService) Order(order GiftCardOrder) (Transaction, error)
- func (s *GiftCardsService) Product(productId int64) (Product, error)
- func (s *GiftCardsService) Products(page int64, size int64) (ProductsPage, error)
- func (s *GiftCardsService) ProductsByCountry(country string) ([]Product, error)
- func (s *GiftCardsService) RedeemInstructions() ([]RedeemInstructions, error)
- func (s *GiftCardsService) RedeemInstructionsByBrand(brandId int64) (RedeemInstructions, error)
- func (s *GiftCardsService) Transaction(transactionId int64) (Transaction, error)
- func (s *GiftCardsService) Transactions(page int64, size int64) (TransactionsPage, error)
- type JSTimestamp
- type OAuthRequest
- type Operator
- func (o *Operator) GetDefaultGeographicalPlan() *GeographicalRechargePlan
- func (o *Operator) GetFixedAmounts() []float64
- func (o *Operator) GetFixedAmountsDescriptions() map[string]string
- func (o *Operator) GetGeographicalPlanByLocationCode(locationCode string) *GeographicalRechargePlan
- func (o *Operator) GetGeographicalPlanByLocationName(locationName string) *GeographicalRechargePlan
- func (o *Operator) GetLocalFixedAmounts() []float64
- func (o *Operator) GetLocalFixedAmountsDescriptions() map[string]string
- type OperatorsParams
- type Product
- type ProductsPage
- type RecipientPhone
- type RedeemInstructions
- type ReloadlyError
- type SenderPhone
- type Service
- func (s *Service) Auth(clientId, clientSecret string) error
- func (s *Service) GetOAuthToken(clientId, clientSecret string) (*Token, error)
- func (s *Service) GiftCards() *GiftCardsService
- func (s *Service) ReAuth() error
- func (s *Service) Request(method, path string, params interface{}, resp interface{}) (*http.Response, error)
- func (s *Service) Sandbox()
- func (s *Service) Topups() *TopupsService
- type SuggestedAmount
- type SuggestedAmountsMap
- type TestTransport
- type Timestamp
- type Token
- type TopupJob
- type TopupRequest
- type TopupResponse
- type TopupWorker
- type TopupWorkerResponse
- type TopupsService
- func (s *TopupsService) AutoDetect(country string) *TopupsService
- func (s *TopupsService) AutoFallback() *TopupsService
- func (s *TopupsService) CustomIdentifier(identifier string) *TopupsService
- func (s *TopupsService) FindOperator(country, name string) *TopupsService
- func (s *TopupsService) GetOperatorByID(operatorID int64) (*Operator, error)
- func (s *TopupsService) GetSetOperator() *Operator
- func (s *TopupsService) New() *TopupsService
- func (s *TopupsService) Operator(operator *Operator) *TopupsService
- func (s *TopupsService) OperatorsAutoDetect(mobile, country string) (*Operator, error)
- func (s *TopupsService) OperatorsByCountry(country string) ([]Operator, error)
- func (s *TopupsService) SearchOperator(country, name string) (*Operator, error)
- func (s *TopupsService) SuggestedAmount(tolerance float64) *TopupsService
- func (s *TopupsService) Topup(mobile string, requestedAmount float64) (*TopupResponse, error)
- type Transaction
- type TransactionCreatedTime
- type TransactionDate
- type TransactionsPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSuggestedAmount ¶
func GimmeString ¶
func GimmeString(i interface{}) (interface{}, error)
func TestServer ¶
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"` }
type DiscountsPage ¶ added in v0.0.14
type GeographicalRechargePlan ¶ added in v0.0.22
type GeographicalRechargePlan struct { LocationCode string `json:"locationCode,omitempty"` LocationName string `json:"locationName,omitempty"` FixedAmounts []float64 `json:"fixedAmounts,omitempty"` LocalAmounts []float64 `json:"localAmounts,omitempty"` FixedAmountsPlanNames map[string]string `json:"fixedAmountsPlanNames,omitempty"` FixedAmountsDescriptions map[string]string `json:"fixedAmountsDescriptions,omitempty"` LocalFixedAmountsPlanNames map[string]string `json:"localFixedAmountsPlanNames,omitempty"` LocalFixedAmountsDescriptions map[string]string `json:"localFixedAmountsDescriptions,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 ¶
func (*JSTimestamp) UnmarshalJSON ¶
func (t *JSTimestamp) UnmarshalJSON(b []byte) error
type OAuthRequest ¶
type Operator ¶
type Operator struct { ID int64 `json:"id,omitempty"` 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"` ComboProduct bool `json:"comboProduct,omitempty"` SupportsLocalAmounts bool `json:"supportsLocalAmounts,omitempty"` SupportsGeographicalRechargePlans bool `json:"supportsGeographicalRechargePlans,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 map[string]string `json:"fixedAmountsDescriptions,omitempty"` LocalFixedAmounts []float64 `json:"localFixedAmounts,omitempty"` LocalFixedAmountsDescriptions map[string]string `json:"localFixedAmountsDescriptions,omitempty"` SuggestedAmounts []float64 `json:"suggestedAmounts,omitempty"` SuggestedAmountsMap SuggestedAmountsMap `json:"suggestedAmountsMap,omitempty"` Fees Fees `json:"fees,omitempty"` GeographicalRechargePlans []GeographicalRechargePlan `json:"geographicalRechargePlans,omitempty"` }
func (*Operator) GetDefaultGeographicalPlan ¶ added in v0.0.22
func (o *Operator) GetDefaultGeographicalPlan() *GeographicalRechargePlan
GetDefaultGeographicalPlan returns the first available geographical plan Returns nil if geographical plans are not supported or empty
func (*Operator) GetFixedAmounts ¶ added in v0.0.22
GetFixedAmounts returns the appropriate fixed amounts based on whether geographical recharge plans are supported If geographical plans are supported, it returns amounts from the first available plan Otherwise, it returns the legacy fixed amounts
func (*Operator) GetFixedAmountsDescriptions ¶ added in v0.0.22
GetFixedAmountsDescriptions returns the appropriate fixed amounts descriptions If geographical plans are supported, it returns descriptions from the first available plan Otherwise, it returns the legacy descriptions
func (*Operator) GetGeographicalPlanByLocationCode ¶ added in v0.0.22
func (o *Operator) GetGeographicalPlanByLocationCode(locationCode string) *GeographicalRechargePlan
GetGeographicalPlanByLocationCode returns a specific geographical plan by location code Returns nil if not found or if geographical plans are not supported
func (*Operator) GetGeographicalPlanByLocationName ¶ added in v0.0.22
func (o *Operator) GetGeographicalPlanByLocationName(locationName string) *GeographicalRechargePlan
GetGeographicalPlanByLocationName returns a specific geographical plan by location name Returns nil if not found or if geographical plans are not supported
func (*Operator) GetLocalFixedAmounts ¶ added in v0.0.22
GetLocalFixedAmounts returns the appropriate local fixed amounts based on whether geographical recharge plans are supported If geographical plans are supported, it returns local amounts from the first available plan Otherwise, it returns the legacy local fixed amounts
func (*Operator) GetLocalFixedAmountsDescriptions ¶ added in v0.0.22
GetLocalFixedAmountsDescriptions returns the appropriate local fixed amounts descriptions If geographical plans are supported, it returns descriptions from the first available plan Otherwise, it returns the legacy descriptions
type OperatorsParams ¶
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 RecipientPhone ¶
type RedeemInstructions ¶ added in v0.0.14
type ReloadlyError ¶
func (ReloadlyError) Error ¶
func (e ReloadlyError) Error() string
type SenderPhone ¶
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 (*Service) GetOAuthToken ¶
func (*Service) GiftCards ¶ added in v0.0.14
func (s *Service) GiftCards() *GiftCardsService
func (*Service) Topups ¶
func (s *Service) Topups() *TopupsService
type SuggestedAmount ¶
type SuggestedAmountsMap ¶
type SuggestedAmountsMap []SuggestedAmount
func (*SuggestedAmountsMap) UnmarshalJSON ¶
func (s *SuggestedAmountsMap) UnmarshalJSON(b []byte) error
type TestTransport ¶
type Timestamp ¶
func (*Timestamp) UnmarshalJSON ¶
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"` CustomIdentifier string `csv:"custom_identifier,omitempty" json:"custom_identifier,omitempty"` }
func (*TopupJob) UnmarshalJSON ¶
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:"recipientEmairrrrrrrrrl,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 (t *TopupWorker) Do(d *TopupJob) *TopupWorkerResponse
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) CustomIdentifier ¶ added in v0.0.21
func (s *TopupsService) CustomIdentifier(identifier string) *TopupsService
func (*TopupsService) FindOperator ¶
func (s *TopupsService) FindOperator(country, name string) *TopupsService
func (*TopupsService) GetOperatorByID ¶ added in v0.0.22
func (s *TopupsService) GetOperatorByID(operatorID int64) (*Operator, error)
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
func (*TransactionCreatedTime) UnmarshalJSON ¶ added in v0.0.16
func (t *TransactionCreatedTime) UnmarshalJSON(b []byte) error
type TransactionDate ¶
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"` }