-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.go
38 lines (33 loc) · 925 Bytes
/
common.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
package common
import (
"time"
)
type Account interface {
Login(id, password string, options map[string]interface{}) error // Internal use only. see: bankpkg.Login(...)
Logout() error
AccountInfo() *BankAccount
TotalBalance() (int64, error)
LastLogin() (time.Time, error)
Recent() ([]*Transaction, error)
History(from, to time.Time) ([]*Transaction, error)
NewTransferToRegisteredAccount(targetName string, amount int64) (TransferState, error)
CommitTransfer(tr TransferState, passwd string) (string, error)
}
type BankAccount struct {
BankName string
BankCode string
BranchName string
BranchCode string
AccountNum string
OwnerName string
}
type Transaction struct {
Date time.Time `json:"date"`
Amount int64 `json:"amount"`
Balance int64 `json:"balance"`
Description string `json:"description"`
}
type TransferState interface {
Amount() int64
FeeMessage() string
}