-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
119 lines (102 loc) · 3.53 KB
/
types.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package monobank
import "github.com/vtopc/epoch"
// ClientInfo - client/user info
// Personal API - https://api.monobank.ua/docs/#/definitions/UserInfo
// Corporate API - https://api.monobank.ua/docs/corporate.html#/definitions/UserInfo
type ClientInfo struct {
ID string `json:"clientId"`
Name string `json:"name"`
WebHookURL string `json:"webHookUrl"`
Accounts Accounts `json:"accounts"`
Jars Jars `json:"jars"`
}
type Account struct {
AccountID string `json:"id"`
SendID string `json:"sendId"`
Balance int64 `json:"balance"`
CreditLimit int64 `json:"creditLimit"`
CurrencyCode int `json:"currencyCode"`
CashbackType string `json:"cashbackType"` // enum: None, UAH, Miles
CardMasks []string `json:"maskedPan"` // card number masks
Type CardType `json:"type"`
IBAN string `json:"iban"`
}
type Jar struct {
ID string `json:"id"`
SendID string `json:"sendId"`
Title string `json:"title"`
Description string `json:"description"`
CurrencyCode int `json:"currencyCode"`
Balance int64 `json:"balance"`
Goal int64 `json:"goal"`
}
type CardType string
const (
Black CardType = "black" //
White CardType = "white" //
Platinum CardType = "platinum" //
FOP CardType = "fop" // ФОП
EAid CardType = "eAid" // єПідтримка
)
type Accounts []Account
type Jars []Jar
// Transaction - bank account statement
type Transaction struct {
ID string `json:"id"`
Time epoch.Seconds `json:"time"`
Description string `json:"description"`
MCC int32 `json:"mcc"`
OriginalMCC int32 `json:"originalMcc"`
Hold bool `json:"hold"`
// Amount in the account currency
Amount int64 `json:"amount"`
// OperationAmount in the transaction currency or amount after double conversion
OperationAmount int64 `json:"operationAmount"`
// ISO 4217 numeric code
CurrencyCode int `json:"currencyCode"`
CommissionRate int64 `json:"commissionRate"`
CashbackAmount int64 `json:"cashbackAmount"`
Balance int64 `json:"balance"`
Comment string `json:"comment"`
// For withdrawal only.
ReceiptID string `json:"receiptId"`
// For fop(ФОП) accounts only.
InvoiceID string `json:"invoiceId"`
// For fop(ФОП) accounts only.
EDRPOU string `json:"counterEdrpou"`
// For fop(ФОП) accounts only.
IBAN string `json:"counterIban"`
}
// Transactions - transactions
type Transactions []Transaction
type Currency struct {
CurrencyCodeA int `json:"currencyCodeA"`
CurrencyCodeB int `json:"currencyCodeB"`
Date epoch.Seconds `json:"date"`
RateSell float64 `json:"rateSell"`
RateBuy float64 `json:"rateBuy"`
RateCross float64 `json:"rateCross"`
}
type Currencies []Currency
type WebHookRequest struct {
WebHookURL string `json:"webHookUrl"`
}
type WebHookResponse struct {
Type string `json:"type"` // "StatementItem"
Data WebHookData `json:"data"`
}
type WebHookData struct {
AccountID string `json:"account"`
Transaction Transaction `json:"statementItem"`
}
type TokenRequest struct {
RequestID string `json:"tokenRequestId"` // Unique token request ID.
AcceptURL string `json:"acceptUrl"` // URL to redirect client or build QR on top of it.
}
type CorpSettings struct {
Pubkey string `json:"pubkey"`
Name string `json:"name"`
Permission string `json:"permission"`
Logo string `json:"logo"`
Webhook *string `json:"webhook"`
}