viseca

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card added in v0.2.0

type Card struct {
	ID                          string           `json:"cardId"`
	CardSwitch                  CardSwitch       `json:"switch"`
	MaskedCardNumber            string           `json:"maskedCardNumber"`
	CardAccountNr               string           `json:"cardAccountNr"`
	CardHolder                  CardHolder       `json:"cardHolder"`
	CardStatus                  CardStatus       `json:"cardStatus"`
	CardName                    string           `json:"cardName"`
	CardDescription             string           `json:"cardDescription"`
	ExpirationDate              string           `json:"expirationDate"`
	ProductType                 string           `json:"productType"`
	ProductLine                 string           `json:"productLine"`
	CreditIndicator             string           `json:"creditIndicator"`
	AvailableReplacementReasons []string         `json:"availableReplacementReasons"`
	BonusProgram                []string         `json:"bonusProgram"`
	MainBonusProgram            string           `json:"mainBonusProgram"`
	Currency                    string           `json:"currency"`
	CardLimit                   float32          `json:"cardLimit"`
	ActiveCurrency              string           `json:"activeCurrency"`
	ActiveLimit                 float32          `json:"activeLimit"`
	IsSelfIssued                bool             `json:"isSelfIssued"`
	CardScheme                  string           `json:"cardScheme"`
	EmbossingLine               string           `json:"embossingLine"`
	CardType                    CardType         `json:"cardType"`
	CallCenter                  string           `json:"callCenter"`
	CardImageDetails            CardImageDetails `json:"cardImageDetails"`
	CardLinks                   CardLinks        `json:"links"`
	CardGrants                  CardGrants       `json:"grants"`
}

type CardGrants added in v0.2.0

type CardGrants struct {
	CanSurprizeRead                  bool `json:"canSurprizeRead"`
	CanAccountDetailsRead            bool `json:"canAccountDetailsRead"`
	CanStatementSettingsRead         bool `json:"canStatementSettingsRead"`
	CanStatementSettingsUpdate       bool `json:"canStatementSettingsUpdate"`
	CanStatementDetailRead           bool `json:"canStatementDetailRead"`
	CanTransactionNotificationRead   bool `json:"canTransactionNotificationRead"`
	CanTransactionNotificationUpdate bool `json:"canTransactionNotificationUpdate"`
	CanMasterpassRead                bool `json:"canMasterpassRead"`
	CanMasterpassUpdate              bool `json:"canMasterpassUpdate"`
	CanCardFreeze                    bool `json:"canCardFreeze"`
	CanCardPINRequest                bool `json:"canCardPINRequest"`
	CanSmsSettingsRead               bool `json:"canSmsSettingsRead"`
	CanSmsSettingsUpdate             bool `json:"canSmsSettingsUpdate"`
	CanReplaceCard                   bool `json:"canReplaceCard"`
	CanCardControlsRead              bool `json:"canCardControlsRead"`
	CanCardControlsUpdate            bool `json:"canCardControlsUpdate"`
	CanCouponsRead                   bool `json:"canCouponsRead"`
	CanPanCvvPinRead                 bool `json:"canPanCvvPinRead"`
}

type CardHolder added in v0.2.0

type CardHolder struct {
	Firstname     string `json:"firstname"`
	Lastname      string `json:"lastname"`
	BirthDate     string `json:"birthDate"`
	Nationality   string `json:"nationality"`
	IsCurrentUser bool   `json:"isCurrentUser"`
}

type CardImageDetails added in v0.2.0

type CardImageDetails struct {
	URL                     string `json:"url"`
	TemplateName            string `json:"templateName"`
	Category                string `json:"category"`
	Status                  string `json:"status"`
	DenialReason            string `json:"denialReason"`
	ReplacementAvailability string `json:"replacementAvailability"`
	UploadContext           string `json:"uploadContext"`
	LastStatusUpdate        string `json:"lastStatusUpdate"`
}
type CardLinks struct {
	CardDetails           string `json:"carddetails"`
	CardImage             string `json:"cardimage"`
	CardSwitcherLogoImage string `json:"cardswitcherlogoimage"`
	CockpitLogoImage      string `json:"cockpitlogoimage"`
}

type CardListOptions added in v0.2.0

type CardListOptions struct {
	CreditIndicators []string
}

CardListOptions known CreditIndicators are "credit" and "debit".

func NewDefaultCardListOptions added in v0.2.0

func NewDefaultCardListOptions() CardListOptions

NewDefaultCardListOptions creates new default CardListOptions.

type CardStatus added in v0.2.0

type CardStatus struct {
	Value       string `json:"value"`
	AdvValue    string `json:"advValue"`
	Description string `json:"description"`
	ChangeDate  string `json:"changeDate"`
}

type CardSwitch added in v0.2.0

type CardSwitch struct {
	Reason string `json:"reason"`
}

type CardType added in v0.2.0

