-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
116 lines (98 loc) · 2.46 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
package main
// Key response
type Key struct {
ApplicationId string `json:"applicationId" form:"applicationId" binding:"required"`
TranDateTime string `json:"tranDateTime" form:"tranDateTime" binding:"required"`
UUID string `json:"UUID" form:"UUID" binding:"required"`
}
type CardTransfer struct {
Key
Card
ToCard string `json:"toCard"`
Amount
}
type Bills struct {
Key
Card
PayeeId string `json:"payeeId"`
PersonalInfo string `json:"paymentInfo"`
Amount
}
type Amount struct {
AmountNumber float32 `json:"tranAmount"`
TranCurrencyCode string `json:"tranCurrencyCode"`
}
type Balance struct {
Key
Card
}
type Card struct {
PAN string `json:"PAN"`
Expdate string `json:"expDate"`
IPIN string `json:"IPIN"`
}
type Noebs struct {
Response `json:"ebs_response"`
}
type Response struct {
ResponseMessage string `json:"responseMessage"`
ResponseStatus string `json:"responseStatus"`
ResponseCode int `json:"responseCode"`
// ReferenceNumber string `json:"referenceNumber"`
// ApprovalCode string `json:"approvalCode"`
Balance map[string]interface{} `json:"balance"`
PaymentInfo string `json:"paymentInfo"`
BillInfo map[string]interface{} `json:"billInfo"`
Key string `json:"pubKeyValue"`
}
type Error struct {
Code int
Status string
Details Response
Message string
}
type necBill struct {
SalesAmount float64 `json:"SalesAmount"`
FixedFee float64 `json:"FixedFee"`
Token string `json:"Token"`
MeterNumber string `json:"MeterNumber"`
CustomerName string `json:"CustomerName"`
}
type User struct {
Card Card
Username string // telegram username
Mobile string
Commons map[string]string
}
// NewUser initalizes and creates and a new user
func NewUser() User {
c := make(map[string]string)
return User{Commons: c}
}
func (u User) recordCommon(key, value string) {
// commons should be initialized
u.Commons[key] = value
}
func (u User) getUsername() string {
return u.Username
}
func (u User) getMobile() string {
return u.Mobile
}
func (u User) getCard() Card {
return u.Card
}
// PersistentData storage for saving user's data
type PersistentData []User
func (sc PersistentData) append(u User) {
sc = append(sc, u)
}
// get the username of the system
func (sc PersistentData) findUser(username string) (bool, User) {
for _, u := range sc {
if u.Username == username {
return true, u
}
}
return false, User{}
}