Documentation ¶
Index ¶
- Constants
- type API
- func (a *API) Balance() (*BalanceResponse, error)
- func (a *API) Filters(data FiltersRequestData) ([]FiltersResponse, error)
- func (a *API) OrderDetails(data OrderDetailsRequestData) (*OrderDetailsResponse, error)
- func (a *API) OrderHistory(data OrderHistoryRequestData) ([]OrderHistoryResponse, error)
- func (a *API) PlaceOrder(data PlaceOrderRequestData) (*PlaceOrderResponse, error)
- func (a *API) Run(r Request) ([]byte, error)
- func (a *API) Vouchers(data VouchersRequestData) ([]VouchersResponse, error)
- type BalanceResponse
- type Error
- type FiltersRequestData
- type FiltersResponse
- type OAuthConfig
- type OrderDetailsRequestData
- type OrderDetailsResponse
- type OrderHistoryRequestData
- type OrderHistoryResponse
- type PlaceOrderRequestData
- type PlaceOrderResponse
- type Request
- type RequestData
- type Token
- type Voucher
- type VouchersRequestData
- type VouchersRequestDataFilter
- type VouchersRequestDataSort
- type VouchersResponse
Constants ¶
View Source
const ( EnvDevelopment env = iota EnvProduction )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) Balance ¶
func (a *API) Balance() (*BalanceResponse, error)
func (*API) Filters ¶
func (a *API) Filters(data FiltersRequestData) ([]FiltersResponse, error)
func (*API) OrderDetails ¶
func (a *API) OrderDetails(data OrderDetailsRequestData) (*OrderDetailsResponse, error)
func (*API) OrderHistory ¶
func (a *API) OrderHistory(data OrderHistoryRequestData) ([]OrderHistoryResponse, error)
func (*API) PlaceOrder ¶
func (a *API) PlaceOrder(data PlaceOrderRequestData) (*PlaceOrderResponse, error)
func (*API) Vouchers ¶
func (a *API) Vouchers(data VouchersRequestData) ([]VouchersResponse, error)
type BalanceResponse ¶
type Error ¶
type FiltersRequestData ¶
type FiltersResponse ¶
type FiltersResponse struct { FilterGroupName string `json:"filterGroupName"` FilterGroupDescription string `json:"filterGroupDescription"` FilterGroupCode string `json:"filterGroupCode"` Filters []struct { FilterValue string `json:"filterValue"` ISOCode string `json:"isoCode"` FilterValueCode string `json:"filterValueCode"` } `json:"filters"` }
type OAuthConfig ¶
type OrderDetailsRequestData ¶
type OrderDetailsResponse ¶
type OrderDetailsResponse struct { OrderID int `json:"orderId"` Vouchers []Voucher `json:"vouchers"` AmountCharged float64 `json:"amountCharged"` CurrencyCode string `json:"currencyCode"` CurrencyValue float64 `json:"currencyValue"` Tag string `json:"tag"` // NOTE: API doc says that this is a float, when in fact it's a string DiscountPercent string `json:"discountPercent"` // NOTE: API doc says that this is a float, when in fact it's a string OrderDiscount string `json:"orderDiscount"` OrderTotal float64 `json:"orderTotal"` OrderStatus string `json:"orderStatus"` DeliveryStatus string `json:"deliveryStatus"` }
type OrderHistoryRequestData ¶
type OrderHistoryRequestData struct { StartDate string `json:"startDate"` EndDate string `json:"endDate"` Limit int `json:"limit"` Page int `json:"page"` }
func (*OrderHistoryRequestData) SetStartEnd ¶
func (rd *OrderHistoryRequestData) SetStartEnd(start, end time.Time) *OrderHistoryRequestData
type OrderHistoryResponse ¶
type OrderHistoryResponse struct { OrderID int `json:"orderId"` OrderDate jsonTime `json:"orderDate"` EMail string `json:"email"` DeliveryStatus string `json:"deliveryStatus"` Tag string `json:"tag"` PONumber string `json:"poNumber"` Products []struct { ProductName string `json:"productName"` ReceiverMobileNumber string `json:"receiverMobileNumber"` Price float64 `json:"price"` Quantity int `json:"quantity"` OrderProductStatus string `json:"orderProductStatus"` } `json:"products"` }
type PlaceOrderRequestData ¶
type PlaceOrderRequestData struct { ProductID int `json:"productId"` Quantity int `json:"quantity"` Denomination int `json:"denomination"` EMail string `json:"email"` Contact string `json:"contact"` Tag string `json:"tag"` PONumber string `json:"poNumber"` NotifyAdminEMail jsonBoolInt `json:"notifyAdminEmail"` NotifyReceiverEMail jsonBoolInt `json:"notifyReceiverEmail"` }
func (*PlaceOrderRequestData) SetNotifyAdminEMail ¶
func (rd *PlaceOrderRequestData) SetNotifyAdminEMail(b bool) *PlaceOrderRequestData
func (*PlaceOrderRequestData) SetNotifyReceiverEMail ¶
func (rd *PlaceOrderRequestData) SetNotifyReceiverEMail(b bool) *PlaceOrderRequestData
type PlaceOrderResponse ¶
type PlaceOrderResponse struct { OrderID int `json:"orderId"` Vouchers []Voucher `json:"vouchers"` AmountCharged float64 `json:"amountCharged"` CurrencyCode string `json:"currencyCode"` CurrencyValue float64 `json:"currencyValue"` Tag string `json:"tag"` // NOTE: API doc says that this is a float, when in fact it's a string DiscountPercent string `json:"discountPercent"` // NOTE: API doc says that this is a float, when in fact it's a string OrderDiscount string `json:"orderDiscount"` OrderTotal float64 `json:"orderTotal"` OrderStatus string `json:"orderStatus"` DeliveryStatus string `json:"deliveryStatus"` }
type Request ¶
type Request struct { Query string `json:"query"` Tag string `json:"tag"` Variables RequestData `json:"variables"` }
type RequestData ¶
type RequestData struct {
Data interface{} `json:"data"`
}
type Token ¶
type Token struct { Success jsonBoolInt `json:"success"` Status int `json:"status"` AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in,string"` RefreshToken string `json:"refresh_token"` AccessTokenExpiry jsonUnixTime `json:"access_token_expiry"` RefreshTokenExpiry jsonUnixTime `json:"refresh_token_expiry"` }
type Voucher ¶
type Voucher struct { Amount int `json:"amount"` Country string `json:"country"` Currency string `json:"currency"` OrderID int `json:"orderId"` Pin string `json:"pin"` ProductID int `json:"productId"` Tag string `json:"tag"` Type string `json:"type"` Validity string `json:"validity"` VoucherCode string `json:"voucherCode"` CurrencyValue float64 `json:"currencyValue"` }
type VouchersRequestData ¶
type VouchersRequestData struct { Limit int `json:"limit"` Page int `json:"page"` IncludeProducts string `json:"includeProducts"` ExcludeProducts string `json:"excludeProducts"` ExchangeRate float64 `json:"exchangeRate"` Sort VouchersRequestDataSort `json:"sort"` Filters []VouchersRequestDataFilter `json:"filters"` }
type VouchersRequestDataSort ¶
type VouchersResponse ¶
type VouchersResponse struct { ProductID int `json:"productId"` Name string `json:"name"` Description string `json:"description"` TermsAndConditionsInstructions string `json:"termsAndConditionsInstructions"` ExpiryAndValidity string `json:"expiryAndValidity"` RedemptionInstructions string `json:"redemptionInstructions"` Categories string `json:"categories"` LastUpdateDate jsonTime `json:"lastUpdateDate"` ImageURL string `json:"imageUrl"` CurrencyCode string `json:"currencyCode"` CurrencyName string `json:"currencyName"` CountryName string `json:"countryName"` CountryCode string `json:"countryCode"` Countries []struct { Code string `json:"code"` Name string `json:"name"` } `json:"countries"` ExchangeRateRule float64 `json:"exchangeRateRule"` ValueType string `json:"valueType"` MaxValue float64 `json:"maxValue"` MinValue float64 `json:"minValue"` ValueDenominations string `json:"valueDenominations"` TATInDays int `json:"tatInDays"` UsageType string `json:"usageType"` DeliveryType string `json:"deliveryType"` // TODO: This might need to be a boolean IsCommon string `json:"isCommon"` Fee float64 `json:"fee"` Discount float64 `json:"discount"` ExchangeRate int `json:"exchangeRate"` }
Click to show internal directories.
Click to hide internal directories.