Documentation ¶
Index ¶
- Variables
- func BasicCredentials(username, password string) func() (Credentials, error)
- func BasicCreditCard(number, month, year string) func() (CreditCard, error)
- type Auth
- type AuthInterface
- type Card
- type CardAction
- type CardEstimate
- type CardFactor
- type CardHistoryItem
- type CardInterface
- type CardStatus
- type CardType
- type Client
- type Config
- type Credentials
- type CreditCard
- type LoadResult
- type LoadStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRedirectIsNotAllowed = errors.New("request redirect is not allowed") ErrNotAuthenticated = errors.New("not authenticated to HEVER website") ErrAuthenticatedFailed = errors.New("failed to authenticate to HEVER website") ErrUnableToParseCardConfig = errors.New("failed to parse the card config") ErrNotEnoughToLoad = errors.New("the amount to load should be above 5") ErrLoadAboveOnCardLimit = errors.New("charging above the max on card limit") ErrLoadAboveMonthlyLimit = errors.New("charging above the max monthly limit") ErrLoadInvalidValue = errors.New("invalid value was passed to load") )
Errors
Functions ¶
func BasicCredentials ¶
func BasicCredentials(username, password string) func() (Credentials, error)
func BasicCreditCard ¶
func BasicCreditCard(number, month, year string) func() (CreditCard, error)
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) Authenticate ¶
func (*Auth) Deauthenticate ¶
type AuthInterface ¶
type Card ¶
type Card struct {
// contains filtered or unexported fields
}
func (*Card) GetHistory ¶
func (card *Card) GetHistory() (*[]CardHistoryItem, error)
func (*Card) GetStatus ¶
func (card *Card) GetStatus() (*CardStatus, error)
func (*Card) Load ¶
func (card *Card) Load(status CardStatus, amount int32) (*LoadResult, error)
type CardAction ¶
type CardAction int
Card history actions
const ( ActionLoad CardAction = iota ActionPurchase )
type CardEstimate ¶
type CardEstimate struct { // The final estimation Total float64 TotalFactored float64 // The amount needed to load in order to reach the desired estimation Required float64 RequiredFactored float64 // Amount taken from leftovers, does not include the factors Leftovers float64 // Amount taken from factors. The "Amount" property means the amount taken from the factor // in order to reach the total. Factors []CardFactor }
The result of a load estimation
type CardFactor ¶
Represents a factor in the card, for example 30% for 1000ILS
type CardHistoryItem ¶
type CardHistoryItem struct { Id string Date string ActionType CardAction BusinessName string Amount float64 }
type CardInterface ¶
type CardInterface interface { Type() CardType GetStatus() (*CardStatus, error) GetHistory() (*[]CardHistoryItem, error) Load(status CardStatus, amount int32) (*LoadResult, error) }
type CardStatus ¶
type CardStatus struct { // The factors "steps" in the card, ordered accordingly. The "Amount" property means the maximum // amount the factor can take. Factors []CardFactor // The maximum amount we can load the card monthly MaxMonthlyAmount int // The maximum amount that the card can hold at a given time MaxOnCardAmount int // The current load on the card CurrentBalance float64 // The remaining load until the end of the month RemainingMonthlyAmount float64 // The remaning load until the card will be full RemainingOnCardAmount float64 // The total monthly usage MonthlyUsage float64 // The balance left from previous month and does not count against the current mothly quota Leftovers float64 // Serial number (internal, used for charging the card) SerialNumber string }
The status of a card at a given time
func (*CardStatus) Estimate ¶
func (status *CardStatus) Estimate(amount float64) (*CardEstimate, error)
type Client ¶
type Client struct { Auth AuthInterface Cards struct { Keva CardInterface Teamim CardInterface } // contains filtered or unexported fields }
type Config ¶
type Config struct { InitResty func(r *resty.Client) Credentials func() (Credentials, error) CreditCard func() (CreditCard, error) }
type Credentials ¶
type CreditCard ¶
type LoadResult ¶
type LoadResult struct { Status LoadStatus LoadNumber string RawMessage string }
type LoadStatus ¶
type LoadStatus int
The status of a card load
const ( StatusNone LoadStatus = iota StatusError StatusSuccess )
Click to show internal directories.
Click to hide internal directories.