alipay

package
v0.0.0-...-91487d3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 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 {
	Type         Type      `json:"type,omitempty"` // 收/支
	TypeOriginal string    `json:"typeOriginal,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"`
	TimestampRange *string `mapstructure:"timestamp_range,omitempty"`
	MethodAccount  *string `mapstructure:"methodAccount,omitempty"`
	TargetAccount  *string `mapstructure:"targetAccount,omitempty"`
	PnlAccount     *string `mapstructure:"pnlAccount,omitempty"`
	FullMatch      bool    `mapstructure:"fullMatch,omitempty"`
	Tags           *string `mapstructure:"tags,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 Type

type Type string

Type is transanction type defined by alipay.

const (
	TypeSend   Type = "支出"
	TypeRecv   Type = "收入"
	TypeOthers Type = "其他"
	TypeEmpty  Type = ""
	TypeNil    Type = "未知"
)

Jump to

Keyboard shortcuts

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