@nomba/node-sdk 0.1.0 → 0.3.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.
Files changed (70) hide show
  1. package/README.md +31 -4
  2. package/dist/interfaces/v1/accounts/IAccountsService.d.ts +46 -8
  3. package/dist/interfaces/v1/betting/IBettingService.d.ts +11 -2
  4. package/dist/interfaces/v1/cable/ICableService.d.ts +12 -2
  5. package/dist/interfaces/v1/charge/IChargeService.d.ts +80 -19
  6. package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +64 -15
  7. package/dist/interfaces/v1/data/IDataService.d.ts +6 -1
  8. package/dist/interfaces/v1/direct-debits/IDirectDebitsService.d.ts +37 -14
  9. package/dist/interfaces/v1/electricity/IElectricityService.d.ts +11 -2
  10. package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.d.ts +20 -5
  11. package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.d.ts +74 -13
  12. package/dist/interfaces/v1/requery/IRequeryService.d.ts +19 -5
  13. package/dist/interfaces/v1/terminals/ITerminalsService.d.ts +43 -10
  14. package/dist/interfaces/v1/transactions/ITransactionsService.d.ts +71 -12
  15. package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.d.ts +50 -12
  16. package/dist/interfaces/v1/webhooks/IWebhooksService.d.ts +29 -10
  17. package/dist/interfaces/v2/airtime/IAirtimeV2Service.d.ts +21 -2
  18. package/dist/interfaces/v2/betting/IBettingV2Service.d.ts +21 -2
  19. package/dist/interfaces/v2/cable/ICableV2Service.d.ts +21 -2
  20. package/dist/interfaces/v2/data/IDataV2Service.d.ts +21 -2
  21. package/dist/interfaces/v2/electricity/IElectricityV2Service.d.ts +22 -2
  22. package/dist/interfaces/v2/transfers/ITransfersService.d.ts +57 -6
  23. package/dist/lib/outcome.d.ts +24 -5
  24. package/dist/lib/outcome.js +24 -5
  25. package/dist/lib/sdk-version.generated.d.ts +1 -1
  26. package/dist/lib/sdk-version.generated.js +1 -1
  27. package/dist/nomba.d.ts +38 -5
  28. package/dist/nomba.js +38 -5
  29. package/dist/services/http/http-client.service.d.ts +40 -6
  30. package/dist/services/http/http-client.service.js +40 -6
  31. package/dist/services/v1/accounts/accounts.service.d.ts +46 -8
  32. package/dist/services/v1/accounts/accounts.service.js +46 -8
  33. package/dist/services/v1/betting/betting.service.d.ts +11 -2
  34. package/dist/services/v1/betting/betting.service.js +11 -2
  35. package/dist/services/v1/cable/cable.service.d.ts +12 -2
  36. package/dist/services/v1/cable/cable.service.js +12 -2
  37. package/dist/services/v1/charge/charge.service.d.ts +80 -19
  38. package/dist/services/v1/charge/charge.service.js +88 -26
  39. package/dist/services/v1/checkout/checkout.service.d.ts +63 -15
  40. package/dist/services/v1/checkout/checkout.service.js +70 -24
  41. package/dist/services/v1/data/data.service.d.ts +7 -1
  42. package/dist/services/v1/data/data.service.js +7 -1
  43. package/dist/services/v1/direct-debits/direct-debits.service.d.ts +38 -14
  44. package/dist/services/v1/direct-debits/direct-debits.service.js +39 -17
  45. package/dist/services/v1/electricity/electricity.service.d.ts +12 -2
  46. package/dist/services/v1/electricity/electricity.service.js +12 -2
  47. package/dist/services/v1/globals/collections.service.d.ts +21 -5
  48. package/dist/services/v1/globals/collections.service.js +22 -5
  49. package/dist/services/v1/globals/payout.service.d.ts +73 -13
  50. package/dist/services/v1/globals/payout.service.js +74 -15
  51. package/dist/services/v1/terminals/terminals.service.d.ts +5 -5
  52. package/dist/services/v1/terminals/terminals.service.js +7 -18
  53. package/dist/services/v1/virtual-accounts/virtual-accounts.service.d.ts +4 -5
  54. package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +7 -8
  55. package/dist/services/v1/webhooks/webhooks.service.d.ts +3 -4
  56. package/dist/services/v1/webhooks/webhooks.service.js +7 -8
  57. package/dist/services/v2/airtime/airtime.service.d.ts +26 -2
  58. package/dist/services/v2/airtime/airtime.service.js +27 -7
  59. package/dist/services/v2/betting/betting.service.d.ts +27 -3
  60. package/dist/services/v2/betting/betting.service.js +28 -8
  61. package/dist/services/v2/cable/cable.service.d.ts +27 -3
  62. package/dist/services/v2/cable/cable.service.js +28 -8
  63. package/dist/services/v2/data/data.service.d.ts +26 -2
  64. package/dist/services/v2/data/data.service.js +27 -7
  65. package/dist/services/v2/electricity/electricity.service.d.ts +28 -3
  66. package/dist/services/v2/electricity/electricity.service.js +29 -8
  67. package/dist/services/v2/transfers/transfers.service.d.ts +51 -6
  68. package/dist/services/v2/transfers/transfers.service.js +55 -25
  69. package/dist/types/common/common.types.d.ts +9 -13
  70. package/package.json +1 -1
