Documentation ¶
Index ¶
Constants ¶
const ( stacktrace.ErrorCode(401) // ErrCodeInternalServerError represents any other error ErrCodeInternalServerError = stacktrace.ErrorCode(500) )ErrCodeUnauthorized =
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is responsible for the fetching transactions using the ov-chipkaart API
func NewAPIService ¶
func NewAPIService(config APIServiceConfig) APIClient
NewAPIService Initializes the API service.
func (APIClient) FetchTransactions ¶
func (client APIClient) FetchTransactions(options TransactionFetchOptions) (records []RawRecord, err error)
FetchTransactions returns the transaction records based on the parameter provided.
type APIServiceConfig ¶
type APIServiceConfig struct { ClientID string ClientSecret string Locale string Client HTTPClient }
APIServiceConfig is the configuration for this service
type HTTPClient ¶
HTTPClient is the class used to perform http requests
type RawRecord ¶
type RawRecord struct { CheckInInfo string `json:"checkInInfo" bson:"check_in_info"` CheckInText string `json:"checkInText" bson:"check_in_text"` Fare *float64 `json:"fare" bson:"fare"` FareCalculation string `json:"fareCalculation" bson:"fare_calculation"` FareText string `json:"fareText" bson:"fare_text"` ModalType string `json:"modalType" bson:"modal_type"` ProductInfo string `json:"productInfo" bson:"product_info"` ProductText string `json:"productText" bson:"product_text"` Pto string `json:"pto" bson:"pto"` TransactionDateTime TimeInMilliSeconds `json:"transactionDateTime" bson:"transaction_timestamp"` TransactionInfo string `json:"transactionInfo" bson:"transaction_info"` TransactionName TransactionName `json:"transactionName" bson:"transaction_name"` EPurseMut *float64 `json:"ePurseMut" bson:"e_purse_mut"` EPurseMutInfo string `json:"ePurseMutInfo" bson:"e_purse_mut_info"` TransactionExplanation string `json:"transactionExplanation" bson:"transaction_explanation"` TransactionPriority string `json:"transactionPriority" bson:"transaction_priority"` }
RawRecord represents a transaction record
type TimeInMilliSeconds ¶
type TimeInMilliSeconds int
TimeInMilliSeconds represents time in milliseconds
func (TimeInMilliSeconds) ToInt64 ¶
func (t TimeInMilliSeconds) ToInt64() int64
ToInt64 converts time in milliseconds to an int64 value
func (TimeInMilliSeconds) ToTime ¶
func (t TimeInMilliSeconds) ToTime() time.Time
ToTime converts time in milliseconds to a time object
type TransactionFetchOptions ¶
type TransactionFetchOptions struct { Username string Password string CardNumber string StartDate time.Time EndDate time.Time }
TransactionFetchOptions are the options needed when fetching a list of transactions
type TransactionName ¶
type TransactionName string
TransactionName represents the various transaction names
func (TransactionName) IsTheSameAs ¶
func (name TransactionName) IsTheSameAs(comp TransactionName) bool
IsTheSameAs is used to compare 2 transaction names
func (TransactionName) String ¶
func (name TransactionName) String() string
String returns the transaction name as a string