-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrans.go
50 lines (42 loc) · 910 Bytes
/
trans.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2019 vogo. All rights reserved.
package aliwepaystat
import "golang.org/x/text/encoding"
// Trans transaction
type Trans interface {
IsIncome() bool
IsInnerTransfer() bool
IsTransfer() bool
IsClosed() bool
YearMonth() string
GetID() string
GetOrderID() string
GetCreatedTime() string
GetSource() string
GetType() string
GetTarget() string
GetProduct() string
GetAmount() float64
GetFormatAmount() float64
GetFinType() string
GetStatus() string
GetRefund() float64
GetComment() string
IsShowInList() bool
}
type TransParser interface {
NewTrans() Trans
CsvHeader() string
FieldNum() int
Enc() encoding.Encoding
}
type TransGroup struct {
Total float64
TransList []Trans
}
func (g *TransGroup) add(trans Trans) {
g.Total += trans.GetAmount()
g.TransList = append(g.TransList, trans)
}
func (g *TransGroup) FormatTotal() float64 {
return RoundFloat(g.Total)
}