package/README.md CHANGED
@@ -223,6 +223,37 @@ A `status` of `PENDING_BILLING` means the transfer is still processing: wait for
223
223
  | `fetchSubAccountTransaction(subAccountId, lookup)` | `GET /v1/transactions/accounts/{subAccountId}/single` | |
224
224
  | `requeryBySession(sessionId)` | `GET /v1/transactions/requery/{sessionId}` | Bank transfers; wallet transfers have no session ID |
225
225
 
226
+ ### Bill lookups (version 1)
227
+
228
+ Provider lists, meter/customer lookups and data plans — no money moves here. Pay with the version 2 services below.
229
+
230
+ #### Electricity: `nomba.billElectricity` (`ElectricityService`)
231
+
232
+ | Method | Endpoint | Notes |
233
+ |---|---|---|
234
+ | `getElectricityProviders()` | `GET /v1/bill/electricity/discos` | |
235
+ | `lookupMeter(params)` | `GET /v1/bill/electricity/lookup` | |
236
+
237
+ #### Cable TV: `nomba.billCable` (`CableService`)
238
+
239
+ | Method | Endpoint | Notes |
240
+ |---|---|---|
241
+ | `getCablePlans(params)` | `GET /v1/bill/cableTvProduct` | |
242
+ | `lookupCustomer(params)` | `GET /v1/bill/cable/lookup` | |
243
+
244
+ #### Betting: `nomba.billBetting` (`BettingService`)
245
+
246
+ | Method | Endpoint | Notes |
247
+ |---|---|---|
248
+ | `getBettingProviders()` | `GET /v1/bill/betting/providers` | |
249
+ | `lookupCustomer(params)` | `GET /v1/bill/betting/lookup` | |
250
+
251
+ #### Data: `nomba.billData` (`DataService`)
252
+
253
+ | Method | Endpoint | Notes |
254
+ |---|---|---|
255
+ | `getDataPlans(telco)` | `GET /v1/bill/data-plan/{telco}` | |
256
+
226
257
  ### Electricity, cable TV and betting
227
258
 
228
259
  Each is its own product using **version 2** endpoints (payments only).
@@ -439,11 +470,7 @@ Methods that take outcome closures:
439
470
  | Resource | Methods | Success when |
440
471
  |---|---|---|
441
472
  | `transfers` | `bankTransfer`, `bankTransferFromSubAccount`, `walletTransfer`, `walletTransferFromSubAccount` | code `00`/`200`, status `SUCCESS` (`201` or `PENDING_BILLING` is pending) |
442
- | `v1.electricity`, `v1.cable`, `v1.betting` | `payElectricity`, `subscribeCableTv`, `payBetting` and their `…FromSubAccount` versions | code `00`, status `SUCCESS` (`PROCESSING` is pending) |
443
473
  | `electricity`, `cable`, `betting`, `airtime`, `data` (v2) | every payment and purchase method, and their `…FromSubAccount` versions | code `200`, status `SUCCESS` (`201` or `PENDING_BILLING` is pending) |
444
- | `v1.airtime` | `buyAirtime` | code `00`, status `SUCCESS` (`201`/`202` or `PROCESSING` is pending) |
445
- | `v1.airtime` | `buyAirtimeFromSubAccount` | code `00`, status `SUCCESS` (`PROCESSING` is pending; its page documents no `201`/`202`) |
446
- | `v1.data` | `buyData`, `buyDataFromSubAccount` | code `00`, status `SUCCESS` (`PROCESSING` is pending) |
447
474
  | `globalPayout` | `authorizeTransfer` | code `00`, status `COMPLETED` (`PROCESSING`, `PENDING` and `FAILED` are pending) |
448
475
  | `globalPayout` | `authorizeExchange` | code `00` |
449
476
  | `terminals` | `pushPaymentRequest` | code `00`, status `completed` (`pending` and `failed` are pending) |
@@ -5,20 +5,58 @@
5
5
  import type { AccountBalance, AccountDetails, SubAccountLookup } from "../../../types/v1/accounts/accounts.types.js";
6
6
  import type { Terminal, TerminalList, TerminalListParams } from "../../../types/v1/terminals/terminals.types.js";
