@nombaoss/nomba-node 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +467 -2
- package/dist/index.cjs +1557 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1365 -0
- package/dist/index.d.ts +1365 -0
- package/dist/index.js +1532 -0
- package/dist/index.js.map +1 -0
- package/package.json +74 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request and response types, from the Nomba OpenAPI spec (NombaOSS/openapi v0.1.0).
|
|
3
|
+
* Response types allow extra fields: Nomba adds fields without notice.
|
|
4
|
+
*/
|
|
5
|
+
/** Allows fields not (yet) described in the spec. */
|
|
6
|
+
interface Extra {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
/** Cursor-paginated list. An empty or absent `cursor` means this is the last page. */
|
|
10
|
+
interface CursorPage<T> extends Extra {
|
|
11
|
+
results?: T[];
|
|
12
|
+
cursor?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PageOptions {
|
|
15
|
+
/** Page size, 1–50. */
|
|
16
|
+
limit?: number;
|
|
17
|
+
/** Cursor from the previous page. */
|
|
18
|
+
cursor?: string;
|
|
19
|
+
}
|
|
20
|
+
interface DateRange {
|
|
21
|
+
/** Start date, e.g. `2025-01-01T00:00:00`. */
|
|
22
|
+
dateFrom?: string;
|
|
23
|
+
dateTo?: string;
|
|
24
|
+
}
|
|
25
|
+
interface SubAccountOption {
|
|
26
|
+
/** Act on this sub account instead of the parent account. */
|
|
27
|
+
subAccountId?: string;
|
|
28
|
+
}
|
|
29
|
+
type TransactionStatusValue = "SUCCESS" | "PENDING_BILLING" | "PROCESSING" | "REFUND" | "CANCELLED" | "PAYMENT_FAILED" | "REVERSED_BY_VENDOR";
|
|
30
|
+
type TransactionSource = "api" | "pos" | "web" | "android_app" | "ios_app";
|
|
31
|
+
type TransactionType = "withdrawal" | "purchase" | "transfer" | "p2p" | "online_checkout" | "qrt_credit" | "qrt_debit";
|
|
32
|
+
/** String unions widened with `string` so new values don't break your build. */
|
|
33
|
+
type Open<T extends string> = T | (string & {});
|
|
34
|
+
interface RevokeTokenResult extends Extra {
|
|
35
|
+
}
|
|
36
|
+
interface Account extends Extra {
|
|
37
|
+
createdAt: string;
|
|
38
|
+
accountId: string;
|
|
39
|
+
accountHolderId: string;
|
|
40
|
+
accountRef: string;
|
|
41
|
+
bvn: string;
|
|
42
|
+
status: Open<"ACTIVE" | "INACTIVE" | "SUSPENDED" | "PND" | "BLACKLISTED">;
|
|
43
|
+
type: Open<"virtual" | "outlet">;
|
|
44
|
+
accountName: string;
|
|
45
|
+
currency: Open<"NGN">;
|
|
46
|
+
banks?: Array<{
|
|
47
|
+
bankAccountNumber: string;
|
|
48
|
+
bankName: string;
|
|
49
|
+
bankAccountName: string;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
interface Balance extends Extra {
|
|
53
|
+
amount: string;
|
|
54
|
+
currency: Open<"NGN">;
|
|
55
|
+
timeCreated: string;
|
|
56
|
+
}
|
|
57
|
+
interface GetBalanceParams extends SubAccountOption {
|
|
58
|
+
}
|
|
59
|
+
interface GetSubAccountParams {
|
|
60
|
+
accountId?: string;
|
|
61
|
+
accountRef?: string;
|
|
62
|
+
}
|
|
63
|
+
interface Terminal extends Extra {
|
|
64
|
+
terminalId: string;
|
|
65
|
+
serialNumber: string;
|
|
66
|
+
accountId: string;
|
|
67
|
+
parentAccountId: string;
|
|
68
|
+
merchantName: string;
|
|
69
|
+
terminalLabel: string;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
interface ListTerminalsParams extends SubAccountOption, PageOptions {
|
|
74
|
+
terminalId?: string;
|
|
75
|
+
serialNumber?: string;
|
|
76
|
+
terminalLabel?: string;
|
|
77
|
+
merchantName?: string;
|
|
78
|
+
}
|
|
79
|
+
interface CreateVirtualAccountParams {
|
|
80
|
+
/** Your unique reference for the account. */
|
|
81
|
+
accountRef: string;
|
|
82
|
+
accountName: string;
|
|
83
|
+
bvn?: string;
|
|
84
|
+
nin?: string;
|
|
85
|
+
expiryDate?: string;
|
|
86
|
+
expectedAmount?: number;
|
|
87
|
+
restrictInflowToAccountName?: boolean;
|
|
88
|
+
callbackUrl?: string;
|
|
89
|
+
}
|
|
90
|
+
interface VirtualAccount extends Extra {
|
|
91
|
+
createdAt: string;
|
|
92
|
+
accountHolderId: string;
|
|
93
|
+
accountRef: string;
|
|
94
|
+
bvn: string;
|
|
95
|
+
identifierType?: Open<"BVN" | "NIN" | "BVN_AND_NIN">;
|
|
96
|
+
accountName: string;
|
|
97
|
+
bankName?: string;
|
|
98
|
+
bankAccountNumber?: string;
|
|
99
|
+
bankAccountName?: string;
|
|
100
|
+
currency: Open<"NGN">;
|
|
101
|
+
callbackUrl?: string;
|
|
102
|
+
expired?: boolean;
|
|
103
|
+
restrictInflowToAccountName?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface UpdateVirtualAccountParams {
|
|
106
|
+
newAccountRef?: string;
|
|
107
|
+
accountName?: string;
|
|
108
|
+
expectedAmount?: string;
|
|
109
|
+
}
|
|
110
|
+
interface UpdateVirtualAccountResult extends Extra {
|
|
111
|
+
updated: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface ExpireVirtualAccountResult extends Extra {
|
|
114
|
+
expired: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface VirtualAccountFilters {
|
|
117
|
+
accountName?: string;
|
|
118
|
+
accountRef?: string;
|
|
119
|
+
bvn?: string;
|
|
120
|
+
bankAccountNumber?: string;
|
|
121
|
+
dateCreatedFrom?: string;
|
|
122
|
+
dateCreatedTo?: string;
|
|
123
|
+
expired?: boolean;
|
|
124
|
+
resourceAcquired?: boolean;
|
|
125
|
+
}
|
|
126
|
+
type CheckoutCurrency = Open<"NGN" | "CDF" | "USD">;
|
|
127
|
+
interface SplitRequest {
|
|
128
|
+
splitType?: Open<"PERCENTAGE" | "AMOUNT">;
|
|
129
|
+
splitList?: Array<{
|
|
130
|
+
accountId?: string;
|
|
131
|
+
value?: number;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
interface CheckoutOrderInput {
|
|
135
|
+
orderReference?: string;
|
|
136
|
+
customerId?: string;
|
|
137
|
+
callbackUrl: string;
|
|
138
|
+
customerEmail: string;
|
|
139
|
+
amount: number;
|
|
140
|
+
currency: CheckoutCurrency;
|
|
141
|
+
accountId?: string;
|
|
142
|
+
allowedPaymentMethods?: string[];
|
|
143
|
+
splitRequest?: SplitRequest;
|
|
144
|
+
orderMetaData?: Record<string, unknown>;
|
|
145
|
+
}
|
|
146
|
+
interface CreateOrderParams {
|
|
147
|
+
order: CheckoutOrderInput;
|
|
148
|
+
/** Save the customer's card for later charges with `chargeSavedCard`. */
|
|
149
|
+
tokenizeCard?: boolean;
|
|
150
|
+
}
|
|
151
|
+
interface CreateOrderResult extends Extra {
|
|
152
|
+
checkoutLink: string;
|
|
153
|
+
orderReference: string;
|
|
154
|
+
}
|
|
155
|
+
interface CheckoutOrder extends Extra {
|
|
156
|
+
orderId?: string;
|
|
157
|
+
orderReference?: string;
|
|
158
|
+
customerId?: string;
|
|
159
|
+
accountId?: string;
|
|
160
|
+
callbackUrl?: string;
|
|
161
|
+
customerEmail?: string;
|
|
162
|
+
amount?: number;
|
|
163
|
+
currency?: string;
|
|
164
|
+
businessName?: string;
|
|
165
|
+
businessEmail?: string;
|
|
166
|
+
businessLogo?: string;
|
|
167
|
+
}
|
|
168
|
+
interface GetOrderResult extends Extra {
|
|
169
|
+
order?: CheckoutOrder;
|
|
170
|
+
hasSavedCards?: boolean;
|
|
171
|
+
base64EncodedRsaPublicKey?: string;
|
|
172
|
+
}
|
|
173
|
+
interface OrderReferenceParams {
|
|
174
|
+
orderReference: string;
|
|
175
|
+
}
|
|
176
|
+
interface SuccessMessage extends Extra {
|
|
177
|
+
success: boolean;
|
|
178
|
+
message: string;
|
|
179
|
+
}
|
|
180
|
+
interface StatusMessage extends Extra {
|
|
181
|
+
status?: boolean;
|
|
182
|
+
message?: string;
|
|
183
|
+
}
|
|
184
|
+
interface GetCheckoutTransactionParams {
|
|
185
|
+
idType: Open<"ORDER_ID" | "ORDER_REFERENCE">;
|
|
186
|
+
id: string;
|
|
187
|
+
}
|
|
188
|
+
interface CheckoutTransaction extends Extra {
|
|
189
|
+
success?: boolean;
|
|
190
|
+
message?: string;
|
|
191
|
+
order?: CheckoutOrder;
|
|
192
|
+
transactionDetails?: Extra & {
|
|
193
|
+
transactionDate?: string;
|
|
194
|
+
paymentReference?: string;
|
|
195
|
+
paymentVendorReference?: string;
|
|
196
|
+
tokenizedCardPayment?: boolean;
|
|
197
|
+
statusCode?: string;
|
|
198
|
+
status?: Open<"PENDING" | "PAYMENT SUCCESSFUL" | "FAILED PAYMENT">;
|
|
199
|
+
};
|
|
200
|
+
transferDetails?: Extra & {
|
|
201
|
+
sessionId?: string;
|
|
202
|
+
beneficiaryAccountName?: string;
|
|
203
|
+
beneficiaryAccountNumber?: string;
|
|
204
|
+
originatorAccountName?: string;
|
|
205
|
+
originatorAccountNumber?: string;
|
|
206
|
+
narration?: string;
|
|
207
|
+
destinationInstitutionCode?: string;
|
|
208
|
+
paymentReference?: string;
|
|
209
|
+
};
|
|
210
|
+
cardDetails?: Extra & {
|
|
211
|
+
cardPan?: string;
|
|
212
|
+
cardType?: string;
|
|
213
|
+
cardCurrency?: string;
|
|
214
|
+
cardBank?: string;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
interface RefundParams {
|
|
218
|
+
transactionId: string;
|
|
219
|
+
amount?: number;
|
|
220
|
+
accountNumber?: string;
|
|
221
|
+
bankCode?: string;
|
|
222
|
+
}
|
|
223
|
+
interface ChargeSavedCardParams {
|
|
224
|
+
/**
|
|
225
|
+
* The order to charge. If `order.orderReference` is omitted the SDK generates one
|
|
226
|
+
* (UUID v4) and returns it as `orderReference`; reuse it to requery.
|
|
227
|
+
*/
|
|
228
|
+
order: CheckoutOrderInput;
|
|
229
|
+
/** The card token from the `payment_success` webhook. */
|
|
230
|
+
tokenKey: string;
|
|
231
|
+
}
|
|
232
|
+
interface ChargeSavedCardResult extends Extra {
|
|
233
|
+
status?: boolean;
|
|
234
|
+
message?: string;
|
|
235
|
+
orderId?: string;
|
|
236
|
+
orderReference?: string;
|
|
237
|
+
/** The customer's bank wants an OTP: submit it with `checkout.submitCardOtp`. */
|
|
238
|
+
otpRequired?: boolean;
|
|
239
|
+
transactionId?: string;
|
|
240
|
+
}
|
|
241
|
+
interface SavedCard extends Extra {
|
|
242
|
+
tokenKey?: string;
|
|
243
|
+
customerEmail?: string;
|
|
244
|
+
cardType?: string;
|
|
245
|
+
cardPan?: string;
|
|
246
|
+
tokenExpiryDate?: string;
|
|
247
|
+
}
|
|
248
|
+
interface ListSavedCardsParams extends DateRange {
|
|
249
|
+
customerEmail?: string;
|
|
250
|
+
page?: number;
|
|
251
|
+
limit?: number;
|
|
252
|
+
}
|
|
253
|
+
interface SavedCardList extends Extra {
|
|
254
|
+
hasNextPage?: boolean;
|
|
255
|
+
nextPage?: number;
|
|
256
|
+
tokenizedCardDataList?: SavedCard[];
|
|
257
|
+
}
|
|
258
|
+
interface UpdateSavedCardEmailParams {
|
|
259
|
+
tokenKey: string;
|
|
260
|
+
currentEmailAddress: string;
|
|
261
|
+
newEmailAddress: string;
|
|
262
|
+
}
|
|
263
|
+
interface UpdateSavedCardEmailResult extends StatusMessage {
|
|
264
|
+
tokenizedCardData?: SavedCard;
|
|
265
|
+
}
|
|
266
|
+
interface DeleteSavedCardParams {
|
|
267
|
+
tokenKey: string;
|
|
268
|
+
}
|
|
269
|
+
interface TransferAccount extends Extra {
|
|
270
|
+
accountNumber: string;
|
|
271
|
+
accountName: string;
|
|
272
|
+
bankName: string;
|
|
273
|
+
}
|
|
274
|
+
interface DeviceInformation {
|
|
275
|
+
httpBrowserLanguage?: string;
|
|
276
|
+
httpBrowserJavaEnabled?: boolean;
|
|
277
|
+
httpBrowserJavaScriptEnabled?: boolean;
|
|
278
|
+
httpBrowserColorDepth?: string;
|
|
279
|
+
httpBrowserScreenHeight?: string;
|
|
280
|
+
httpBrowserScreenWidth?: string;
|
|
281
|
+
httpBrowserTimeDifference?: string;
|
|
282
|
+
userAgentBrowserValue?: string;
|
|
283
|
+
deviceChannel?: string;
|
|
284
|
+
}
|
|
285
|
+
interface SubmitCardDetailsParams {
|
|
286
|
+
/** RSA-encrypted card details. */
|
|
287
|
+
cardDetails?: string;
|
|
288
|
+
key?: string;
|
|
289
|
+
orderReference?: string;
|
|
290
|
+
saveCard?: boolean;
|
|
291
|
+
deviceInformation?: DeviceInformation;
|
|
292
|
+
}
|
|
293
|
+
interface SubmitCardDetailsResult extends Extra {
|
|
294
|
+
status?: boolean;
|
|
295
|
+
message?: string;
|
|
296
|
+
responseCode?: string;
|
|
297
|
+
transactionId?: string;
|
|
298
|
+
secureAuthenticationData?: Extra & {
|
|
299
|
+
jwt?: string;
|
|
300
|
+
md?: string;
|
|
301
|
+
acsUrl?: string;
|
|
302
|
+
termUrl?: string;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
interface SubmitCardOtpParams {
|
|
306
|
+
otp: string;
|
|
307
|
+
orderReference: string;
|
|
308
|
+
transactionId: string;
|
|
309
|
+
}
|
|
310
|
+
interface SubmitCardOtpResult extends Extra {
|
|
311
|
+
status: boolean;
|
|
312
|
+
message: string;
|
|
313
|
+
}
|
|
314
|
+
interface ConfirmTransactionReceiptResult extends Extra {
|
|
315
|
+
status: boolean;
|
|
316
|
+
message: string;
|
|
317
|
+
order?: CheckoutOrder;
|
|
318
|
+
}
|
|
319
|
+
interface CancelTransactionParams {
|
|
320
|
+
transactionId: string;
|
|
321
|
+
forceCancel: boolean;
|
|
322
|
+
}
|
|
323
|
+
interface RequestSaveCardOtpParams {
|
|
324
|
+
orderReference: string;
|
|
325
|
+
phoneNumber: string;
|
|
326
|
+
}
|
|
327
|
+
interface SubmitUserOtpParams {
|
|
328
|
+
orderReference: string;
|
|
329
|
+
phoneNumber: string;
|
|
330
|
+
otp: string;
|
|
331
|
+
}
|
|
332
|
+
interface GetSavedCardsParams {
|
|
333
|
+
otp: string;
|
|
334
|
+
}
|
|
335
|
+
interface UserSavedCards extends Extra {
|
|
336
|
+
tokenizedCardData?: unknown;
|
|
337
|
+
}
|
|
338
|
+
interface Bank extends Extra {
|
|
339
|
+
code?: string;
|
|
340
|
+
name?: string;
|
|
341
|
+
nipCode?: string;
|
|
342
|
+
logo?: string;
|
|
343
|
+
}
|
|
344
|
+
interface LookupAccountParams {
|
|
345
|
+
accountNumber: string;
|
|
346
|
+
bankCode: string;
|
|
347
|
+
}
|
|
348
|
+
interface AccountLookupResult extends Extra {
|
|
349
|
+
accountNumber?: string;
|
|
350
|
+
accountName?: string;
|
|
351
|
+
}
|
|
352
|
+
interface MerchantTxRefOption {
|
|
353
|
+
/**
|
|
354
|
+
* Your unique reference for this transaction. If omitted the SDK generates one
|
|
355
|
+
* (UUID v4) and returns it. Reuse the same value when retrying so Nomba can
|
|
356
|
+
* deduplicate.
|
|
357
|
+
*/
|
|
358
|
+
merchantTxRef?: string;
|
|
359
|
+
}
|
|
360
|
+
interface BankTransferParams extends MerchantTxRefOption {
|
|
361
|
+
amount: number;
|
|
362
|
+
accountNumber: string;
|
|
363
|
+
accountName: string;
|
|
364
|
+
bankCode: string;
|
|
365
|
+
senderName?: string;
|
|
366
|
+
narration?: string;
|
|
367
|
+
}
|
|
368
|
+
interface BankTransferResult extends Extra {
|
|
369
|
+
id: string;
|
|
370
|
+
amount: string;
|
|
371
|
+
status: Open<TransactionStatusValue>;
|
|
372
|
+
type: Open<TransactionType>;
|
|
373
|
+
fee: number;
|
|
374
|
+
timeCreated: string;
|
|
375
|
+
source?: string;
|
|
376
|
+
sourceUserId?: string;
|
|
377
|
+
customerBillerId?: string;
|
|
378
|
+
productId?: string;
|
|
379
|
+
meta: Extra & {
|
|
380
|
+
merchantTxRef?: string;
|
|
381
|
+
sessionId?: string;
|
|
382
|
+
narration?: string;
|
|
383
|
+
recipientName?: string;
|
|
384
|
+
accountNumber?: string;
|
|
385
|
+
bankName?: string;
|
|
386
|
+
bankCode?: string;
|
|
387
|
+
};
|
|
388
|
+
/** The reference sent (generated by the SDK if you did not pass one). */
|
|
389
|
+
merchantTxRef: string;
|
|
390
|
+
}
|
|
391
|
+
interface WalletTransferParams extends MerchantTxRefOption {
|
|
392
|
+
amount: number;
|
|
393
|
+
/** The Nomba account ID receiving the funds. */
|
|
394
|
+
receiverAccountId: string;
|
|
395
|
+
narration?: string;
|
|
396
|
+
}
|
|
397
|
+
interface WalletTransferResult extends Extra {
|
|
398
|
+
id: string;
|
|
399
|
+
amount: number;
|
|
400
|
+
status: Open<TransactionStatusValue>;
|
|
401
|
+
type: Open<TransactionType>;
|
|
402
|
+
fee: number;
|
|
403
|
+
timeCreated: string;
|
|
404
|
+
meta: Extra & {
|
|
405
|
+
merchantTxRef?: string;
|
|
406
|
+
api_client_id?: string;
|
|
407
|
+
api_account_id?: string;
|
|
408
|
+
rrn?: string;
|
|
409
|
+
};
|
|
410
|
+
/** The reference sent (generated by the SDK if you did not pass one). */
|
|
411
|
+
merchantTxRef: string;
|
|
412
|
+
}
|
|
413
|
+
interface Transaction extends Extra {
|
|
414
|
+
id: string;
|
|
415
|
+
status: Open<TransactionStatusValue>;
|
|
416
|
+
amount: number;
|
|
417
|
+
fixedCharge?: number;
|
|
418
|
+
source: Open<TransactionSource>;
|
|
419
|
+
type: Open<TransactionType>;
|
|
420
|
+
gatewayMessage: string;
|
|
421
|
+
customerBillerId?: string;
|
|
422
|
+
timeCreated: string;
|
|
423
|
+
posTid?: string;
|
|
424
|
+
terminalId?: string;
|
|
425
|
+
providerTerminalId?: string;
|
|
426
|
+
rrn?: string;
|
|
427
|
+
posSerialNumber?: string;
|
|
428
|
+
posTerminalLabel?: string;
|
|
429
|
+
stan?: string;
|
|
430
|
+
paymentVendorReference?: string;
|
|
431
|
+
userId?: string;
|
|
432
|
+
posRrn?: string;
|
|
433
|
+
merchantTxRef?: string;
|
|
434
|
+
}
|
|
435
|
+
interface ListTransactionsParams extends SubAccountOption, PageOptions, DateRange {
|
|
436
|
+
}
|
|
437
|
+
interface TransactionFilters {
|
|
438
|
+
transactionRef?: string;
|
|
439
|
+
status?: Open<"NEW" | "PENDING_PAYMENT" | "PAYMENT_SUCCESSFUL" | "PAYMENT_FAILED" | "PENDING_BILLING" | "SUCCESS" | "REFUND">;
|
|
440
|
+
source?: Open<TransactionSource>;
|
|
441
|
+
type?: Open<TransactionType>;
|
|
442
|
+
terminalId?: string;
|
|
443
|
+
rrn?: string;
|
|
444
|
+
merchantTxRef?: string;
|
|
445
|
+
orderReference?: string;
|
|
446
|
+
orderId?: string;
|
|
447
|
+
}
|
|
448
|
+
interface GetTransactionParams extends SubAccountOption {
|
|
449
|
+
transactionRef?: string;
|
|
450
|
+
merchantTxRef?: string;
|
|
451
|
+
orderReference?: string;
|
|
452
|
+
orderId?: string;
|
|
453
|
+
}
|
|
454
|
+
interface ListBankTransactionsParams extends PageOptions, DateRange {
|
|
455
|
+
}
|
|
456
|
+
interface BankTransaction extends Extra {
|
|
457
|
+
amount: number;
|
|
458
|
+
currency: Open<"NGN">;
|
|
459
|
+
meta: Extra & {
|
|
460
|
+
billerId?: string;
|
|
461
|
+
terminalActionId?: string;
|
|
462
|
+
productId?: string;
|
|
463
|
+
fee?: number;
|
|
464
|
+
type?: string;
|
|
465
|
+
transactionId?: string;
|
|
466
|
+
rrn?: string;
|
|
467
|
+
parentAccountId?: string;
|
|
468
|
+
terminalLabel?: string;
|
|
469
|
+
accountId?: string;
|
|
470
|
+
merchantTxRef?: string;
|
|
471
|
+
transactionAmount?: number;
|
|
472
|
+
mCollectionsId?: string;
|
|
473
|
+
};
|
|
474
|
+
status: Open<TransactionStatusValue>;
|
|
475
|
+
timeUpdated: string;
|
|
476
|
+
walletBalance: number;
|
|
477
|
+
transactionType: Open<"CREDIT" | "DEBIT">;
|
|
478
|
+
}
|
|
479
|
+
interface AssignTerminalParams {
|
|
480
|
+
serialNumber: string;
|
|
481
|
+
terminalLabel?: string;
|
|
482
|
+
}
|
|
483
|
+
interface TerminalPaymentRequestParams {
|
|
484
|
+
merchantTxRef: string;
|
|
485
|
+
amount: number;
|
|
486
|
+
currency: Open<"NGN" | "USD" | "CDF">;
|
|
487
|
+
}
|
|
488
|
+
interface TerminalPaymentRequestResult extends Extra {
|
|
489
|
+
paymentId: string;
|
|
490
|
+
status: Open<"pending" | "completed" | "failed">;
|
|
491
|
+
amount: number;
|
|
492
|
+
currency: string;
|
|
493
|
+
createdAt: string;
|
|
494
|
+
}
|
|
495
|
+
type MandateFrequency = Open<"VARIABLE" | "WEEKLY" | "EVERY_TWO_WEEKS" | "MONTHLY" | "EVERY_TWO_MONTHS" | "EVERY_THREE_MONTHS" | "EVERY_FOUR_MONTHS" | "EVERY_FIVE_MONTHS" | "EVERY_SIX_MONTHS" | "EVERY_SEVEN_MONTHS" | "EVERY_EIGHT_MONTHS" | "EVERY_NINE_MONTHS" | "EVERY_TEN_MONTHS" | "EVERY_ELEVEN_MONTHS" | "EVERY_TWELVE_MONTHS">;
|
|
496
|
+
interface CreateMandateParams {
|
|
497
|
+
customerAccountNumber: string;
|
|
498
|
+
bankCode: string;
|
|
499
|
+
customerName: string;
|
|
500
|
+
customerAddress?: string;
|
|
501
|
+
customerAccountName: string;
|
|
502
|
+
amount: number;
|
|
503
|
+
frequency: MandateFrequency;
|
|
504
|
+
narration?: string;
|
|
505
|
+
customerPhoneNumber?: string;
|
|
506
|
+
merchantReference: string;
|
|
507
|
+
startDate: string;
|
|
508
|
+
endDate: string;
|
|
509
|
+
customerEmail: string;
|
|
510
|
+
startImmediately?: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface CreateMandateResult extends Extra {
|
|
513
|
+
mandateId: string;
|
|
514
|
+
merchantReference: string;
|
|
515
|
+
phoneNumber: string;
|
|
516
|
+
description: string;
|
|
517
|
+
}
|
|
518
|
+
interface DebitMandateParams {
|
|
519
|
+
mandateId: string;
|
|
520
|
+
amount: string;
|
|
521
|
+
}
|
|
522
|
+
interface DebitMandateResult extends Extra {
|
|
523
|
+
mandateId?: string;
|
|
524
|
+
status?: string;
|
|
525
|
+
amount?: string;
|
|
526
|
+
message?: string;
|
|
527
|
+
}
|
|
528
|
+
interface MandateStatus extends Extra {
|
|
529
|
+
customerAccountName: string;
|
|
530
|
+
mandateId: string;
|
|
531
|
+
customerAccountNumber: string;
|
|
532
|
+
mandateStatus: string;
|
|
533
|
+
rejectionComment?: string;
|
|
534
|
+
mandateAdviceStatus?: string;
|
|
535
|
+
}
|
|
536
|
+
interface ListMandatesParams {
|
|
537
|
+
page?: number;
|
|
538
|
+
pageSize?: number;
|
|
539
|
+
from?: string;
|
|
540
|
+
to?: string;
|
|
541
|
+
status?: string;
|
|
542
|
+
}
|
|
543
|
+
interface Mandate extends Extra {
|
|
544
|
+
status?: string;
|
|
545
|
+
customerAccountNumber?: string;
|
|
546
|
+
customerAccountName?: string;
|
|
547
|
+
bankCode?: string;
|
|
548
|
+
amount?: number;
|
|
549
|
+
customerName?: string;
|
|
550
|
+
customerAddress?: string;
|
|
551
|
+
customerEmail?: string;
|
|
552
|
+
customerPhoneNumber?: string;
|
|
553
|
+
merchantReference?: string;
|
|
554
|
+
frequency?: string;
|
|
555
|
+
startDate?: string;
|
|
556
|
+
endDate?: string;
|
|
557
|
+
mandateAdviceStatus?: string;
|
|
558
|
+
mandateId?: string;
|
|
559
|
+
}
|
|
560
|
+
interface MandateList extends Extra {
|
|
561
|
+
/** The spec types this as an object; in practice it may be a list. */
|
|
562
|
+
items?: Mandate | Mandate[];
|
|
563
|
+
page?: number;
|
|
564
|
+
pageSize?: number;
|
|
565
|
+
totalItems?: number;
|
|
566
|
+
totalPages?: number;
|
|
567
|
+
hasMore?: boolean;
|
|
568
|
+
}
|
|
569
|
+
interface UpdateMandateStatusParams {
|
|
570
|
+
mandateId: string;
|
|
571
|
+
status: Open<"SUSPEND" | "ACTIVE" | "DELETE">;
|
|
572
|
+
}
|
|
573
|
+
interface UpdateMandateStatusResult extends Extra {
|
|
574
|
+
mandateId?: string;
|
|
575
|
+
mandateStatus?: string;
|
|
576
|
+
}
|
|
577
|
+
type Network = Open<"GLO" | "MTN" | "9MOBILE" | "AIRTEL">;
|
|
578
|
+
interface BuyAirtimeParams extends MerchantTxRefOption {
|
|
579
|
+
amount: number;
|
|
580
|
+
phoneNumber: string;
|
|
581
|
+
network: Network;
|
|
582
|
+
senderName?: string;
|
|
583
|
+
}
|
|
584
|
+
interface BuyDataParams extends MerchantTxRefOption {
|
|
585
|
+
/** From `bills.listDataPlans`. */
|
|
586
|
+
productId: string;
|
|
587
|
+
amount?: number;
|
|
588
|
+
phoneNumber: string;
|
|
589
|
+
network: Network;
|
|
590
|
+
senderName?: string;
|
|
591
|
+
}
|
|
592
|
+
interface BuyElectricityParams extends MerchantTxRefOption {
|
|
593
|
+
disco?: string;
|
|
594
|
+
payerName?: string;
|
|
595
|
+
amount?: number;
|
|
596
|
+
customerId?: string;
|
|
597
|
+
meterType?: string;
|
|
598
|
+
}
|
|
599
|
+
interface PayCableTvParams extends MerchantTxRefOption {
|
|
600
|
+
cableTvType?: string;
|
|
601
|
+
payerName?: string;
|
|
602
|
+
amount?: number;
|
|
603
|
+
customerId?: string;
|
|
604
|
+
}
|
|
605
|
+
interface FundBettingParams extends MerchantTxRefOption {
|
|
606
|
+
bettingProvider?: string;
|
|
607
|
+
phoneNumber?: string;
|
|
608
|
+
payerName?: string;
|
|
609
|
+
amount?: number;
|
|
610
|
+
customerId?: string;
|
|
611
|
+
}
|
|
612
|
+
interface BillPurchaseResult extends Extra {
|
|
613
|
+
id: string;
|
|
614
|
+
status: Open<TransactionStatusValue>;
|
|
615
|
+
type: string;
|
|
616
|
+
amount: number;
|
|
617
|
+
source?: string;
|
|
618
|
+
sourceUserId?: string;
|
|
619
|
+
customerBillerId?: string;
|
|
620
|
+
productId?: string;
|
|
621
|
+
meta?: Extra;
|
|
622
|
+
userId?: string;
|
|
623
|
+
timeCreated: string;
|
|
624
|
+
/** The reference sent (generated by the SDK if you did not pass one). */
|
|
625
|
+
merchantTxRef: string;
|
|
626
|
+
}
|
|
627
|
+
interface DataPlan extends Extra {
|
|
628
|
+
amount?: number;
|
|
629
|
+
productId?: string;
|
|
630
|
+
}
|
|
631
|
+
interface LookupElectricityCustomerParams {
|
|
632
|
+
disco: string;
|
|
633
|
+
customerId: string;
|
|
634
|
+
}
|
|
635
|
+
interface ElectricityCustomer extends Extra {
|
|
636
|
+
name: string;
|
|
637
|
+
address: string;
|
|
638
|
+
}
|
|
639
|
+
type CableTvType = Open<"dstv" | "gotv" | "startimes" | "showmax">;
|
|
640
|
+
interface CableTvPlan extends Extra {
|
|
641
|
+
subScriptionType: string;
|
|
642
|
+
amount: number;
|
|
643
|
+
}
|
|
644
|
+
interface LookupCableTvCustomerParams {
|
|
645
|
+
customerId: string;
|
|
646
|
+
cableTvType: CableTvType;
|
|
647
|
+
}
|
|
648
|
+
interface BettingProvider extends Extra {
|
|
649
|
+
name: string;
|
|
650
|
+
id: string;
|
|
651
|
+
}
|
|
652
|
+
interface LookupBettingCustomerParams {
|
|
653
|
+
providerId: string;
|
|
654
|
+
customerId: string;
|
|
655
|
+
}
|
|
656
|
+
interface GlobalPayoutAccount extends Extra {
|
|
657
|
+
accountId?: string;
|
|
658
|
+
name?: string;
|
|
659
|
+
currency?: string;
|
|
660
|
+
balance?: number;
|
|
661
|
+
availableBalance?: number;
|
|
662
|
+
status?: Open<"ACTIVE" | "UNAVAILABLE">;
|
|
663
|
+
operationRegion?: string;
|
|
664
|
+
}
|
|
665
|
+
interface ListBankProvidersParams {
|
|
666
|
+
isMobileMoney?: boolean;
|
|
667
|
+
countryIsoCode?: string;
|
|
668
|
+
}
|
|
669
|
+
interface Provider extends Extra {
|
|
670
|
+
code?: string;
|
|
671
|
+
displayName?: string;
|
|
672
|
+
}
|
|
673
|
+
interface GetExchangeRatesParams {
|
|
674
|
+
from: string;
|
|
675
|
+
to: string;
|
|
676
|
+
region?: string;
|
|
677
|
+
}
|
|
678
|
+
interface ExchangeRates extends Extra {
|
|
679
|
+
rates?: Array<Extra & {
|
|
680
|
+
exchangeRateId?: string;
|
|
681
|
+
currencyPairName?: string;
|
|
682
|
+
bidRate?: string;
|
|
683
|
+
askRate?: string;
|
|
684
|
+
midRate?: string;
|
|
685
|
+
createdAt?: string;
|
|
686
|
+
}>;
|
|
687
|
+
}
|
|
688
|
+
interface ListPaymentMethodsParams {
|
|
689
|
+
destinationCountryIsoCode?: string;
|
|
690
|
+
destinationCurrency?: string;
|
|
691
|
+
code?: string;
|
|
692
|
+
name?: string;
|
|
693
|
+
}
|
|
694
|
+
interface PaymentMethod extends Extra {
|
|
695
|
+
code?: string;
|
|
696
|
+
displayName?: string;
|
|
697
|
+
purposeOfPaymentRequired?: boolean;
|
|
698
|
+
purposeOfPayments?: Provider[];
|
|
699
|
+
requiredFields?: string[];
|
|
700
|
+
optionalFields?: string[];
|
|
701
|
+
accountTypes?: string[];
|
|
702
|
+
bankAccountTypes?: string[];
|
|
703
|
+
supportedCorridors?: Array<Extra & {
|
|
704
|
+
countryIsoCode?: string;
|
|
705
|
+
currency?: string;
|
|
706
|
+
}>;
|
|
707
|
+
}
|
|
708
|
+
interface GlobalPayoutTransaction extends Extra {
|
|
709
|
+
transactionId?: string;
|
|
710
|
+
status?: Open<"PROCESSING" | "COMPLETED" | "FAILED" | "PENDING">;
|
|
711
|
+
coreStatus?: string;
|
|
712
|
+
type?: string;
|
|
713
|
+
createdAt?: string;
|
|
714
|
+
idempotencyKey?: string;
|
|
715
|
+
}
|
|
716
|
+
interface AuthorizeExchangeParams {
|
|
717
|
+
amount: number;
|
|
718
|
+
sourceCurrency: string;
|
|
719
|
+
destinationCurrency: string;
|
|
720
|
+
senderName: string;
|
|
721
|
+
receiverName: string;
|
|
722
|
+
sourceCountryIsoCode: string;
|
|
723
|
+
destinationCountryIsoCode: string;
|
|
724
|
+
narration?: string;
|
|
725
|
+
lockedExchangeRateId?: string;
|
|
726
|
+
/** Reuse the same key when retrying so Nomba can deduplicate. */
|
|
727
|
+
idempotencyKey?: string;
|
|
728
|
+
}
|
|
729
|
+
interface AuthorizeExchangeResult extends Extra {
|
|
730
|
+
wtTransactionId?: string;
|
|
731
|
+
coreTransactionId?: string;
|
|
732
|
+
status?: string;
|
|
733
|
+
coreStatus?: string;
|
|
734
|
+
type?: string;
|
|
735
|
+
idempotencyKey?: string;
|
|
736
|
+
idempotentReplay?: boolean;
|
|
737
|
+
}
|
|
738
|
+
interface ConvertMoneyParams {
|
|
739
|
+
amount: number;
|
|
740
|
+
currency: string;
|
|
741
|
+
destinationCurrency: string;
|
|
742
|
+
transactionType: string;
|
|
743
|
+
}
|
|
744
|
+
interface ConvertMoneyResult extends Extra {
|
|
745
|
+
fromAmount?: number;
|
|
746
|
+
fromCurrency?: string;
|
|
747
|
+
fromFormatted?: string;
|
|
748
|
+
toAmount?: number;
|
|
749
|
+
toCurrency?: string;
|
|
750
|
+
toFormatted?: string;
|
|
751
|
+
spreadAmount?: number;
|
|
752
|
+
spreadCurrency?: string;
|
|
753
|
+
exchangeRateId?: string;
|
|
754
|
+
currencyPairName?: string;
|
|
755
|
+
feeAmount?: number;
|
|
756
|
+
feeCurrency?: string;
|
|
757
|
+
}
|
|
758
|
+
interface AuthorizeTransferParams {
|
|
759
|
+
amount: number;
|
|
760
|
+
sourceCurrency: string;
|
|
761
|
+
destinationCurrency: string;
|
|
762
|
+
receiverName: string;
|
|
763
|
+
sourceCountryIsoCode: string;
|
|
764
|
+
destinationCountryIsoCode: string;
|
|
765
|
+
paymentMethod: Open<"BANK" | "MobileMoney" | "INTERAC" | "FASTER_PAYMENTS" | "SEPA" | "ACH" | "WIRE">;
|
|
766
|
+
accountNumber?: string;
|
|
767
|
+
institutionCode?: string;
|
|
768
|
+
institutionName?: string;
|
|
769
|
+
accountType: Open<"INDIVIDUAL" | "CORPORATE">;
|
|
770
|
+
bankAccountType?: Open<"CHECKING" | "SAVINGS">;
|
|
771
|
+
purposeOfPayment?: string;
|
|
772
|
+
narration?: string;
|
|
773
|
+
lockedExchangeRateId?: string;
|
|
774
|
+
/** Reuse the same key when retrying so Nomba can deduplicate. */
|
|
775
|
+
idempotencyKey?: string;
|
|
776
|
+
bankAddress?: string;
|
|
777
|
+
bankCity?: string;
|
|
778
|
+
bankState?: string;
|
|
779
|
+
bankZipCode?: string;
|
|
780
|
+
beneficiary?: {
|
|
781
|
+
beneficiaryEmail?: string;
|
|
782
|
+
securityQuestion?: string;
|
|
783
|
+
securityQuestionAnswer?: string;
|
|
784
|
+
transitNumber?: string;
|
|
785
|
+
beneficiaryAddress?: string;
|
|
786
|
+
beneficiaryCity?: string;
|
|
787
|
+
beneficiaryState?: string;
|
|
788
|
+
beneficiaryPostCode?: string;
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
interface AuthorizeTransferResult extends AuthorizeExchangeResult {
|
|
792
|
+
prettyStatus?: string;
|
|
793
|
+
meta?: Extra;
|
|
794
|
+
}
|
|
795
|
+
interface InitiateInflowParams {
|
|
796
|
+
phoneNumber: string;
|
|
797
|
+
callbackUrl: string;
|
|
798
|
+
amount: number;
|
|
799
|
+
currency: string;
|
|
800
|
+
/** Provider code from `globalCollection.listDrcProviders`. */
|
|
801
|
+
topupVendor: string;
|
|
802
|
+
/** Reuse the same key when retrying so Nomba can deduplicate. */
|
|
803
|
+
idempotencyKey?: string;
|
|
804
|
+
}
|
|
805
|
+
interface InitiateInflowResult extends Extra {
|
|
806
|
+
transactionReference?: string;
|
|
807
|
+
status?: string;
|
|
808
|
+
message?: string;
|
|
809
|
+
idempotencyKey?: string;
|
|
810
|
+
}
|
|
811
|
+
interface CollectionTransaction extends Extra {
|
|
812
|
+
transactionId?: string;
|
|
813
|
+
coreUserId?: string;
|
|
814
|
+
account?: string;
|
|
815
|
+
status?: Open<"PENDING" | "APPROVED" | "SUCCESS" | "FAILED" | "PENDING_APPROVAL">;
|
|
816
|
+
amount?: number;
|
|
817
|
+
currency?: string;
|
|
818
|
+
vendor?: string;
|
|
819
|
+
gatewayMessage?: string;
|
|
820
|
+
gatewayCode?: string;
|
|
821
|
+
}
|
|
822
|
+
interface WebhookEvent extends Extra {
|
|
823
|
+
event_type: string;
|
|
824
|
+
requestId: string;
|
|
825
|
+
data: Extra & {
|
|
826
|
+
merchant: Extra & {
|
|
827
|
+
userId?: string;
|
|
828
|
+
walletId?: string;
|
|
829
|
+
walletBalance?: number;
|
|
830
|
+
};
|
|
831
|
+
transaction: Extra & {
|
|
832
|
+
transactionId?: string;
|
|
833
|
+
type?: string;
|
|
834
|
+
time?: string;
|
|
835
|
+
responseCode?: string | null;
|
|
836
|
+
transactionAmount?: number;
|
|
837
|
+
fee?: number;
|
|
838
|
+
sessionId?: string;
|
|
839
|
+
merchantTxRef?: string;
|
|
840
|
+
narration?: string;
|
|
841
|
+
};
|
|
842
|
+
terminal?: Extra;
|
|
843
|
+
customer?: Extra;
|
|
844
|
+
order?: Extra;
|
|
845
|
+
tokenizedCardData?: Extra;
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/** Headers as a fetch `Headers` object or a plain object (e.g. Node's `req.headers`). */
|
|
850
|
+
type WebhookHeaders = {
|
|
851
|
+
get(name: string): string | null;
|
|
852
|
+
} | Record<string, string | string[] | undefined>;
|
|
853
|
+
interface VerifyWebhookOptions {
|
|
854
|
+
/**
|
|
855
|
+
* Reject events whose `nomba-timestamp` is more than this many seconds away from
|
|
856
|
+
* now (replay protection). Off by default.
|
|
857
|
+
*/
|
|
858
|
+
toleranceSeconds?: number;
|
|
859
|
+
/** Override the clock (for tests). */
|
|
860
|
+
now?: Date;
|
|
861
|
+
}
|
|
862
|
+
/** base64(HMAC-SHA256(signingKey, message)). */
|
|
863
|
+
declare function computeWebhookSignature(event: WebhookEvent, timestamp: string, signingKey: string): string;
|
|
864
|
+
/**
|
|
865
|
+
* Verify a Nomba webhook and return the parsed event. Throws
|
|
866
|
+
* {@link WebhookVerificationError} if the signature or payload is not valid.
|
|
867
|
+
*
|
|
868
|
+
* Pass the **raw** request body exactly as received. Re-serialising a parsed
|
|
869
|
+
* object can change it and break verification.
|
|
870
|
+
*/
|
|
871
|
+
declare function verifyWebhook(rawBody: string | Uint8Array | ArrayBuffer, headers: WebhookHeaders, signingKey: string, options?: VerifyWebhookOptions): WebhookEvent;
|
|
872
|
+
|
|
873
|
+
/** An access token as kept by a {@link TokenStore}. */
|
|
874
|
+
interface Token {
|
|
875
|
+
accessToken: string;
|
|
876
|
+
refreshToken: string;
|
|
877
|
+
/** RFC 3339 expiry time from Nomba's `expiresAt`. */
|
|
878
|
+
expiresAt: string;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Where the client keeps its access token. The default keeps it in memory.
|
|
882
|
+
* Implement this (e.g. over Redis) so several instances share one token:
|
|
883
|
+
* Nomba recommends a single authenticating instance.
|
|
884
|
+
*/
|
|
885
|
+
interface TokenStore {
|
|
886
|
+
get(): Token | null | Promise<Token | null>;
|
|
887
|
+
set(token: Token | null): void | Promise<void>;
|
|
888
|
+
}
|
|
889
|
+
/** Default token store: one token per client, held in memory. */
|
|
890
|
+
declare class InMemoryTokenStore implements TokenStore {
|
|
891
|
+
#private;
|
|
892
|
+
get(): Token | null;
|
|
893
|
+
set(token: Token | null): void;
|
|
894
|
+
toJSON(): Record<string, string>;
|
|
895
|
+
}
|
|
896
|
+
interface TokenResponse {
|
|
897
|
+
access_token?: unknown;
|
|
898
|
+
refresh_token?: unknown;
|
|
899
|
+
expiresAt?: unknown;
|
|
900
|
+
}
|
|
901
|
+
interface TokenManagerDeps {
|
|
902
|
+
store: TokenStore;
|
|
903
|
+
issue(): Promise<TokenResponse>;
|
|
904
|
+
refresh(refreshToken: string): Promise<TokenResponse>;
|
|
905
|
+
now?: () => number;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Lazily obtains tokens, refreshes them before they expire and makes sure
|
|
909
|
+
* concurrent callers share a single in-flight token request.
|
|
910
|
+
*/
|
|
911
|
+
declare class TokenManager {
|
|
912
|
+
#private;
|
|
913
|
+
constructor(deps: TokenManagerDeps);
|
|
914
|
+
/** Current access token, obtaining or refreshing one if needed. */
|
|
915
|
+
getAccessToken(): Promise<string>;
|
|
916
|
+
/** Drop the cached token, but only if it is still the one that failed. */
|
|
917
|
+
invalidate(failedAccessToken: string): Promise<void>;
|
|
918
|
+
current(): Promise<Token | null>;
|
|
919
|
+
clear(): Promise<void>;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Transaction statuses returned in `data.status`. The SDK never throws based on
|
|
924
|
+
* these: a 2xx response with a success `code` is returned as-is. See
|
|
925
|
+
* https://developer.nomba.com/docs/api-basics/response-codes
|
|
926
|
+
*/
|
|
927
|
+
declare const TransactionStatus: {
|
|
928
|
+
/** Service delivered to the destination. Do not refund. */
|
|
929
|
+
readonly SUCCESS: "SUCCESS";
|
|
930
|
+
/** Still processing. Wait for the webhook or requery. */
|
|
931
|
+
readonly PENDING_BILLING: "PENDING_BILLING";
|
|
932
|
+
/** Still processing (v1 endpoints). Wait for the webhook or requery. */
|
|
933
|
+
readonly PROCESSING: "PROCESSING";
|
|
934
|
+
/** Funds returned to your Nomba wallet. Refund your customer. */
|
|
935
|
+
readonly REFUND: "REFUND";
|
|
936
|
+
/** The transaction will not proceed. Contact Nomba support. */
|
|
937
|
+
readonly CANCELLED: "CANCELLED";
|
|
938
|
+
/** Debit failed; Nomba may retry. Wait for the webhook. */
|
|
939
|
+
readonly PAYMENT_FAILED: "PAYMENT_FAILED";
|
|
940
|
+
/** Nomba may retry via another vendor. Wait for the webhook. */
|
|
941
|
+
readonly REVERSED_BY_VENDOR: "REVERSED_BY_VENDOR";
|
|
942
|
+
};
|
|
943
|
+
type TransactionStatus = (typeof TransactionStatus)[keyof typeof TransactionStatus];
|
|
944
|
+
/** Webhook `event_type` values. */
|
|
945
|
+
declare const WebhookEventType: {
|
|
946
|
+
readonly PAYMENT_SUCCESS: "payment_success";
|
|
947
|
+
readonly PAYMENT_FAILED: "payment_failed";
|
|
948
|
+
readonly PAYMENT_REVERSAL: "payment_reversal";
|
|
949
|
+
readonly PAYOUT_SUCCESS: "payout_success";
|
|
950
|
+
readonly PAYOUT_FAILED: "payout_failed";
|
|
951
|
+
readonly PAYOUT_REFUND: "payout_refund";
|
|
952
|
+
};
|
|
953
|
+
type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
954
|
+
/** Envelope `code` values that mean success. */
|
|
955
|
+
declare const SUCCESS_CODES: readonly ["00", "200", "201"];
|
|
956
|
+
declare const BASE_URLS: {
|
|
957
|
+
readonly sandbox: "https://sandbox.nomba.com";
|
|
958
|
+
readonly production: "https://api.nomba.com";
|
|
959
|
+
};
|
|
960
|
+
type Environment = keyof typeof BASE_URLS;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Error hierarchy.
|
|
964
|
+
*
|
|
965
|
+
* NombaError
|
|
966
|
+
* ├── ApiError 2xx with a non-success `code`, or any HTTP error
|
|
967
|
+
* │ ├── AuthenticationError 401 after the token refresh retry, or token issue failed
|
|
968
|
+
* │ ├── PermissionDeniedError 403
|
|
969
|
+
* │ ├── NotFoundError 404
|
|
970
|
+
* │ ├── ValidationError 400, 422, and client-side validation
|
|
971
|
+
* │ ├── RateLimitError 429
|
|
972
|
+
* │ └── ServerError 5xx
|
|
973
|
+
* ├── ConnectionError network failure
|
|
974
|
+
* │ └── TimeoutError request timed out
|
|
975
|
+
* ├── WebhookVerificationError webhook signature or payload rejected
|
|
976
|
+
* └── ConfigurationError bad or missing client options
|
|
977
|
+
*
|
|
978
|
+
* Errors never carry credentials, tokens or request headers.
|
|
979
|
+
*/
|
|
980
|
+
/** The idempotency reference sent with a money-moving request. */
|
|
981
|
+
interface ErrorReference {
|
|
982
|
+
/** Which request field held the reference. */
|
|
983
|
+
readonly field: "merchantTxRef" | "orderReference";
|
|
984
|
+
/** The value sent: yours, or the one the SDK generated. */
|
|
985
|
+
readonly value: string;
|
|
986
|
+
}
|
|
987
|
+
declare class NombaError extends Error {
|
|
988
|
+
/**
|
|
989
|
+
* Set on errors from money-moving calls (`transfers.toBank`, `transfers.toWallet`,
|
|
990
|
+
* `bills.*` purchases, `checkout.chargeSavedCard`). After a timeout or connection
|
|
991
|
+
* error, requery with this reference before retrying, and retry with the same one.
|
|
992
|
+
*/
|
|
993
|
+
readonly reference: ErrorReference | undefined;
|
|
994
|
+
constructor(message: string, options?: {
|
|
995
|
+
cause?: unknown;
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
declare class ConfigurationError extends NombaError {
|
|
999
|
+
}
|
|
1000
|
+
declare class WebhookVerificationError extends NombaError {
|
|
1001
|
+
}
|
|
1002
|
+
declare class ConnectionError extends NombaError {
|
|
1003
|
+
/** HTTP method of the failed request. */
|
|
1004
|
+
readonly method: string | undefined;
|
|
1005
|
+
/** Request path, without query string. */
|
|
1006
|
+
readonly path: string | undefined;
|
|
1007
|
+
constructor(message: string, options?: {
|
|
1008
|
+
method?: string;
|
|
1009
|
+
path?: string;
|
|
1010
|
+
cause?: unknown;
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
declare class TimeoutError extends ConnectionError {
|
|
1014
|
+
}
|
|
1015
|
+
interface ApiErrorInit {
|
|
1016
|
+
/** HTTP status, or `null` for client-side validation errors. */
|
|
1017
|
+
httpStatus: number | null;
|
|
1018
|
+
code?: string | undefined;
|
|
1019
|
+
description?: string | undefined;
|
|
1020
|
+
body?: unknown;
|
|
1021
|
+
method?: string | undefined;
|
|
1022
|
+
path?: string | undefined;
|
|
1023
|
+
}
|
|
1024
|
+
declare class ApiError extends NombaError {
|
|
1025
|
+
/** HTTP status of the response, or `null` when the error was raised before sending. */
|
|
1026
|
+
readonly httpStatus: number | null;
|
|
1027
|
+
/** Nomba's `code` field from the response envelope, if present. */
|
|
1028
|
+
readonly code: string | undefined;
|
|
1029
|
+
/** Nomba's `description` (human-readable message), if present. */
|
|
1030
|
+
readonly description: string | undefined;
|
|
1031
|
+
/** Parsed response body. */
|
|
1032
|
+
readonly body: unknown;
|
|
1033
|
+
/** HTTP method of the request. */
|
|
1034
|
+
readonly method: string | undefined;
|
|
1035
|
+
/** Request path, without query string. */
|
|
1036
|
+
readonly path: string | undefined;
|
|
1037
|
+
constructor(init: ApiErrorInit, message?: string);
|
|
1038
|
+
/** `Nomba API error 400 (code "400"): <description> [POST /v2/transfers/bank]` */
|
|
1039
|
+
static formatMessage(init: ApiErrorInit): string;
|
|
1040
|
+
}
|
|
1041
|
+
declare class AuthenticationError extends ApiError {
|
|
1042
|
+
}
|
|
1043
|
+
declare class PermissionDeniedError extends ApiError {
|
|
1044
|
+
}
|
|
1045
|
+
declare class NotFoundError extends ApiError {
|
|
1046
|
+
}
|
|
1047
|
+
declare class ValidationError extends ApiError {
|
|
1048
|
+
/** Client-side validation error: nothing was sent. */
|
|
1049
|
+
static client(description: string): ValidationError;
|
|
1050
|
+
}
|
|
1051
|
+
interface RateLimitInfo {
|
|
1052
|
+
/** `X-Rate-Limit-Limit`: requests allowed in the current window. */
|
|
1053
|
+
limit?: string | undefined;
|
|
1054
|
+
/** `X-Rate-Limit-Remaining`: requests left in the current window. */
|
|
1055
|
+
remaining?: string | undefined;
|
|
1056
|
+
/** `X-Rate-Limit-Window`: the window, e.g. `1s`. */
|
|
1057
|
+
window?: string | undefined;
|
|
1058
|
+
}
|
|
1059
|
+
declare class RateLimitError extends ApiError {
|
|
1060
|
+
/** Seconds to wait, from the `Retry-After` header, if present. */
|
|
1061
|
+
readonly retryAfter: number | undefined;
|
|
1062
|
+
/** `X-Rate-Limit-*` header values. */
|
|
1063
|
+
readonly rateLimit: RateLimitInfo;
|
|
1064
|
+
constructor(init: ApiErrorInit & {
|
|
1065
|
+
retryAfter?: number;
|
|
1066
|
+
rateLimit?: RateLimitInfo;
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
declare class ServerError extends ApiError {
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
type QueryValue = string | number | boolean | null | undefined;
|
|
1073
|
+
type Query = Record<string, QueryValue>;
|
|
1074
|
+
|
|
1075
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
1076
|
+
interface RequestOptions {
|
|
1077
|
+
method: HttpMethod;
|
|
1078
|
+
/** Path starting with `/`, already validated and encoded. */
|
|
1079
|
+
path: string;
|
|
1080
|
+
query?: Query | undefined;
|
|
1081
|
+
body?: unknown;
|
|
1082
|
+
/**
|
|
1083
|
+
* Token endpoint request:
|
|
1084
|
+
* - `"obtain"` (issue/refresh): sent without a bearer token, retried like a GET,
|
|
1085
|
+
* and any 4xx other than 429 is an AuthenticationError.
|
|
1086
|
+
* - `"revoke"`: an ordinary authenticated request.
|
|
1087
|
+
* Both keep `data` out of error bodies, since it may hold tokens.
|
|
1088
|
+
*/
|
|
1089
|
+
token?: "obtain" | "revoke";
|
|
1090
|
+
/**
|
|
1091
|
+
* Idempotency reference of a money-moving request: added to the returned data if
|
|
1092
|
+
* missing, and attached to any error as `err.reference`.
|
|
1093
|
+
*/
|
|
1094
|
+
reference?: ErrorReference;
|
|
1095
|
+
}
|
|
1096
|
+
interface HttpClientConfig {
|
|
1097
|
+
baseUrl: string;
|
|
1098
|
+
accountId: string;
|
|
1099
|
+
timeout: number;
|
|
1100
|
+
maxRetries: number;
|
|
1101
|
+
fetch: typeof fetch;
|
|
1102
|
+
userAgent: string;
|
|
1103
|
+
}
|
|
1104
|
+
declare class HttpClient {
|
|
1105
|
+
#private;
|
|
1106
|
+
constructor(config: HttpClientConfig);
|
|
1107
|
+
setTokenManager(tokens: TokenManager): void;
|
|
1108
|
+
/** Make a request and return the unwrapped `data` of a successful envelope. */
|
|
1109
|
+
request<T>(opts: RequestOptions): Promise<T>;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
interface ResourceContext {
|
|
1113
|
+
http: HttpClient;
|
|
1114
|
+
environment: "sandbox" | "production";
|
|
1115
|
+
}
|
|
1116
|
+
declare abstract class Resource {
|
|
1117
|
+
protected readonly ctx: ResourceContext;
|
|
1118
|
+
constructor(ctx: ResourceContext);
|
|
1119
|
+
protected request<T>(opts: RequestOptions): Promise<T>;
|
|
1120
|
+
/** `path` + `/{subAccountId}` (when given) + `suffix`. */
|
|
1121
|
+
protected withSubAccount(path: string, subAccountId: string | undefined, suffix?: string): string;
|
|
1122
|
+
/**
|
|
1123
|
+
* Money-moving POST with a `merchantTxRef`: generate one if missing. The request
|
|
1124
|
+
* layer returns it on the result and attaches it to any error.
|
|
1125
|
+
*/
|
|
1126
|
+
protected withMerchantTxRef<T>(path: string, params: object, options?: SubAccountOption): Promise<T & {
|
|
1127
|
+
merchantTxRef: string;
|
|
1128
|
+
}>;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
declare class Accounts extends Resource {
|
|
1132
|
+
/** Parent account details. `GET /v1/accounts/parent` */
|
|
1133
|
+
getParent(): Promise<Account>;
|
|
1134
|
+
/** Balance of the parent account, or of a sub account. */
|
|
1135
|
+
getBalance(params?: GetBalanceParams): Promise<Balance>;
|
|
1136
|
+
/** Sub account details by `accountId` or `accountRef` (exactly one). */
|
|
1137
|
+
getSubAccount(params: GetSubAccountParams): Promise<Account>;
|
|
1138
|
+
/** One page of terminals on the parent account or a sub account. */
|
|
1139
|
+
listTerminals(params?: ListTerminalsParams): Promise<CursorPage<Terminal>>;
|
|
1140
|
+
/** Every terminal, across pages: `for await (const t of nomba.accounts.listAllTerminals())`. */
|
|
1141
|
+
listAllTerminals(params?: Omit<ListTerminalsParams, "cursor">): AsyncGenerator<Terminal>;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
declare class AuthResource extends Resource {
|
|
1145
|
+
#private;
|
|
1146
|
+
constructor(ctx: ResourceContext, tokens: TokenManager, clientId: string);
|
|
1147
|
+
/**
|
|
1148
|
+
* Revoke the cached access token (`POST /v1/auth/token/revoke`) and clear the
|
|
1149
|
+
* token store. Does nothing and returns `null` when no token is cached.
|
|
1150
|
+
*/
|
|
1151
|
+
revoke(): Promise<RevokeTokenResult | null>;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Bill payments. Purchases use the v2 endpoints, generate a `merchantTxRef` if
|
|
1156
|
+
* you don't pass one, and are never retried automatically.
|
|
1157
|
+
*/
|
|
1158
|
+
declare class Bills extends Resource {
|
|
1159
|
+
buyAirtime(params: BuyAirtimeParams, options?: SubAccountOption): Promise<BillPurchaseResult>;
|
|
1160
|
+
buyData(params: BuyDataParams, options?: SubAccountOption): Promise<BillPurchaseResult>;
|
|
1161
|
+
/** Data plans for a telco (e.g. `mtn`). The telco is lowercased. */
|
|
1162
|
+
listDataPlans(telco: string): Promise<DataPlan[]>;
|
|
1163
|
+
buyElectricity(params: BuyElectricityParams, options?: SubAccountOption): Promise<BillPurchaseResult>;
|
|
1164
|
+
/** Electricity distribution companies (discos). */
|
|
1165
|
+
listElectricityProviders(): Promise<unknown[]>;
|
|
1166
|
+
lookupElectricityCustomer(params: LookupElectricityCustomerParams): Promise<ElectricityCustomer>;
|
|
1167
|
+
payCableTv(params: PayCableTvParams, options?: SubAccountOption): Promise<BillPurchaseResult>;
|
|
1168
|
+
listCableTvPlans(cableTvType: CableTvType): Promise<CableTvPlan[]>;
|
|
1169
|
+
/** Returns the customer's name. */
|
|
1170
|
+
lookupCableTvCustomer(params: LookupCableTvCustomerParams): Promise<string>;
|
|
1171
|
+
fundBetting(params: FundBettingParams, options?: SubAccountOption): Promise<BillPurchaseResult>;
|
|
1172
|
+
listBettingProviders(): Promise<BettingProvider[]>;
|
|
1173
|
+
/** Returns the customer's name. */
|
|
1174
|
+
lookupBettingCustomer(params: LookupBettingCustomerParams): Promise<string>;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
declare class Checkout extends Resource {
|
|
1178
|
+
/** Create a hosted checkout order and get its `checkoutLink`. */
|
|
1179
|
+
createOrder(params: CreateOrderParams): Promise<CreateOrderResult>;
|
|
1180
|
+
getOrder(orderReference: string): Promise<GetOrderResult>;
|
|
1181
|
+
cancelOrder(params: OrderReferenceParams): Promise<SuccessMessage>;
|
|
1182
|
+
/** A checkout transaction by order ID or order reference. */
|
|
1183
|
+
getTransaction(params: GetCheckoutTransactionParams): Promise<CheckoutTransaction>;
|
|
1184
|
+
/** Refund a checkout transaction. Never retried automatically. */
|
|
1185
|
+
refund(params: RefundParams): Promise<SuccessMessage>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Charge a saved (tokenized) card. This endpoint has no `merchantTxRef`; its
|
|
1188
|
+
* reference is `order.orderReference`. If you omit it the SDK generates one
|
|
1189
|
+
* (UUID v4) and returns it as `orderReference`. Never retried automatically.
|
|
1190
|
+
*/
|
|
1191
|
+
chargeSavedCard(params: ChargeSavedCardParams): Promise<ChargeSavedCardResult>;
|
|
1192
|
+
/** Saved cards, filtered by customer email and/or date range (page-numbered). */
|
|
1193
|
+
listSavedCards(params?: ListSavedCardsParams): Promise<SavedCardList>;
|
|
1194
|
+
updateSavedCardEmail(params: UpdateSavedCardEmailParams): Promise<UpdateSavedCardEmailResult>;
|
|
1195
|
+
/** Delete a saved card. Sends a JSON body with DELETE. */
|
|
1196
|
+
deleteSavedCard(params: DeleteSavedCardParams): Promise<StatusMessage>;
|
|
1197
|
+
/** The bank account a customer can transfer to for this order. */
|
|
1198
|
+
getTransferAccount(orderReference: string): Promise<TransferAccount>;
|
|
1199
|
+
submitCardDetails(params: SubmitCardDetailsParams): Promise<SubmitCardDetailsResult>;
|
|
1200
|
+
submitCardOtp(params: SubmitCardOtpParams): Promise<SubmitCardOtpResult>;
|
|
1201
|
+
resendOtp(params: OrderReferenceParams): Promise<SuccessMessage>;
|
|
1202
|
+
confirmTransactionReceipt(params: OrderReferenceParams): Promise<ConfirmTransactionReceiptResult>;
|
|
1203
|
+
cancelTransaction(params: CancelTransactionParams): Promise<SuccessMessage>;
|
|
1204
|
+
/** Send an OTP to a customer who wants to save their card. */
|
|
1205
|
+
requestSaveCardOtp(params: RequestSaveCardOtpParams): Promise<SuccessMessage>;
|
|
1206
|
+
/** Send an OTP to a customer who already has saved cards. */
|
|
1207
|
+
requestSavedCardsOtp(params: OrderReferenceParams): Promise<SuccessMessage>;
|
|
1208
|
+
submitUserOtp(params: SubmitUserOtpParams): Promise<SuccessMessage>;
|
|
1209
|
+
/** The customer's saved cards for this order, after OTP verification. */
|
|
1210
|
+
getSavedCards(orderReference: string, params: GetSavedCardsParams): Promise<UserSavedCards>;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
declare class DirectDebits extends Resource {
|
|
1214
|
+
createMandate(params: CreateMandateParams): Promise<CreateMandateResult>;
|
|
1215
|
+
/** Debit a customer against an active mandate. Never retried automatically. */
|
|
1216
|
+
debitMandate(params: DebitMandateParams): Promise<DebitMandateResult>;
|
|
1217
|
+
getMandateStatus(mandateId: string): Promise<MandateStatus>;
|
|
1218
|
+
listMandates(params?: ListMandatesParams): Promise<MandateList>;
|
|
1219
|
+
updateMandateStatus(params: UpdateMandateStatusParams): Promise<UpdateMandateStatusResult>;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
declare class GlobalCollection extends Resource {
|
|
1223
|
+
/** Mobile-money providers for DRC inflows. */
|
|
1224
|
+
listDrcProviders(): Promise<Provider[]>;
|
|
1225
|
+
/** Start a mobile-money inflow. Never retried automatically. */
|
|
1226
|
+
initiateInflow(params: InitiateInflowParams): Promise<InitiateInflowResult>;
|
|
1227
|
+
getTransaction(transactionId: string): Promise<CollectionTransaction>;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/** Cross-border payouts. The sandbox uses separate paths for the account methods. */
|
|
1231
|
+
declare class GlobalPayout extends Resource {
|
|
1232
|
+
#private;
|
|
1233
|
+
listAccounts(): Promise<GlobalPayoutAccount[]>;
|
|
1234
|
+
getAccount(accountId: string): Promise<GlobalPayoutAccount>;
|
|
1235
|
+
listBankProviders(params?: ListBankProvidersParams): Promise<Provider[]>;
|
|
1236
|
+
getExchangeRates(params: GetExchangeRatesParams): Promise<ExchangeRates>;
|
|
1237
|
+
listPaymentMethods(params?: ListPaymentMethodsParams): Promise<PaymentMethod[]>;
|
|
1238
|
+
getTransaction(transactionId: string): Promise<GlobalPayoutTransaction>;
|
|
1239
|
+
/** Never retried automatically; pass an `idempotencyKey` and reuse it when retrying. */
|
|
1240
|
+
authorizeExchange(params: AuthorizeExchangeParams): Promise<AuthorizeExchangeResult>;
|
|
1241
|
+
convertMoney(params: ConvertMoneyParams): Promise<ConvertMoneyResult>;
|
|
1242
|
+
/** Never retried automatically; pass an `idempotencyKey` and reuse it when retrying. */
|
|
1243
|
+
authorizeTransfer(params: AuthorizeTransferParams): Promise<AuthorizeTransferResult>;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
declare class Terminals extends Resource {
|
|
1247
|
+
/** Assign a terminal to the parent account or a sub account. */
|
|
1248
|
+
assign(params: AssignTerminalParams, options?: SubAccountOption): Promise<Terminal>;
|
|
1249
|
+
/** Un-assign a terminal from the parent account or a sub account. */
|
|
1250
|
+
unassign(params: AssignTerminalParams, options?: SubAccountOption): Promise<Terminal>;
|
|
1251
|
+
/** Push a payment request to a terminal. */
|
|
1252
|
+
sendPaymentRequest(terminalId: string, params: TerminalPaymentRequestParams): Promise<TerminalPaymentRequestResult>;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
declare class Transactions extends Resource {
|
|
1256
|
+
#private;
|
|
1257
|
+
/** One page of transactions on the parent account or a sub account. */
|
|
1258
|
+
list(params?: ListTransactionsParams): Promise<CursorPage<Transaction>>;
|
|
1259
|
+
/** Every transaction, across pages: `for await (const tx of nomba.transactions.listAll())`. */
|
|
1260
|
+
listAll(params?: Omit<ListTransactionsParams, "cursor">): AsyncGenerator<Transaction>;
|
|
1261
|
+
/** One page of transactions matching `filters`. */
|
|
1262
|
+
filter(filters?: TransactionFilters, params?: ListTransactionsParams): Promise<CursorPage<Transaction>>;
|
|
1263
|
+
/** Every transaction matching `filters`, across pages. */
|
|
1264
|
+
filterAll(filters?: TransactionFilters, params?: Omit<ListTransactionsParams, "cursor">): AsyncGenerator<Transaction>;
|
|
1265
|
+
/** One transaction, by exactly one of `transactionRef`, `merchantTxRef`, `orderReference`, `orderId`. */
|
|
1266
|
+
get(params: GetTransactionParams): Promise<Transaction>;
|
|
1267
|
+
/** One page of credits/debits on the parent account. */
|
|
1268
|
+
listBankTransactions(params?: ListBankTransactionsParams): Promise<CursorPage<BankTransaction>>;
|
|
1269
|
+
/** Every credit/debit on the parent account, across pages. */
|
|
1270
|
+
listAllBankTransactions(params?: Omit<ListBankTransactionsParams, "cursor">): AsyncGenerator<BankTransaction>;
|
|
1271
|
+
/** Confirm a transaction's status by its NIP `sessionId`. */
|
|
1272
|
+
requery(sessionId: string): Promise<Transaction>;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
declare class Transfers extends Resource {
|
|
1276
|
+
/** Bank codes and names. */
|
|
1277
|
+
listBanks(): Promise<Bank[]>;
|
|
1278
|
+
/** Resolve the account name for an account number and bank code. */
|
|
1279
|
+
lookupAccount(params: LookupAccountParams): Promise<AccountLookupResult>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Transfer to a bank account. Never retried automatically. Pass your own
|
|
1282
|
+
* `merchantTxRef` (or keep the generated one from the result) to requery.
|
|
1283
|
+
*/
|
|
1284
|
+
toBank(params: BankTransferParams, options?: SubAccountOption): Promise<BankTransferResult>;
|
|
1285
|
+
/** Transfer to another Nomba wallet. Never retried automatically. */
|
|
1286
|
+
toWallet(params: WalletTransferParams, options?: SubAccountOption): Promise<WalletTransferResult>;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
declare class VirtualAccounts extends Resource {
|
|
1290
|
+
/** Create a virtual account on the parent account or a sub account. */
|
|
1291
|
+
create(params: CreateVirtualAccountParams, options?: SubAccountOption): Promise<VirtualAccount>;
|
|
1292
|
+
/** Fetch a virtual account by its account reference or number. */
|
|
1293
|
+
get(identifier: string): Promise<VirtualAccount>;
|
|
1294
|
+
update(identifier: string, params: UpdateVirtualAccountParams): Promise<UpdateVirtualAccountResult>;
|
|
1295
|
+
/** Expire (close) a virtual account. */
|
|
1296
|
+
expire(identifier: string): Promise<ExpireVirtualAccountResult>;
|
|
1297
|
+
/** One page of virtual accounts matching `filters`. */
|
|
1298
|
+
list(filters?: VirtualAccountFilters, options?: PageOptions): Promise<CursorPage<VirtualAccount>>;
|
|
1299
|
+
/** Every virtual account matching `filters`, across pages. */
|
|
1300
|
+
listAll(filters?: VirtualAccountFilters, options?: Omit<PageOptions, "cursor">): AsyncGenerator<VirtualAccount>;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
interface NombaOptions {
|
|
1304
|
+
/** Defaults to env `NOMBA_CLIENT_ID`. */
|
|
1305
|
+
clientId?: string;
|
|
1306
|
+
/** Defaults to env `NOMBA_CLIENT_SECRET`. */
|
|
1307
|
+
clientSecret?: string;
|
|
1308
|
+
/** Parent account ID, sent as the `accountId` header. Defaults to env `NOMBA_ACCOUNT_ID`. */
|
|
1309
|
+
accountId?: string;
|
|
1310
|
+
/** `"sandbox"` (default) or `"production"`. Defaults to env `NOMBA_ENVIRONMENT`. */
|
|
1311
|
+
environment?: Environment;
|
|
1312
|
+
/** Override the API base URL (tests, proxies). Must be https unless the host is localhost. */
|
|
1313
|
+
baseUrl?: string;
|
|
1314
|
+
/** Per-request timeout in milliseconds. Default 30000. */
|
|
1315
|
+
timeout?: number;
|
|
1316
|
+
/** Automatic retries for GET and token requests. Default 2. POST/PUT/DELETE are never retried. */
|
|
1317
|
+
maxRetries?: number;
|
|
1318
|
+
/** Where to keep the access token. Default: in memory. */
|
|
1319
|
+
tokenStore?: TokenStore;
|
|
1320
|
+
/** Custom `fetch` implementation. Default: the global `fetch`. */
|
|
1321
|
+
fetch?: typeof fetch;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Nomba API client.
|
|
1325
|
+
*
|
|
1326
|
+
* ```ts
|
|
1327
|
+
* const nomba = new Nomba(); // reads NOMBA_CLIENT_ID, NOMBA_CLIENT_SECRET, NOMBA_ACCOUNT_ID
|
|
1328
|
+
* const balance = await nomba.accounts.getBalance();
|
|
1329
|
+
* ```
|
|
1330
|
+
*/
|
|
1331
|
+
declare class Nomba {
|
|
1332
|
+
#private;
|
|
1333
|
+
/** Webhook verification without a client: `Nomba.webhooks.verify(rawBody, headers, key)`. */
|
|
1334
|
+
static readonly webhooks: {
|
|
1335
|
+
readonly verify: typeof verifyWebhook;
|
|
1336
|
+
readonly computeSignature: typeof computeWebhookSignature;
|
|
1337
|
+
};
|
|
1338
|
+
static readonly VERSION = "0.1.0";
|
|
1339
|
+
readonly environment: Environment;
|
|
1340
|
+
readonly baseUrl: string;
|
|
1341
|
+
readonly accountId: string;
|
|
1342
|
+
readonly auth: AuthResource;
|
|
1343
|
+
readonly accounts: Accounts;
|
|
1344
|
+
readonly virtualAccounts: VirtualAccounts;
|
|
1345
|
+
readonly checkout: Checkout;
|
|
1346
|
+
readonly transfers: Transfers;
|
|
1347
|
+
readonly transactions: Transactions;
|
|
1348
|
+
readonly terminals: Terminals;
|
|
1349
|
+
readonly directDebits: DirectDebits;
|
|
1350
|
+
readonly bills: Bills;
|
|
1351
|
+
readonly globalPayout: GlobalPayout;
|
|
1352
|
+
readonly globalCollection: GlobalCollection;
|
|
1353
|
+
readonly webhooks: {
|
|
1354
|
+
readonly verify: typeof verifyWebhook;
|
|
1355
|
+
readonly computeSignature: typeof computeWebhookSignature;
|
|
1356
|
+
};
|
|
1357
|
+
constructor(options?: NombaOptions);
|
|
1358
|
+
/** Safe summary: never includes the client secret or tokens. */
|
|
1359
|
+
toJSON(): Record<string, string>;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
/** SDK version. Kept in sync with package.json (checked by a unit test). */
|
|
1363
|
+
declare const VERSION = "0.1.0";
|
|
1364
|
+
|
|
1365
|
+
export { type Account, type AccountLookupResult, ApiError, type ApiErrorInit, type AssignTerminalParams, AuthenticationError, type AuthorizeExchangeParams, type AuthorizeExchangeResult, type AuthorizeTransferParams, type AuthorizeTransferResult, BASE_URLS, type Balance, type Bank, type BankTransaction, type BankTransferParams, type BankTransferResult, type BettingProvider, type BillPurchaseResult, type BuyAirtimeParams, type BuyDataParams, type BuyElectricityParams, type CableTvPlan, type CableTvType, type CancelTransactionParams, type ChargeSavedCardParams, type ChargeSavedCardResult, type CheckoutCurrency, type CheckoutOrder, type CheckoutOrderInput, type CheckoutTransaction, type CollectionTransaction, ConfigurationError, type ConfirmTransactionReceiptResult, ConnectionError, type ConvertMoneyParams, type ConvertMoneyResult, type CreateMandateParams, type CreateMandateResult, type CreateOrderParams, type CreateOrderResult, type CreateVirtualAccountParams, type CursorPage, type DataPlan, type DateRange, type DebitMandateParams, type DebitMandateResult, type DeleteSavedCardParams, type DeviceInformation, type ElectricityCustomer, type Environment, type ErrorReference, type ExchangeRates, type ExpireVirtualAccountResult, type Extra, type FundBettingParams, type GetBalanceParams, type GetCheckoutTransactionParams, type GetExchangeRatesParams, type GetOrderResult, type GetSavedCardsParams, type GetSubAccountParams, type GetTransactionParams, type GlobalPayoutAccount, type GlobalPayoutTransaction, InMemoryTokenStore, type InitiateInflowParams, type InitiateInflowResult, type ListBankProvidersParams, type ListBankTransactionsParams, type ListMandatesParams, type ListPaymentMethodsParams, type ListSavedCardsParams, type ListTerminalsParams, type ListTransactionsParams, type LookupAccountParams, type LookupBettingCustomerParams, type LookupCableTvCustomerParams, type LookupElectricityCustomerParams, type Mandate, type MandateFrequency, type MandateList, type MandateStatus, type MerchantTxRefOption, type Network, Nomba, NombaError, type NombaOptions, NotFoundError, type OrderReferenceParams, type PageOptions, type PayCableTvParams, type PaymentMethod, PermissionDeniedError, type Provider, RateLimitError, type RateLimitInfo, type RefundParams, type RequestSaveCardOtpParams, type RevokeTokenResult, SUCCESS_CODES, type SavedCard, type SavedCardList, ServerError, type SplitRequest, type StatusMessage, type SubAccountOption, type SubmitCardDetailsParams, type SubmitCardDetailsResult, type SubmitCardOtpParams, type SubmitCardOtpResult, type SubmitUserOtpParams, type SuccessMessage, type Terminal, type TerminalPaymentRequestParams, type TerminalPaymentRequestResult, TimeoutError, type Token, type TokenStore, type Transaction, type TransactionFilters, type TransactionSource, TransactionStatus, type TransactionStatusValue, type TransactionType, type TransferAccount, type UpdateMandateStatusParams, type UpdateMandateStatusResult, type UpdateSavedCardEmailParams, type UpdateSavedCardEmailResult, type UpdateVirtualAccountParams, type UpdateVirtualAccountResult, type UserSavedCards, VERSION, ValidationError, type VerifyWebhookOptions, type VirtualAccount, type VirtualAccountFilters, type WalletTransferParams, type WalletTransferResult, type WebhookEvent, WebhookEventType, type WebhookHeaders, WebhookVerificationError, computeWebhookSignature, Nomba as default, verifyWebhook };
|