wechat

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is the configuration for Alipay.

type Order

type Order struct {
	OrderID        string    // 交易号
	MechantOrderID string    // 商家订单号
	PayTime        time.Time // 付款时间
	Type           OrderType // 收/支
	TypeOriginal   string
	Peer           string  // 交易对方
	Item           string  // 商品名称
	Money          float64 // 金额
	TxType         TxType  // 交易类型
	TxTypeOriginal string
	Status         string  // 交易状态
	Method         string  // 支付方式
	Commission     float64 // 服务费
}

Order is the single order.

type OrderType

type OrderType string

OrderType is the type of the order.

const (
	OrderTypeSend    OrderType = "支出"
	OrderTypeRecv    OrderType = "收入"
	OrderTypeNil     OrderType = "/"
	OrderTypeUnknown OrderType = "Unknown"
)

type Rule

type Rule struct {
	Peer              *string `mapstructure:"peer,omitempty"`
	Item              *string `mapstructure:"item,omitempty"`
	Type              *string `mapstructure:"type,omitempty"`
	TxType            *string `mapstructure:"txType,omitempty"`
	Separator         *string `mapstructure:"sep,omitempty"` // default: ,
	Method            *string `mapstructure:"method,omitempty"`
	Time              *string `mapstructure:"time,omitempty"`
	TimestampRange    *string `mapstructure:"timestamp_range,omitempty"`
	MethodAccount     *string `mapstructure:"methodAccount,omitempty"`
	TargetAccount     *string `mapstructure:"targetAccount,omitempty"`
	CommissionAccount *string `mapstructure:"commissionAccount,omitempty"`
	FullMatch         bool    `mapstructure:"fullMatch,omitempty"`
	Tag               *string `mapstructure:"tag,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 TxType

type TxType string
const (
	TxTypeConsume              TxType = "商户消费"
	TxTypeLucky                TxType = "微信红包"
	TxTypeTransfer             TxType = "转账"
	TxTypeQRIncome             TxType = "二维码收款"
	TxTypeQRSend               TxType = "扫二维码付款"
	TxTypeGroup                TxType = "群收款"
	TxTypeRefund               TxType = "退款"
	TxTypeCash2Cash            TxType = "转入零钱通-来自零钱"
	TxTypeIntoCash             TxType = "转入零钱通"
	TxTypeCashIn               TxType = "零钱充值"
	TxTypeCashWithdraw         TxType = "零钱提现"
	TxTypeCreditCardRefund     TxType = "信用卡还款"
	TxTypeBuyLiCaiTong         TxType = "购买理财通"
	TxTypeCash2CashLooseChange TxType = "零钱通转出-到零钱"
	TxTypeCash2Others          TxType = "零钱通转出"
	TxTypeFamilyCard           TxType = "亲属卡交易"
	TxTypeSponsorCode          TxType = "赞赏码"
	TxTypeUnknown              TxType = "Unknown"
)

type Wechat

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

Wechat is the provider for Wechat.

func New

func New() *Wechat

New creates a new wechat provider.

func (*Wechat) Translate

func (w *Wechat) Translate(filename string) (*ir.IR, error)

Translate translates the alipay bill records to IR.

Jump to

Keyboard shortcuts

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