7
7
  export interface IAccountsService {
8
- /** GET /v1/accounts/parent */
8
+ /**
9
+ * `GET /v1/accounts/parent`.
10
+ * @returns The parent account's details.
11
+ * @throws {NombaError} The call failed.
12
+ */
9
13
  getParentAccount(): Promise<AccountDetails>;
10
- /** GET /v1/accounts/balance */
14
+ /**
15
+ * `GET /v1/accounts/balance`.
16
+ * @returns The parent account's balance.
17
+ * @throws {NombaError} The call failed.
18
+ */
11
19
  getParentBalance(): Promise<AccountBalance>;
12
- /** GET /v1/accounts/sub-account-details */
20
+ /**
21
+ * `GET /v1/accounts/sub-account-details`.
22
+ * @param lookup Which sub account to fetch, by account ID or account number.
23
+ * @returns The sub account's details.
24
+ * @throws {NombaError} The call failed, e.g. no sub account matches `lookup`.
25
+ */
13
26
  getSubAccount(lookup?: SubAccountLookup): Promise<AccountDetails>;
14
- /** GET /v1/accounts/{subAccountId}/balance */
27
+ /**
28
+ * `GET /v1/accounts/{subAccountId}/balance`.
29
+ * @param subAccountId The sub account's ID.
30
+ * @returns The sub account's balance.
31
+ * @throws {NombaError} The call failed, e.g. `subAccountId` does not exist.
32
+ */
15
33
  getSubAccountBalance(subAccountId: string): Promise<AccountBalance>;
16
- /** GET /v1/accounts/terminals */
34
+ /**
35
+ * `GET /v1/accounts/terminals`.
36
+ * @param params Pagination (`cursor`, `size`) and other list filters.
37
+ * @returns One page of the parent account's terminals.
38
+ * @throws {NombaError} The call failed.
39
+ */
17
40
  listParentTerminals(params?: TerminalListParams): Promise<TerminalList>;
18
- /** GET /v1/accounts/{accountId}/terminals */
41
+ /**
42
+ * `GET /v1/accounts/{accountId}/terminals`.
43
+ * @param accountId The sub account's ID.
44
+ * @param params Pagination (`cursor`, `size`) and other list filters.
45
+ * @returns One page of the sub account's terminals.
46
+ * @throws {NombaError} The call failed, e.g. `accountId` does not exist.
47
+ */
19
48
  listSubAccountTerminals(accountId: string, params?: TerminalListParams): Promise<TerminalList>;
20
- /** Every terminal of the parent account, across all pages. */
49
+ /**
50
+ * Every terminal of the parent account, across all pages. Starts at `params.cursor` if given.
51
+ * @param params Starting cursor and other list filters.
52
+ * @throws {NombaError} A page request failed.
53
+ */
21
54
  iterateParentTerminals(params?: TerminalListParams): AsyncGenerator<Terminal>;
22
- /** Every terminal of a sub account, across all pages. */
55
+ /**
56
+ * Every terminal of a sub account, across all pages. Starts at `params.cursor` if given.
57
+ * @param accountId The sub account's ID.
58
+ * @param params Starting cursor and other list filters.
59
+ * @throws {NombaError} A page request failed, e.g. `accountId` does not exist.
60
+ */
23
61
  iterateSubAccountTerminals(accountId: string, params?: TerminalListParams): AsyncGenerator<Terminal>;
24
62
  }
@@ -4,8 +4,17 @@
4
4
  */
5
5
  import type { BettingCustomerLookupParams, BettingCustomerLookupResult, BettingProvidersResult } from "../../../types/v1/betting/betting.types.js";
6
6
  export interface IBettingService {
7
- /** GET /v1/bill/betting/providers - Fetch betting providers */
7
+ /**
8
+ * `GET /v1/bill/betting/providers`.
9
+ * @returns The supported betting providers.
10
+ * @throws {NombaError} The call failed.
11
+ */
8
12
  getBettingProviders(): Promise<BettingProvidersResult>;
9
- /** GET /v1/bill/betting/lookup - Validate customer and get name */
13
+ /**
14
+ * `GET /v1/bill/betting/lookup`. Validates a customer ID and returns the account name.
15
+ * @param params The provider and customer ID to look up.
16
+ * @returns The customer's account name.
17
+ * @throws {NombaError} The call failed, e.g. the customer ID is invalid.
18
+ */
10
19
  lookupCustomer(params: BettingCustomerLookupParams): Promise<BettingCustomerLookupResult>;
11
20
  }
@@ -4,8 +4,18 @@
4
4
  */
5
5
  import type { CableCustomerLookupParams, CableCustomerLookupResult, CablePlansParams, CablePlansResult } from "../../../types/v1/cable/cable.types.js";
6
6
  export interface ICableService {
7
- /** GET /v1/bill/cableTvProduct - Fetch cable TV plans */
7
+ /**
8
+ * `GET /v1/bill/cableTvProduct`.
9
+ * @param params The provider whose plans to fetch.
10
+ * @returns The provider's cable TV plans.
11
+ * @throws {NombaError} The call failed.
12
+ */
8
13
  getCablePlans(params: CablePlansParams): Promise<CablePlansResult>;
9
- /** GET /v1/bill/cable/lookup - Validate customer and get name */
14
+ /**
15
+ * `GET /v1/bill/cable/lookup`. Validates a smartcard number and returns the account name.
16
+ * @param params The provider and smartcard number to look up.
17
+ * @returns The customer's account name.
18
+ * @throws {NombaError} The call failed, e.g. the smartcard number is invalid.
19
+ */
10
20
  lookupCustomer(params: CableCustomerLookupParams): Promise<CableCustomerLookupResult>;
11
21
  }
@@ -2,32 +2,93 @@
2
2
  * @module nomba/interfaces/charge
3
3
  * @description Charge service contract
4
4
  */
5
- import type { RequestOptions } from "../../../types/common/common.types.js";
6
5
  import type { CancelChargeTransactionParams, ChargeOrder, ChargeTransactionDetails, FlashAccount, SaveCardOtpRequest, SubmitCardDetailsParams, SubmitCardDetailsResult, SubmitCardOtpParams, SubmitCardOtpResult, SubmitSaveCardOtpParams } from "../../../types/v1/charge/charge.types.js";
