alipay

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alipay

type Alipay struct {
	Statistics Statistics `json:"statistics,omitempty"`
	LineNum    int        `json:"line_num,omitempty"`
	Orders     []Order    `json:"orders,omitempty"`

	// TitleParsed is a workaround to ignore the title row.
	TitleParsed bool `json:"title_parsed,omitempty"`
}

Alipay is the provider for alipay.

func New

func New() *Alipay

New creates a new Alipay provider.

func (*Alipay) Translate

func (a *Alipay) Translate(filename string) (*ir.IR, error)

Translate translates the alipay bill records to IR.

type Config

type Config struct {
	Rules []Rule `mapstructure:"rules,omitempty"`
}

Config is the configuration for Alipay.

type Order

type Order struct {
	TxType         TxTypeType `json:"txType,omitempty"` // 收/支
	TxTypeOriginal string     `json:"txTypeOriginal,omitempty"`
	Peer           string     `json:"peer,omitempty"`        // 交易对方
	PeerAccount    string     `json:"peerAccount,omitempty"` // 对方账号
	ItemName       string     `json:"itemName,omitempty"`    // 商品说明
	Method         string     `json:"method,omitempty"`      // 收/付款方式
	Money          float64    `json:"money,omitempty"`       // 金额
	Status         string     `json:"status,omitempty"`      // 交易状态
	Category       string     `json:"category,omitempty"`    // 交易分类
	DealNo         string     `json:"dealNo,omitempty"`      // 交易订单号
	MerchantId     string     `json:"merchantId,omitempty"`  // 商家订单号
	PayTime        time.Time  `json:"payTime,omitempty"`     // 交易时间

	// below is filled at runtime
	TargetAccount string `json:"targetAccount,omitempty"`
	MethodAccount string `json:"methodAccount,omitempty"`
}

Order is the single order.

type Rule

type Rule struct {
	Peer          *string `mapstructure:"peer,omitempty"`
	Item          *string `mapstructure:"item,omitempty"`
	Category      *string `mapstructure:"category,omitempty"`
	Type          *string `mapstructure:"type,omitempty"`
	Method        *string `mapstructure:"method,omitempty"`
	Separator     *string `mapstructure:"sep,omitempty"` // default: ,
	Time          *string `mapstructure:"time,omitempty"`
	MethodAccount *string `mapstructure:"methodAccount,omitempty"`
	TargetAccount *string `mapstructure:"targetAccount,omitempty"`
	PnlAccount    *string `mapstructure:"pnlAccount,omitempty"`
}

Rule is the type for match rules.

type Statistics

type Statistics struct {
	UserID          string    `json:"user_id,omitempty"`
	Username        string    `json:"username,omitempty"`
	ParsedItems     int       `json:"parsed_items,omitempty"`
	Start           time.Time `json:"start,omitempty"`
	End             time.Time `json:"end,omitempty"`
	TotalInRecords  int       `json:"total_in_records,omitempty"`
	TotalInMoney    float64   `json:"total_in_money,omitempty"`
	TotalOutRecords int       `json:"total_out_records,omitempty"`
	TotalOutMoney   float64   `json:"total_out_money,omitempty"`
}

Statistics is the Statistics of the bill file.

type TxTypeType

type TxTypeType string

TxTypeType is transanction type defined by alipay.

const (
	TxTypeSend   TxTypeType = "支出"
	TxTypeRecv   TxTypeType = "收入"
	TxTypeOthers TxTypeType = "其他"
	TxTypeEmpty  TxTypeType = ""
	TxTypeNil    TxTypeType = "未知"
)

Jump to

Keyboard shortcuts

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