-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
339 lines (310 loc) · 10.7 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
package gomonnify
import (
"net/http"
"time"
)
type (
Environment string
requestAuthType string
base struct {
HTTPClient *http.Client
APIBaseUrl string
Config *Config
}
disbursements struct {
*base
}
reservedAccounts struct {
*base
}
invoicing struct {
*base
}
general struct {
*base
banks *BanksResponse
}
Monnify struct {
General *general
//Invoicing *invoicing
Disbursements *disbursements
ReservedAccounts *reservedAccounts
}
// Config is used to initialize the Monnify client.
// Environment - sets the current environment. Sandbox or Live
// APIKey - well pretty obvious :)
// SecretKey - same as above
// RequestTimeout - used to set a deadline on the HTTP requests made. defaults to 5seconds.
// setting it to 0 to ignores timeout and could make request wait indefinitely (not recommended).
// DefaultContractCode - used by some endpoints. is not provided in the endpoint method params. Not required.
Config struct {
Environment Environment
APIKey string
SecretKey string
RequestTimeout time.Duration
DefaultContractCode string
}
// Endpoint Responses || Method Return Values
apiResponseMeta struct {
RequestSuccessful bool `json:"requestSuccessful"`
ResponseMessage string `json:"responseMessage"`
ResponseCode string `json:"responseCode"`
}
GeneralTransactionResponse struct {
apiResponseMeta
ResponseBody GeneralTransaction `json:"responseBody"`
}
GeneralTransaction struct {
TransactionReference string `json:"transactionReference"`
PaymentReference string `json:"paymentReference"`
AmountPaid string `json:"amountPaid"`
TotalPayable string `json:"totalPayable"`
SettlementAmount string `json:"settlementAmount"`
PaidOn string `json:"paidOn"`
PaymentStatus string `json:"paymentStatus"`
PaymentDescription string `json:"paymentDescription"`
TransactionHash string `json:"transactionHash"`
Currency string `json:"currency"`
PaymentMethod string `json:"paymentMethod"`
Product struct {
Type string `json:"type"`
Reference string `json:"reference"`
} `json:"product"`
CardDetails struct {
CardType string `json:"cardType"`
AuthorizationCode string `json:"authorizationCode"`
Last4 string `json:"last4"`
ExpMonth string `json:"expMonth"`
ExpYear string `json:"expYear"`
Bin string `json:"bin"`
Reusable bool `json:"reusable"`
} `json:"cardDetails"`
AccountDetails accountDetails `json:"accountDetails"`
AccountPayments []accountDetails `json:"accountPayments"`
Customer struct {
Email string `json:"email"`
Name string `json:"name"`
} `json:"customer"`
MetaData struct {
Name string `json:"name"`
Age string `json:"age"`
}
}
accountDetails struct {
AccountName string `json:"accountName"`
AccountNumber string `json:"accountNumber"`
BankCode string `json:"bankCode"`
AmountPaid string `json:"amountPaid"`
}
LoginResponse struct {
apiResponseMeta
ResponseBody struct {
AccessToken string `json:"accessToken"`
ExpiresIn int `json:"expiresIn"`
}
}
ReserveAccountResponse struct {
apiResponseMeta
ResponseBody struct {
ContractCode string `json:"contractCode"`
AccountReference string `json:"accountReference"`
AccountName string `json:"accountName"`
CurrencyCode string `json:"currencyCode"`
CustomerEmail string `json:"customerEmail"`
CustomerName string `json:"customerName"`
AccountNumber string `json:"accountNumber"`
BankName string `json:"bankName"`
BankCode string `json:"bankCode"`
CollectionChannel string `json:"collectionChannel"`
ReservationReference string `json:"reservationReference"`
ReservedAccountType string `json:"reservedAccountType"`
Status string `json:"status"`
CreatedOn string `json:"createdOn"`
IncomeSplitConfig []struct {
SubAccountCode string `json:"subAccountCode"`
FeePercentage float64 `json:"feePercentage"`
FeeBearer bool `json:"feeBearer"`
SplitPercentage float64 `json:"splitPercentage"`
} `json:"incomeSplitConfig"`
RestrictPaymentSource bool `json:"restrictPaymentSource"`
Contract struct {
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
SupportsAdvancedSettlementAccountSelection bool `json:"supportsAdvancedSettlementAccountSelection"`
SweepToExternalAccount bool `json:"sweepToExternalAccount"`
} `json:"contract"`
} `json:"responseBody"`
}
ReservedAccountTransactionsResponse struct {
apiResponseMeta
ResponseBody struct {
Content []ReservedAccountTransaction `json:"content"`
Pageable struct {
Sort struct {
Sorted bool `json:"sorted"`
Unsorted bool `json:"unsorted"`
Empty bool `json:"empty"`
} `json:"sort"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
Offset int `json:"offset"`
Unpaged bool `json:"unpaged"`
Paged bool `json:"paged"`
} `json:"pageable"`
TotalElements int `json:"totalElements"`
TotalPages int `json:"totalPages"`
Last bool `json:"last"`
Sort struct {
Sorted bool `json:"sorted"`
Unsorted bool `json:"unsorted"`
Empty bool `json:"empty"`
} `json:"sort"`
First bool `json:"first"`
NumberOfElements int `json:"numberOfElements"`
Size int `json:"size"`
Number int `json:"number"`
Empty bool `json:"empty"`
} `json:"responseBody"`
}
ReservedAccountTransaction struct {
CustomerDTO struct {
Email string `json:"email"`
Name string `json:"name"`
MerchantCode string `json:"merchantCode"`
} `json:"customerDTO"`
ProviderAmount float64 `json:"providerAmount"`
PaymentMethod string `json:"paymentMethod"`
CreatedOn string `json:"createdOn"`
Amount float64 `json:"amount"`
Flagged bool `json:"flagged"`
ProviderCode string `json:"providerCode"`
Fee float64 `json:"fee"`
CurrencyCode string `json:"currencyCode"`
CompletedOn string `json:"completedOn"`
PaymentDescription string `json:"paymentDescription"`
PaymentStatus string `json:"paymentStatus"`
TransactionReference string `json:"transactionReference"`
PaymentReference string `json:"paymentReference"`
MerchantCode string `json:"merchantCode"`
MerchantName string `json:"merchantName"`
PayableAmount float64 `json:"payableAmount"`
AmountPaid float64 `json:"amountPaid"`
Completed bool `json:"completed"`
}
SingleTransferResponse struct {
apiResponseMeta
ResponseBody struct {
Amount float64 `json:"amount"`
Reference string `json:"reference"`
Status string `json:"status"`
DateCreated string `json:"dateCreated"`
}
}
BulkTransferResponse struct {
apiResponseMeta
ResponseBody struct {
TotalAmount float64 `json:"totalAmount"`
TotalFee float64 `json:"totalFee"`
BatchReference string `json:"batchReference"`
BatchStatus string `json:"batchStatus"`
TotalTransactions int `json:"totalTransactions"`
DateCreated string `json:"date_created"`
}
}
SingleTransferDetailsResponse struct {
apiResponseMeta
ResponseBody SingleTransferDetails `json:"responseBody"`
}
SingleTransferDetails struct {
Amount float64 `json:"amount"`
Reference string `json:"reference"`
Narration string `json:"narration"`
BankCode string `json:"bankCode"`
AccountNumber string `json:"accountNumber"`
Currency string `json:"currency"`
AccountName string `json:"accountName"`
BankName string `json:"bankName"`
DateCreated string `json:"dateCreated"`
Fee float64 `json:"fee"`
Status string `json:"status"`
}
BulkTransferDetailsResponse struct {
apiResponseMeta
ResponseBody struct {
Title string `json:"title"`
TotalAmount float64 `json:"totalAmount"`
TotalFee float64 `json:"totalFee"`
BatchReference string `json:"batchReference"`
TotalTransactions int `json:"totalTransactions"`
FailedCount int `json:"failedCount"`
SuccessfulCount int `json:"successfulCount"`
PendingCount int `json:"pendingCount"`
BatchStatus string `json:"batchStatus"`
DateCreated string `json:"dateCreated"`
} `json:"responseBody"`
}
TransferTransactionsResponse struct {
apiResponseMeta
ResponseBody struct {
Content []SingleTransferDetails `json:"content"`
Pageable struct {
Sort struct {
Sorted bool `json:"sorted"`
Unsorted bool `json:"unsorted"`
Empty bool `json:"empty"`
} `json:"sort"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
Offset int `json:"offset"`
Unpaged bool `json:"unpaged"`
Paged bool `json:"paged"`
} `json:"pageable"`
TotalElements int `json:"totalElements"`
TotalPages int `json:"totalPages"`
Last bool `json:"last"`
Sort struct {
Sorted bool `json:"sorted"`
Unsorted bool `json:"unsorted"`
Empty bool `json:"empty"`
} `json:"sort"`
First bool `json:"first"`
NumberOfElements int `json:"numberOfElements"`
Size int `json:"size"`
Number int `json:"number"`
Empty bool `json:"empty"`
} `json:"responseBody"`
}
ValidAccountNumberResponse struct {
apiResponseMeta
ResponseBody struct {
AccountNumber string `json:"accountNumber"`
AccountName string `json:"accountName"`
BankCode string `json:"bankCode"`
} `json:"responseBody"`
}
WalletBalanceResponse struct {
apiResponseMeta
ResponseBody struct {
AvailableBalance float64 `json:"availableBalance"`
LedgerBalance float64 `json:"ledgerBalance"`
} `json:"responseBody"`
}
ResendOTPResponse struct {
apiResponseMeta
ResponseBody struct {
Message string `json:"message"`
} `json:"responseBody"`
}
BanksResponse struct {
apiResponseMeta
ResponseBody []Bank `json:"responseBody"`
}
Bank struct {
Name string `json:"name"`
Code string `json:"code"`
USSDTemplate string `json:"ussdTemplate"`
BaseUSSDCode string `json:"baseUssdCode"`
TransferUSSDTemplate string `json:"transferUssdTemplate"`
}
)