7
6
  import type { CheckoutResult, TokenizedCardData } from "../../../types/v1/checkout/checkout.types.js";
8
7
  export interface IChargeService {
9
- /** GET /v1/checkout/order/{orderReference} */
8
+ /**
9
+ * `GET /v1/checkout/order/{orderReference}`.
10
+ * @param orderReference The order's reference, from `nomba.checkout.createOrder`.
11
+ * @returns The order's details.
12
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
13
+ */
10
14
  getOrder(orderReference: string): Promise<ChargeOrder>;
11
- /** POST /v1/checkout/checkout-card-detail */
12
- submitCardDetails(params: SubmitCardDetailsParams, options?: RequestOptions): Promise<SubmitCardDetailsResult>;
13
- /** POST /v1/checkout/checkout-card-otp */
14
- submitCardOtp(params: SubmitCardOtpParams, options?: RequestOptions): Promise<SubmitCardOtpResult>;
15
- /** POST /v1/checkout/resend-otp. Resends the payment OTP to the customer's phone. */
16
- resendOtp(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
17
- /** POST /v1/checkout/confirm-transaction-receipt. The status after the OTP is submitted or a transfer is made. */
15
+ /**
16
+ * `POST /v1/checkout/checkout-card-detail`.
17
+ * @param params The order reference and card details to charge.
18
+ * @returns The result of submitting the card; an OTP is typically sent next.
19
+ * @throws {NombaError} The call failed, e.g. the card was declined.
20
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
21
+ */
22
+ submitCardDetails(params: SubmitCardDetailsParams): Promise<SubmitCardDetailsResult>;
23
+ /**
24
+ * `POST /v1/checkout/checkout-card-otp`.
25
+ * @param params The order reference and OTP the customer received.
26
+ * @returns The result of submitting the OTP.
27
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
28
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
29
+ */
30
+ submitCardOtp(params: SubmitCardOtpParams): Promise<SubmitCardOtpResult>;
31
+ /**
32
+ * `POST /v1/checkout/resend-otp`. Resends the payment OTP to the customer's phone.
33
+ * @param orderReference The order's reference.
34
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
35
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
36
+ */
37
+ resendOtp(orderReference: string): Promise<CheckoutResult>;
38
+ /**
39
+ * `POST /v1/checkout/confirm-transaction-receipt`. The status after the OTP is submitted or a transfer
40
+ * is made.
41
+ * @param orderReference The order's reference.
42
+ * @returns The transaction's current status.
43
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
44
+ */
18
45
  fetchTransactionDetails(orderReference: string): Promise<ChargeTransactionDetails>;
19
- /** GET /v1/checkout/get-checkout-kta/{orderReference}. A Flash account number the customer can pay by transfer. */
46
+ /**
47
+ * `GET /v1/checkout/get-checkout-kta/{orderReference}`. A Flash account number the customer can pay by
48
+ * transfer.
49
+ * @param orderReference The order's reference.
50
+ * @returns The Flash account to transfer payment to.
51
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
52
+ */
20
53
  fetchFlashAccount(orderReference: string): Promise<FlashAccount>;
21
- /** POST /v1/checkout/transaction/cancel. Cancels an incomplete checkout transaction. */
22
- cancelTransaction(params: CancelChargeTransactionParams, options?: RequestOptions): Promise<CheckoutResult>;
23
- /** POST /v1/checkout/user-card/saved-card/auth. Sends an OTP; use when getOrder says the user has saved cards. */
24
- requestSavedCardsOtp(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
25
- /** GET /v1/checkout/user-card/{orderReference}. Needs the OTP from requestSavedCardsOtp. */
54
+ /**
55
+ * `POST /v1/checkout/transaction/cancel`. Cancels an incomplete checkout transaction.
56
+ * @param params The order reference to cancel.
57
+ * @throws {NombaError} The call failed, e.g. the transaction already completed.
58
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
59
+ */
60
+ cancelTransaction(params: CancelChargeTransactionParams): Promise<CheckoutResult>;
61
+ /**
62
+ * `POST /v1/checkout/user-card/saved-card/auth`. Sends an OTP; use when `getOrder` says the user has
63
+ * saved cards.
64
+ * @param orderReference The order's reference.
65
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
66
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
67
+ */
68
+ requestSavedCardsOtp(orderReference: string): Promise<CheckoutResult>;
69
+ /**
70
+ * `GET /v1/checkout/user-card/{orderReference}`. Needs the OTP from `requestSavedCardsOtp`.
71
+ * @param orderReference The order's reference.
72
+ * @param otp The OTP sent by `requestSavedCardsOtp`.
73
+ * @returns The customer's saved, tokenized cards.
74
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
75
+ */
26
76
  getSavedCards(orderReference: string, otp: string): Promise<{
27
77
  tokenizedCardData?: TokenizedCardData[];
28
78
  }>;
29
- /** POST /v1/checkout/user-card/auth. Sends an OTP before saving a card; call after a successful payment. */
30
- requestSaveCardOtp(params: SaveCardOtpRequest, options?: RequestOptions): Promise<CheckoutResult>;
31
- /** POST /v1/checkout/user-card. Submits the OTP, which saves the card for later use. */
32
- submitSaveCardOtp(params: SubmitSaveCardOtpParams, options?: RequestOptions): Promise<CheckoutResult>;
79
+ /**
80
+ * `POST /v1/checkout/user-card/auth`. Sends an OTP before saving a card; call after a successful
81
+ * payment.
82
+ * @param params The order reference and card to save.
83
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
84
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
85
+ */
86
+ requestSaveCardOtp(params: SaveCardOtpRequest): Promise<CheckoutResult>;
87
+ /**
88
+ * `POST /v1/checkout/user-card`. Submits the OTP, which saves the card for later use.
89
+ * @param params The order reference and OTP from `requestSaveCardOtp`.
90
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
91
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
92
+ */
93
+ submitSaveCardOtp(params: SubmitSaveCardOtpParams): Promise<CheckoutResult>;
33
94
  }
@@ -2,29 +2,78 @@
2
2
  * @module nomba/interfaces/checkout
3
3
  * @description Checkout service contract
4
4
  */
5
- import type { CallOptions, RequestOptions } from "../../../types/common/common.types.js";
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
6
  import type { ChargeTokenizedCardParams, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
7
7
  export interface ICheckoutService {
8
8
  /**
9
- * POST /v1/checkout/order. Send the customer to `checkoutLink` to pay.
9
+ * `POST /v1/checkout/order`. Send the customer to `checkoutLink` to pay.
10
10
  * Verified against a real sandbox call to use /v1/checkout/order, not /sandbox/checkout/order as the
11
11
  * sandbox-testing guide claims (that path 404s); sandbox and production share this path.
12
+ * @param params The order to create; `order.orderReference` is the idempotency key.
13
+ * @returns The created order, including `checkoutLink`.
14
+ * @throws {NombaError} The call failed.
15
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
16
+ */
17
+ createOrder(params: CreateCheckoutOrderParams): Promise<CheckoutOrderCreated>;
18
+ /**
19
+ * `GET /v1/checkout/transaction`. Verified in sandbox; see the note on `createOrder`.
20
+ * @param params Which transaction to fetch, e.g. by `orderReference`.
21
+ * @returns The matching transaction.
22
+ * @throws {NombaError} The call failed, e.g. no transaction matches.
12
23
  */
13
- createOrder(params: CreateCheckoutOrderParams, options?: RequestOptions): Promise<CheckoutOrderCreated>;
14
- /** GET /v1/checkout/transaction. Verified in sandbox; see the note on createOrder. */
15
24
  fetchTransaction(params?: FetchCheckoutTransactionParams): Promise<CheckoutTransaction>;
16
- /** POST /v1/checkout/order/cancel. Only for orders not yet paid; use `refund` after payment. */
17
- cancelOrder(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
18
- /** POST /v1/checkout/refund. Verified in sandbox; see the note on createOrder. */
25
+ /**
26
+ * `POST /v1/checkout/order/cancel`. Only for orders not yet paid; use `refund` after payment.
27
+ * @param orderReference The order's reference (used as idempotency key).
28
+ * @throws {NombaError} The call failed, e.g. the order was already paid.
29
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
30
+ */
31
+ cancelOrder(orderReference: string): Promise<CheckoutResult>;
32
+ /**
33
+ * `POST /v1/checkout/refund`. Verified in sandbox; see the note on `createOrder`.
34
+ * @param params The transaction to refund; `transactionId` is the idempotency key.
35
+ * @param options Outcome handlers (`onSuccess`, `onPending`, `onFailed`).
36
+ * @returns The refund result, or the outcome `options` maps it to.
37
+ * @throws {NombaError} The call failed and is not retryable.
38
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
39
+ * @throws {UnconfirmedOutcomeError} The response was pending or undocumented and no `onPending` was supplied.
40
+ */
19
41
  refund<R = CheckoutResult>(params: RefundCheckoutTransactionParams, options?: CallOptions<CheckoutResult, R>): Promise<CheckoutResult | R>;
20
- /** POST /v1/checkout/tokenized-card-payment. Check `status` on the result: it says whether the charge went through. */
21
- chargeTokenizedCard(params: ChargeTokenizedCardParams, options?: RequestOptions): Promise<TokenizedCardResult>;
22
- /** GET /v1/checkout/tokenized-card-data */
42
+ /**
43
+ * `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
44
+ * went through.
45
+ * @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key.
46
+ * @returns The charge result.
47
+ * @throws {NombaError} The call failed, e.g. the token is invalid or expired.
48
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
49
+ */
50
+ chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<TokenizedCardResult>;
51
+ /**
52
+ * `GET /v1/checkout/tokenized-card-data`.
53
+ * @param params Pagination (`page`) and other list filters.
54
+ * @returns One page of the customer's saved, tokenized cards.
55
+ * @throws {NombaError} The call failed.
56
+ */
23
57
  listTokenizedCards(params?: ListTokenizedCardsParams): Promise<TokenizedCardList>;
24
- /** Every tokenized card matching the filters, across all pages. Starts at `params.page` if given. */
58
+ /**
59
+ * Every tokenized card matching the filters, across all pages. Starts at `params.page` if given.
60
+ * @param params Starting page and other list filters.
61
+ * @throws {NombaError} A page request failed.
62
+ */
25
63
  iterateTokenizedCards(params?: ListTokenizedCardsParams): AsyncGenerator<TokenizedCardData>;
26
- /** POST /v1/checkout/tokenized-card-data */
27
- updateTokenizedCard(params: UpdateTokenizedCardParams, options?: RequestOptions): Promise<UpdatedTokenizedCard>;
28
- /** DELETE /v1/checkout/tokenized-card-data */
29
- deleteTokenizedCard(tokenKey: string, options?: RequestOptions): Promise<TokenizedCardResult>;
64
+ /**
65
+ * `POST /v1/checkout/tokenized-card-data`.
66
+ * @param params The tokenized card's key and the fields to update; `tokenKey` is the idempotency key.
67
+ * @returns The updated tokenized card.
68
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
69
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
70
+ */
71
+ updateTokenizedCard(params: UpdateTokenizedCardParams): Promise<UpdatedTokenizedCard>;
72
+ /**
73
+ * `DELETE /v1/checkout/tokenized-card-data`.
74
+ * @param tokenKey The tokenized card's key (used as idempotency key).
75
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
76
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
77
+ */
78
+ deleteTokenizedCard(tokenKey: string): Promise<TokenizedCardResult>;
30
79
  }
@@ -4,6 +4,11 @@
4
4
  */
5
5
  import type { DataPlansResult } from "../../../types/v1/data/data.types.js";
6
6
  export interface IDataService {
7
- /** GET /v1/bill/data-plan/{telco} - Fetch data plans for a network */
7
+ /**
8
+ * `GET /v1/bill/data-plan/{telco}`.
9
+ * @param telco The telco network to list data plans for.
10
+ * @returns The available data plans for that telco.
11
+ * @throws {NombaError} `telco` is not a recognized network, or the request failed.
12
+ */
8
13
  getDataPlans(telco: string): Promise<DataPlansResult>;
9
14
  }
@@ -2,30 +2,53 @@
2
2
  * @module nomba/interfaces/direct-debits
3
3
  * @description DirectDebits service contract
4
4
  */
5
- import type { RequestOptions } from "../../../types/common/common.types.js";
6
5
  import type { CreatedMandate, CreateMandateParams, DebitMandateParams, ListMandatesParams, MandateDebitResult, MandatePage, MandateStatus, UpdatedMandateStatus, UpdateMandateStatusParams } from "../../../types/v1/direct-debits/direct-debits.types.js";
7
6
  export interface IDirectDebitsService {
8
7
  /**
9
- * POST /v1/direct-debits.
8
+ * `POST /v1/direct-debits`.
10
9
  * ponytail: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
11
10
  * other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
11
+ * @param params The mandate to create; `merchantReference` is the idempotency key.
12
+ * @returns The created mandate.
13
+ * @throws {NombaError} The mandate params were rejected.
14
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
15
+ * check the mandate status before retrying.
16
+ */
17
+ createMandate(params: CreateMandateParams): Promise<CreatedMandate>;
18
+ /**
19
+ * `GET /v1/direct-debits/status?mandateId={mandateId}`.
20
+ * @param mandateId The mandate to look up.
21
+ * @returns The mandate's current status.
22
+ * @throws {NombaError} `mandateId` is not found, or the request failed.
12
23
  */
13
- createMandate(params: CreateMandateParams, options?: RequestOptions): Promise<CreatedMandate>;
14
- /** GET /v1/direct-debits/status?mandateId={mandateId} */
15
24
  getMandateStatus(mandateId: string): Promise<MandateStatus>;
16
25
  /**
17
- * POST /v1/direct-debits/debit-mandate. Unlike createMandate, there is no per-transaction reference
18
- * field to default the idempotency key to (mandateId is stable across every debit on that mandate, so
19
- * defaulting to it would give every recurring debit the same key). Pass your own idempotencyKey if you
20
- * need retries deduplicated; otherwise the client generates a fresh one per call.
26
+ * `POST /v1/direct-debits/debit-mandate`. No per-transaction reference field exists in params, so a
27
+ * random idempotency key is generated for error tracking. If the outcome is unknown, requery the mandate
28
+ * before retrying.
29
+ * @param params The mandate to debit and the amount.
30
+ * @returns The debit result.
31
+ * @throws {NombaError} The mandate is not active, or the debit was rejected.
32
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
33
+ * check the mandate status before retrying.
34
+ */
35
+ debitMandate(params: DebitMandateParams): Promise<MandateDebitResult>;
36
+ /**
37
+ * `GET /v1/direct-debits/mandates`.
38
+ * @param params Pagination and filter params.
39
+ * @returns A page of mandates.
40
+ * @throws {NombaError} The request failed.
21
41
  */
22
- debitMandate(params: DebitMandateParams, options?: RequestOptions): Promise<MandateDebitResult>;
23
- /** GET /v1/direct-debits/mandates */
24
42
  listMandates(params: ListMandatesParams): Promise<MandatePage>;
25
43
  /**
26
- * PUT /v1/direct-debits/update-status. Same reasoning as debitMandate: mandateId is stable across every
27
- * status change on that mandate (SUSPEND, then ACTIVE, then SUSPEND again), so it is not a safe default
28
- * idempotency key. Pass your own if you need a retry deduplicated.
44
+ * `PUT /v1/direct-debits/update-status`. No per-change reference field exists in params, so a random
45
+ * idempotency key is generated for error tracking. If the outcome is unknown, check the mandate status
46
+ * before retrying.
47
+ * @param params The mandate and the new status.
48
+ * @returns The mandate's updated status.
49
+ * @throws {NombaError} The status transition is invalid, or the request failed.
50
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
51
+ * check the mandate status before retrying.
29
52
  */
30
- updateMandateStatus(params: UpdateMandateStatusParams, options?: RequestOptions): Promise<UpdatedMandateStatus>;
53
+ updateMandateStatus(params: UpdateMandateStatusParams): Promise<UpdatedMandateStatus>;
31
54
  }
@@ -4,8 +4,17 @@
4
4
  */
5
5
  import type { ElectricityProvidersResult, MeterLookupParams, MeterLookupResult } from "../../../types/v1/electricity/electricity.types.js";
6
6
  export interface IElectricityService {
7
- /** GET /v1/bill/electricity/discos - Fetch electricity providers */
7
+ /**
8
+ * `GET /v1/bill/electricity/discos`.
9
+ * @returns The electricity distribution companies (discos) available for meter lookup.
10
+ * @throws {NombaError} The request failed.
11
+ */
8
12
  getElectricityProviders(): Promise<ElectricityProvidersResult>;
9
- /** GET /v1/bill/electricity/lookup - Validate meter and get customer name */
13
+ /**
14
+ * `GET /v1/bill/electricity/lookup`.
15
+ * @param params The disco and meter number to look up.
16
+ * @returns The meter's customer details.
17
+ * @throws {NombaError} The meter number is invalid or not found, or the request failed.
18
+ */
10
19
  lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
11
20
  }
@@ -2,13 +2,28 @@
2
2
  * @module nomba/interfaces/global-collections
3
3
  * @description GlobalCollections service contract
4
4
  */
5
- import type { RequestOptions } from "../../../../types/common/common.types.js";
6
5
  import type { CollectionTransaction, InflowProvider, InflowResult, InitiateInflowParams } from "../../../../types/v1/globals/collections.types.js";
7
6
  export interface IGlobalCollectionsService {
8
- /** GET /v1/global-collection/drc/inflow/providers */
7
+ /**
8
+ * `GET /v1/global-collection/drc/inflow/providers`.
9
+ * @returns The mobile money providers available for DRC inflows.
10
+ * @throws {NombaError} The request failed.
11
+ */
9
12
  inflowProviders(): Promise<InflowProvider[]>;
10
- /** POST /v1/global-collection/inflow/initiate. Prompts the customer to approve the charge on their phone. */
11
- initiateInflow(params: InitiateInflowParams, options?: RequestOptions): Promise<InflowResult>;
12
- /** GET /v1/global-collection/transactions/{transactionId}, with the `transactionReference` from `initiateInflow`. */
13
+ /**
14
+ * `POST /v1/global-collection/inflow/initiate`. Prompts the customer to approve the charge on their phone.
15
+ * @param params The inflow to initiate; `idempotencyKey` defaults to a generated one.
16
+ * @returns The initiated inflow, including its `transactionReference`.
17
+ * @throws {NombaError} The inflow params were rejected.
18
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
19
+ * check the transaction status before retrying.
20
+ */
21
+ initiateInflow(params: InitiateInflowParams): Promise<InflowResult>;
22
+ /**
23
+ * `GET /v1/global-collection/transactions/{transactionId}`, with the `transactionReference` from `initiateInflow`.
24
+ * @param transactionId The transaction reference to look up.
25
+ * @returns The transaction's current state.
26
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
27
+ */
13
28
  getTransaction(transactionId: string): Promise<CollectionTransaction>;
14
29
  }
@@ -2,29 +2,90 @@
2
2
  * @module nomba/interfaces/global-payout
3
3
  * @description GlobalPayout service contract
4
4
  */
5
- import type { CallOptions, RequestOptions } from "../../../../types/common/common.types.js";
5
+ import type { CallOptions } from "../../../../types/common/common.types.js";
6
6
  import type { AuthorizeExchangeParams, AuthorizeTransferParams, Conversion, ConvertMoneyParams, ExchangeRate, ExchangeRatesParams, InstitutionProvider, InstitutionProvidersParams, PaymentMethodInfo, PaymentMethodsParams, PayoutAccount, PayoutResult, PayoutTransaction } from "../../../../types/v1/globals/payout.types.js";
7
7
  export interface IGlobalPayoutService {
8
- /** GET /v1/global-payout/accounts. Every currency wallet with its balance. */
8
+ /**
9
+ * `GET /v1/global-payout/accounts`.
10
+ * @returns Every currency wallet, with its balance.
11
+ * @throws {NombaError} The request failed.
12
+ */
9
13
  listAccounts(): Promise<PayoutAccount[]>;
10
- /** GET /v1/global-payout/accounts/{accountId}. A 404 means the id is not one of your wallets. */
14
+ /**
15
+ * `GET /v1/global-payout/accounts/{accountId}`.
16
+ * @param accountId The wallet to look up.
17
+ * @returns The wallet's details and balance.
18
+ * @throws {NombaError} `accountId` is not one of your wallets (404), or the request failed.
19
+ */
11
20
  getAccount(accountId: string): Promise<PayoutAccount>;
12
- /** GET /v1/sandbox/global-payout/accounts. Canned test data. */
21
+ /**
22
+ * `GET /v1/sandbox/global-payout/accounts`.
23
+ * @returns Canned test wallet data.
24
+ * @throws {NombaError} The request failed.
25
+ */
13
26
  listSandboxAccounts(): Promise<PayoutAccount[]>;
14
- /** GET /v1/sandbox/global-payout/accounts/{accountId}. Canned test data; any id is echoed back. */
27
+ /**
28
+ * `GET /v1/sandbox/global-payout/accounts/{accountId}`. Canned test data; any id is echoed back.
29
+ * @param accountId The wallet id to echo back in the canned response.
30
+ * @returns Canned test wallet data for that id.
31
+ * @throws {NombaError} The request failed.
32
+ */
15
33
  getSandboxAccount(accountId: string): Promise<PayoutAccount>;
16
- /** GET /v1/global-payout/exchange-rates */
34
+ /**
35
+ * `GET /v1/global-payout/exchange-rates`.
36
+ * @param params The currency pair to get a rate for.
37
+ * @returns The matching exchange rates.
38
+ * @throws {NombaError} The request failed.
39
+ */
17
40
  exchangeRates(params: ExchangeRatesParams): Promise<ExchangeRate[]>;
18
- /** POST /v1/global-payout/money/convert. A calculation only; no money moves. */
19
- convert(params: ConvertMoneyParams, options?: RequestOptions): Promise<Conversion>;
20
- /** GET /v1/global-payout/bank/providers */
41
+ /**
42
+ * `POST /v1/global-payout/money/convert`. A calculation only; no money moves.
43
+ * @param params The amount and currency pair to convert.
44
+ * @returns The converted amount and rate used.
45
+ * @throws {NombaError} The request failed.
46
+ */
47
+ convert(params: ConvertMoneyParams): Promise<Conversion>;
48
+ /**
49
+ * `GET /v1/global-payout/bank/providers`.
50
+ * @param params Filters, e.g. by country or currency.
51
+ * @returns The receiving institutions available for payout.
52
+ * @throws {NombaError} The request failed.
53
+ */
21
54
  institutionProviders(params?: InstitutionProvidersParams): Promise<InstitutionProvider[]>;
22
- /** GET /v1/global-payout/payment-methods */
55
+ /**
56
+ * `GET /v1/global-payout/payment-methods`.
57
+ * @param params Filters, e.g. by country or currency.
58
+ * @returns The payment methods available for payout.
59
+ * @throws {NombaError} The request failed.
60
+ */
23
61
  paymentMethods(params?: PaymentMethodsParams): Promise<PaymentMethodInfo[]>;
24
- /** POST /v1/global-payout/transfer/authorize. Sends money cross-border. */
62
+ /**
63
+ * `POST /v1/global-payout/transfer/authorize`. Sends money cross-border.
64
+ * @param params The transfer to authorize; `idempotencyKey` defaults to a generated one.
65
+ * @param options Per-call overrides, including `idempotencyKey` and the `onSuccess`/`onPending`/`onFailed`
66
+ * outcome handlers.
67
+ * @returns The settled payout result (or the type `options` maps it to).
68
+ * @throws {NombaError} The transfer was rejected.
69
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
70
+ * @throws {UnconfirmedOutcomeError} The response was pending or undocumented and no `onPending` was supplied.
71
+ */
25
72
  authorizeTransfer<R = PayoutResult>(params: AuthorizeTransferParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
26
- /** POST /v1/global-payout/exchange/authorize. Moves money between your own wallets in different currencies. */
73
+ /**
74
+ * `POST /v1/global-payout/exchange/authorize`. Moves money between your own wallets in different currencies.
75
+ * @param params The exchange to authorize; `idempotencyKey` defaults to a generated one.
76
+ * @param options Per-call overrides, including `idempotencyKey` and the `onSuccess`/`onPending`/`onFailed`
77
+ * outcome handlers.
78
+ * @returns The settled payout result (or the type `options` maps it to).
79
+ * @throws {NombaError} The exchange was rejected.
80
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
81
+ * @throws {UnconfirmedOutcomeError} The response was pending or undocumented and no `onPending` was supplied.
82
+ */
27
83
  authorizeExchange<R = PayoutResult>(params: AuthorizeExchangeParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
28
- /** GET /v1/global-payout/transactions/{transactionId}, with a `wtTransactionId`. */
84
+ /**
85
+ * `GET /v1/global-payout/transactions/{transactionId}`, with a `wtTransactionId`.
86
+ * @param transactionId The transaction to look up.
87
+ * @returns The transaction's current state.
88
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
89
+ */
29
90
  getTransaction(transactionId: string): Promise<PayoutTransaction>;
30
91
  }