type CardType struct {
	Value       string `json:"value"`
	Description string `json:"description"`
}

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    *url.URL
}

Client represents an API client.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Viseca API client.

func (*Client) Do

func (client *Client) Do(ctx context.Context, request *http.Request, responseBody interface{}) (*http.Response, error)

Do returns the HTTP response and decodes the JSON response body into responseBody.

func (*Client) GetUser added in v0.2.0

func (client *Client) GetUser(ctx context.Context) (*User, error)

GetUser returns the user information.

func (*Client) ListAllTransactions

func (client *Client) ListAllTransactions(ctx context.Context, card string) ([]Transaction, error)

ListAllTransactions lists all transactions for the given card.

func (*Client) ListAllTransactionsOpts

func (client *Client) ListAllTransactionsOpts(ctx context.Context, card string, listOptions ListOptions) ([]Transaction, error)

ListAllTransactions lists all transactions for the given card and options.

func (*Client) ListCards added in v0.2.0

func (client *Client) ListCards(ctx context.Context, cardListOptions CardListOptions) (*[]Card, error)

ListCards returns all cards for the given CardListOptions.

func (*Client) ListTransactions

func (client *Client) ListTransactions(ctx context.Context, card string, listOptions ListOptions) (*Transactions, error)

ListTransactions returns the transactions for the given card and listOptions.

func (*Client) NewRequest

func (client *Client) NewRequest(path string, method string, requestBody interface{}) (*http.Request, error)

NewRequest returns a new request with the given path (adds the base URL) and method. It further encodes the requestBody as JSON.

type ListOptions

type ListOptions struct {
	Offset    int
	PageSize  int
	StateType string
	DateTo    time.Time
	DateFrom  time.Time
}

ListOptions holds the options for list actions.

func NewDefaultListOptions

func NewDefaultListOptions() ListOptions

NewDefaultListOptions creates new default ListOptions.

type MockedVisecaAPI

type MockedVisecaAPI struct {
	mock.Mock
}

func (*MockedVisecaAPI) ListAllTransactions

func (m *MockedVisecaAPI) ListAllTransactions(ctx context.Context, card string, listOptions ListOptions) (*Transactions, error)

type PFMCategory

type PFMCategory struct {
	ID                  string `json:"id"`
	Name                string `json:"name"`
	LightColor          string `json:"lightColor"`
	MediumColor         string `json:"mediumColor"`
	Color               string `json:"color"`
	ImageURL            string `json:"imageUrl"`
	TransparentImageURL string `json:"transparentImageUrl"`
}

type Transaction

type Transaction struct {
	TransactionID    string           `json:"transactionId"`
	CardID           string           `json:"cardId"`
	MaskedCardNumber string           `json:"maskedCardNumber"`
	CardName         string           `json:"cardName"`
	Date             string           `json:"date"`
	ShowTimestamp    bool             `json:"showTimestamp"`
	Amount           float64          `json:"amount"`
	Currency         string           `json:"currency"`
	OriginalAmount   float64          `json:"originalAmount"`
	OriginalCurrency string           `json:"originalCurrency"`
	MerchantName     string           `json:"merchantName"`
	PrettyName       string           `json:"prettyName"`
	MerchantPlace    string           `json:"merchantPlace"`
	IsOnline         bool             `json:"isOnline"`
	PFMCategory      PFMCategory      `json:"pfmCategory"`
	StateType        string           `json:"stateType"`
	Details          string           `json:"details"`
	Type             string           `json:"type"`
	IsBilled         bool             `json:"isBilled"`
	Links            TransactionLinks `json:"links"`
}
type TransactionLinks struct {
	Transactiondetails string `json:"transactiondetails"`
}

type Transactions

type Transactions struct {
	TotalCount   int           `json:"totalCount"`
	Transactions []Transaction `json:"list"`
}

type User added in v0.2.0

type User struct {
	VisecaOneID         string `json:"visecaOneId"`
	Email               string `json:"email"`
	EmailStatus         string `json:"emailStatus"`
	Language            string `json:"language"`
	FirstName           string `json:"firstName"`
	LastName            string `json:"lastName"`
	Gender              string `json:"gender"`
	MaskedPhoneNumber   string `json:"maskedPhoneNumber"`
	LastLoginDate       string `json:"lastLoginDate"`
	LastLogoutType      string `json:"lastLogoutType"`
	DefaultChannelType  string `json:"defaultChannelType"`
	AppDescription      string `json:"appDescription"`
	AppRegistrationDate string `json:"appRegistrationDate"`
}

type VisecaAPI

type VisecaAPI interface {
	// ListTransactions returns the transactions for the given card.
	ListTransactions(ctx context.Context, card string, listOptions ListOptions) (*Transactions, error)
}

VisecaAPI provides an interface to a subset of the Viseca API

Jump to

Keyboard shortcuts

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