-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.go
143 lines (99 loc) · 3.42 KB
/
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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package dusupay
import "encoding/json"
//TransactionTypeCode type
type TransactionTypeCode string
//TransactionTypeCollection const
const TransactionTypeCollection TransactionTypeCode = "COLLECTION"
//TransactionTypePayout const
const TransactionTypePayout TransactionTypeCode = "PAYOUT"
//TransactionTypeRefund const
const TransactionTypeRefund TransactionTypeCode = "REFUND"
//TransactionStatusCode type
type TransactionStatusCode string
//TransactionStatusPending const
const TransactionStatusPending TransactionStatusCode = "PENDING"
//TransactionStatusFailed const
const TransactionStatusFailed TransactionStatusCode = "FAILED"
//TransactionStatusCompleted const
const TransactionStatusCompleted TransactionStatusCode = "COMPLETED"
//TransactionStatusCancelled const
const TransactionStatusCancelled TransactionStatusCode = "CANCELLED"
//TransactionMethodCode type
type TransactionMethodCode string
//TransactionMethodMobileMoney type
const TransactionMethodMobileMoney TransactionMethodCode = "MOBILE_MONEY"
//TransactionMethodCard type
const TransactionMethodCard TransactionMethodCode = "CARD"
//TransactionMethodBank type
const TransactionMethodBank TransactionMethodCode = "BANK"
//TransactionMethodCrypto type
const TransactionMethodCrypto TransactionMethodCode = "CRYPTO"
//CountryCode type
type CountryCode string
//CountryCodeUganda type
const CountryCodeUganda CountryCode = "UG"
//CountryCodeKenya type
const CountryCodeKenya CountryCode = "KE"
//CountryCodeTanzania type
const CountryCodeTanzania CountryCode = "TZ"
//CountryCodeRwanda type
const CountryCodeRwanda CountryCode = "RW"
//CountryCodeBurundi type
const CountryCodeBurundi CountryCode = "BI"
//CountryCodeGhana type
const CountryCodeGhana CountryCode = "GH"
//CountryCodeCameroon type
const CountryCodeCameroon CountryCode = "CM"
//CountryCodeSouthAfrica type
const CountryCodeSouthAfrica CountryCode = "ZA"
//CountryCodeNigeria type
const CountryCodeNigeria CountryCode = "NG"
//CountryCodeZambia type
const CountryCodeZambia CountryCode = "ZM"
//CountryCodeUSA type
const CountryCodeUSA CountryCode = "US"
//CountryCodeUnitedKingdom type
const CountryCodeUnitedKingdom CountryCode = "GB"
//CountryCodeEurope type
const CountryCodeEurope CountryCode = "EU"
//CurrencyCode type
type CurrencyCode string
//CurrencyCodeUGX type
const CurrencyCodeUGX CurrencyCode = "UGX"
//CurrencyCodeKES type
const CurrencyCodeKES CurrencyCode = "KES"
//CurrencyCodeTZS type
const CurrencyCodeTZS CurrencyCode = "TZS"
//CurrencyCodeRWF type
const CurrencyCodeRWF CurrencyCode = "RWF"
//CurrencyCodeBIF type
const CurrencyCodeBIF CurrencyCode = "BIF"
//CurrencyCodeGHS type
const CurrencyCodeGHS CurrencyCode = "GHS"
//CurrencyCodeXAF type
const CurrencyCodeXAF CurrencyCode = "XAF"
//CurrencyCodeZAR type
const CurrencyCodeZAR CurrencyCode = "ZAR"
//CurrencyCodeNGN type
const CurrencyCodeNGN CurrencyCode = "NGN"
//CurrencyCodeZMW type
const CurrencyCodeZMW CurrencyCode = "ZMW"
//CurrencyCodeUSD type
const CurrencyCodeUSD CurrencyCode = "USD"
//CurrencyCodeGBP type
const CurrencyCodeGBP CurrencyCode = "GBP"
//CurrencyCodeEUR type
const CurrencyCodeEUR CurrencyCode = "EUR"
//transformStructToMap method
func transformStructToMap(st interface{}) (map[string]interface{}, error) {
bytes, err := json.Marshal(st)
if err != nil {
return nil, err
}
jsonMap := make(map[string]interface{})
err = json.Unmarshal(bytes, &jsonMap)
if err != nil {
return nil, err
}
return jsonMap, nil
}