ccb

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 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 CCB

type CCB struct {
	Statistics Statistics `json:"statistics,omitempty"`
	LineNum    int        `json:"line_num,omitempty"`
	Orders     []Order    `json:"orders,omitempty"`
	CardName   string     `json:"card_name,omitempty"`
	AccountNum string     `json:"account_num,omitempty"`
	Currency   string     `json:"currency,omitempty"`
}

CCB is the provider for China Construction Bank.

func New

func New() *CCB

New creates a new CCB provider.

func (*CCB) SetCurrency

func (ccb *CCB) SetCurrency(currency string)

SetCurrency sets the currency for the CCB provider

func (*CCB) Translate

func (ccb *CCB) Translate(filename string) (*ir.IR, error)

Translate translates the CCB bill records to IR.

func (*CCB) TranslateFromExcelBytes added in v2.13.0

func (ccb *CCB) TranslateFromExcelBytes(fileData []byte) (*ir.IR, error)

TranslateFromExcelBytes 从字节数组解析 XLS 文件(用于 WASM)

type Config

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

Config is the configuration for CCB.

type Order

type Order struct {
	PayTime         time.Time // 交易日期
	TxTypeOriginal  string    // 摘要
	Peer            string    // 对方户名
	Item            string    // 交易详情
	Region          string    // 交易地点
	Money           float64   // 记账金额 (收入-支出)
	Type            OrderType // 收/支
	Currency        string    // 币种
	Balances        float64   // 账户余额
	PeerAccountName string    // 对方户名
	PeerAccountNum  string    // 对方账号
	Expense         float64   // 支出金额
	Income          float64   // 收入金额
	TradeTime       string    // 交易时间
	RecordDate      string    // 记账日
}

Order is the single order.

type OrderType

type OrderType string
const (
	OrderTypeSend    OrderType = "支出"
	OrderTypeRecv    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"`
	Status            *string  `mapstructure:"status,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"` // default: false
	Tag               *string  `mapstructure:"tag,omitempty"`
	Ignore            bool     `mapstructure:"ignore,omitempty"` // default: false
	MinPrice          *float64 `mapstructure:"minPrice,omitempty"`
	MaxPrice          *float64 `mapstructure:"maxPrice,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.

Jump to

Keyboard shortcuts

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