schema

package
v0.0.0-...-1c30ccf Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTime

func ParseTime(d, t string) (time.Time, error)

ParseTime parses date and time from two strings. Note: Privat24 API returns date&time in Kyiv time zone.

Types

type Currency

type Currency string
const (
	UAH Currency = "UAH"
	USD Currency = "USD"
	EUR Currency = "EUR"
)

Known currencies

func ParseAmount

func ParseAmount(s string) (float32, Currency, error)

ParseAmount parses amount and currency.

func ParseCurrency

func ParseCurrency(s string) (Currency, error)

Parse currency

type Format

type Format string
const (
	JSON Format = "JSON"
	QIF  Format = "QIF"
)

Valid formats for transaction exporting

type Transaction

type Transaction struct {
	// Transaction date and time
	Date time.Time
	// From account name
	Src string
	// From amount
	SrcVal float32
	// From currency
	SrcCur Currency
	// To account name
	Dst string
	// To amount
	DstVal float32
	// To currency
	DstCur Currency
	// Transaction note
	Note string
	// Not nil on XML parse error
	Error string `json:"Error,omitempty"`
	// XML Transaction. Set only when Error is not nil.
	Raw *XMLTransaction `json:"Raw,omitempty"`
}

func ParseTransaction

func ParseTransaction(xmlTran XMLTransaction) Transaction

Convert transaction object received from the Privat24 API to more convenient, Golang native format.

func (*Transaction) Comission

func (t *Transaction) Comission() float32

Comission returns the value of comission charged.

func (*Transaction) String

func (t *Transaction) String() string

type XMLTransaction

type XMLTransaction struct {
	Card        string `xml:"card,attr"`
	AppCode     string `xml:"appcode,attr"`
	TranDate    string `xml:"trandate,attr"`
	TranTime    string `xml:"trantime,attr"`
	Amount      string `xml:"amount,attr"`
	CardAmount  string `xml:"cardamount,attr"`
	Rest        string `xml:"rest,attr"`
	Terminal    string `xml:"terminal,attr"`
	Description string `xml:"description,attr"`
}

XMLTransaction. This is a part of Privat24 API spec.

Jump to

Keyboard shortcuts

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