@nomba/node-sdk 0.0.0-stage → 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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +577 -2
  3. package/dist/index.d.ts +86 -0
  4. package/dist/index.js +53 -0
  5. package/dist/interfaces/http/IHttpClient.d.ts +17 -0
  6. package/dist/interfaces/http/IHttpClient.js +5 -0
  7. package/dist/interfaces/http/index.d.ts +1 -0
  8. package/dist/interfaces/http/index.js +1 -0
  9. package/dist/interfaces/v1/accounts/IAccountsService.d.ts +62 -0
  10. package/dist/interfaces/v1/accounts/IAccountsService.js +5 -0
  11. package/dist/interfaces/v1/accounts/index.d.ts +1 -0
  12. package/dist/interfaces/v1/accounts/index.js +1 -0
  13. package/dist/interfaces/v1/betting/IBettingService.d.ts +20 -0
  14. package/dist/interfaces/v1/betting/IBettingService.js +5 -0
  15. package/dist/interfaces/v1/betting/index.d.ts +1 -0
  16. package/dist/interfaces/v1/betting/index.js +1 -0
  17. package/dist/interfaces/v1/cable/ICableService.d.ts +21 -0
  18. package/dist/interfaces/v1/cable/ICableService.js +5 -0
  19. package/dist/interfaces/v1/cable/index.d.ts +1 -0
  20. package/dist/interfaces/v1/cable/index.js +1 -0
  21. package/dist/interfaces/v1/charge/IChargeService.d.ts +94 -0
  22. package/dist/interfaces/v1/charge/IChargeService.js +5 -0
  23. package/dist/interfaces/v1/charge/index.d.ts +1 -0
  24. package/dist/interfaces/v1/charge/index.js +1 -0
  25. package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +79 -0
  26. package/dist/interfaces/v1/checkout/ICheckoutService.js +5 -0
  27. package/dist/interfaces/v1/checkout/index.d.ts +1 -0
  28. package/dist/interfaces/v1/checkout/index.js +1 -0
  29. package/dist/interfaces/v1/data/IDataService.d.ts +14 -0
  30. package/dist/interfaces/v1/data/IDataService.js +5 -0
  31. package/dist/interfaces/v1/data/index.d.ts +1 -0
  32. package/dist/interfaces/v1/data/index.js +1 -0
  33. package/dist/interfaces/v1/direct-debits/IDirectDebitsService.d.ts +54 -0
  34. package/dist/interfaces/v1/direct-debits/IDirectDebitsService.js +5 -0
  35. package/dist/interfaces/v1/direct-debits/index.d.ts +1 -0
  36. package/dist/interfaces/v1/direct-debits/index.js +1 -0
  37. package/dist/interfaces/v1/electricity/IElectricityService.d.ts +20 -0
  38. package/dist/interfaces/v1/electricity/IElectricityService.js +5 -0
  39. package/dist/interfaces/v1/electricity/index.d.ts +1 -0
  40. package/dist/interfaces/v1/electricity/index.js +1 -0
  41. package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.d.ts +29 -0
  42. package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.js +5 -0
  43. package/dist/interfaces/v1/globals/collections/index.d.ts +1 -0
  44. package/dist/interfaces/v1/globals/collections/index.js +1 -0
  45. package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.d.ts +91 -0
  46. package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.js +5 -0
  47. package/dist/interfaces/v1/globals/payouts/index.d.ts +1 -0
  48. package/dist/interfaces/v1/globals/payouts/index.js +1 -0
  49. package/dist/interfaces/v1/requery/IRequeryService.d.ts +31 -0
  50. package/dist/interfaces/v1/requery/IRequeryService.js +5 -0
  51. package/dist/interfaces/v1/requery/index.d.ts +1 -0
  52. package/dist/interfaces/v1/requery/index.js +1 -0
  53. package/dist/interfaces/v1/terminals/ITerminalsService.d.ts +51 -0
  54. package/dist/interfaces/v1/terminals/ITerminalsService.js +5 -0
  55. package/dist/interfaces/v1/terminals/index.d.ts +1 -0
  56. package/dist/interfaces/v1/terminals/index.js +1 -0
  57. package/dist/interfaces/v1/transactions/ITransactionsService.d.ts +93 -0
  58. package/dist/interfaces/v1/transactions/ITransactionsService.js +5 -0
  59. package/dist/interfaces/v1/transactions/index.d.ts +1 -0
  60. package/dist/interfaces/v1/transactions/index.js +1 -0
  61. package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.d.ts +65 -0
  62. package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.js +5 -0
  63. package/dist/interfaces/v1/virtual-accounts/index.d.ts +1 -0
  64. package/dist/interfaces/v1/virtual-accounts/index.js +1 -0
  65. package/dist/interfaces/v1/webhooks/IWebhooksService.d.ts +40 -0
  66. package/dist/interfaces/v1/webhooks/IWebhooksService.js +5 -0
  67. package/dist/interfaces/v1/webhooks/index.d.ts +1 -0
  68. package/dist/interfaces/v1/webhooks/index.js +1 -0
  69. package/dist/interfaces/v2/airtime/IAirtimeV2Service.d.ts +31 -0
  70. package/dist/interfaces/v2/airtime/IAirtimeV2Service.js +5 -0
  71. package/dist/interfaces/v2/airtime/index.d.ts +1 -0
  72. package/dist/interfaces/v2/airtime/index.js +1 -0
  73. package/dist/interfaces/v2/betting/IBettingV2Service.d.ts +31 -0
  74. package/dist/interfaces/v2/betting/IBettingV2Service.js +5 -0
  75. package/dist/interfaces/v2/betting/index.d.ts +1 -0
  76. package/dist/interfaces/v2/betting/index.js +1 -0
  77. package/dist/interfaces/v2/cable/ICableV2Service.d.ts +31 -0
  78. package/dist/interfaces/v2/cable/ICableV2Service.js +5 -0
  79. package/dist/interfaces/v2/cable/index.d.ts +1 -0
  80. package/dist/interfaces/v2/cable/index.js +1 -0
  81. package/dist/interfaces/v2/data/IDataV2Service.d.ts +31 -0
  82. package/dist/interfaces/v2/data/IDataV2Service.js +5 -0
  83. package/dist/interfaces/v2/data/index.d.ts +1 -0
  84. package/dist/interfaces/v2/data/index.js +1 -0
  85. package/dist/interfaces/v2/electricity/IElectricityV2Service.d.ts +32 -0
  86. package/dist/interfaces/v2/electricity/IElectricityV2Service.js +5 -0
  87. package/dist/interfaces/v2/electricity/index.d.ts +1 -0
  88. package/dist/interfaces/v2/electricity/index.js +1 -0
  89. package/dist/interfaces/v2/transfers/ITransfersService.d.ts +71 -0
  90. package/dist/interfaces/v2/transfers/ITransfersService.js +5 -0
  91. package/dist/interfaces/v2/transfers/index.d.ts +1 -0
  92. package/dist/interfaces/v2/transfers/index.js +1 -0
  93. package/dist/lib/errors.d.ts +62 -0
  94. package/dist/lib/errors.js +92 -0
  95. package/dist/lib/outcome.d.ts +37 -0
  96. package/dist/lib/outcome.js +126 -0
  97. package/dist/lib/paginate.d.ts +21 -0
  98. package/dist/lib/paginate.js +25 -0
  99. package/dist/lib/sdk-version.d.ts +5 -0
  100. package/dist/lib/sdk-version.generated.d.ts +1 -0
  101. package/dist/lib/sdk-version.generated.js +1 -0
  102. package/dist/lib/sdk-version.js +5 -0
  103. package/dist/lib/token-store.d.ts +49 -0
  104. package/dist/lib/token-store.js +26 -0
  105. package/dist/lib/util.d.ts +31 -0
  106. package/dist/lib/util.js +31 -0
  107. package/dist/lib/webhooks.d.ts +43 -0
  108. package/dist/lib/webhooks.js +64 -0
  109. package/dist/nomba.d.ts +96 -0
  110. package/dist/nomba.js +130 -0
  111. package/dist/services/http/http-client.service.d.ts +61 -0
  112. package/dist/services/http/http-client.service.js +351 -0
  113. package/dist/services/v1/accounts/accounts.service.d.ts +76 -0
  114. package/dist/services/v1/accounts/accounts.service.js +96 -0
  115. package/dist/services/v1/betting/betting.service.d.ts +25 -0
  116. package/dist/services/v1/betting/betting.service.js +30 -0
  117. package/dist/services/v1/cable/cable.service.d.ts +26 -0
  118. package/dist/services/v1/cable/cable.service.js +33 -0
  119. package/dist/services/v1/charge/charge.service.d.ts +113 -0
  120. package/dist/services/v1/charge/charge.service.js +161 -0
  121. package/dist/services/v1/checkout/checkout.service.d.ts +92 -0
  122. package/dist/services/v1/checkout/checkout.service.js +146 -0
  123. package/dist/services/v1/data/data.service.d.ts +20 -0
  124. package/dist/services/v1/data/data.service.js +22 -0
  125. package/dist/services/v1/direct-debits/direct-debits.service.d.ts +69 -0
  126. package/dist/services/v1/direct-debits/direct-debits.service.js +91 -0
  127. package/dist/services/v1/electricity/electricity.service.d.ts +26 -0
  128. package/dist/services/v1/electricity/electricity.service.js +31 -0
  129. package/dist/services/v1/globals/collections.service.d.ts +44 -0
  130. package/dist/services/v1/globals/collections.service.js +55 -0
  131. package/dist/services/v1/globals/payout.service.d.ts +105 -0
  132. package/dist/services/v1/globals/payout.service.js +154 -0
  133. package/dist/services/v1/requery/requery.service.d.ts +31 -0
  134. package/dist/services/v1/requery/requery.service.js +41 -0
  135. package/dist/services/v1/terminals/terminals.service.d.ts +38 -0
  136. package/dist/services/v1/terminals/terminals.service.js +58 -0
  137. package/dist/services/v1/transactions/transactions.service.d.ts +48 -0
  138. package/dist/services/v1/transactions/transactions.service.js +98 -0
  139. package/dist/services/v1/virtual-accounts/virtual-accounts.service.d.ts +40 -0
  140. package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +55 -0
  141. package/dist/services/v1/webhooks/webhooks.service.d.ts +35 -0
  142. package/dist/services/v1/webhooks/webhooks.service.js +59 -0
  143. package/dist/services/v2/airtime/airtime.service.d.ts +42 -0
  144. package/dist/services/v2/airtime/airtime.service.js +55 -0
  145. package/dist/services/v2/betting/betting.service.d.ts +43 -0
  146. package/dist/services/v2/betting/betting.service.js +56 -0
  147. package/dist/services/v2/cable/cable.service.d.ts +43 -0
  148. package/dist/services/v2/cable/cable.service.js +56 -0
  149. package/dist/services/v2/data/data.service.d.ts +42 -0
  150. package/dist/services/v2/data/data.service.js +55 -0
  151. package/dist/services/v2/electricity/electricity.service.d.ts +44 -0
  152. package/dist/services/v2/electricity/electricity.service.js +57 -0
  153. package/dist/services/v2/transfers/transfers.service.d.ts +75 -0
  154. package/dist/services/v2/transfers/transfers.service.js +97 -0
  155. package/dist/types/common/common.types.d.ts +74 -0
  156. package/dist/types/common/common.types.js +5 -0
  157. package/dist/types/common/outcome.types.d.ts +53 -0
  158. package/dist/types/common/outcome.types.js +5 -0
  159. package/dist/types/v1/accounts/accounts.types.d.ts +37 -0
  160. package/dist/types/v1/accounts/accounts.types.js +8 -0
  161. package/dist/types/v1/betting/betting.types.d.ts +26 -0
  162. package/dist/types/v1/betting/betting.types.js +5 -0
  163. package/dist/types/v1/cable/cable.types.d.ts +24 -0
  164. package/dist/types/v1/cable/cable.types.js +5 -0
  165. package/dist/types/v1/charge/charge.types.d.ts +102 -0
  166. package/dist/types/v1/charge/charge.types.js +5 -0
  167. package/dist/types/v1/checkout/checkout.types.d.ts +139 -0
  168. package/dist/types/v1/checkout/checkout.types.js +5 -0
  169. package/dist/types/v1/data/data.types.d.ts +14 -0
  170. package/dist/types/v1/data/data.types.js +5 -0
  171. package/dist/types/v1/direct-debits/direct-debits.types.d.ts +104 -0
  172. package/dist/types/v1/direct-debits/direct-debits.types.js +5 -0
  173. package/dist/types/v1/electricity/electricity.types.d.ts +21 -0
  174. package/dist/types/v1/electricity/electricity.types.js +5 -0
  175. package/dist/types/v1/globals/collections.types.d.ts +49 -0
  176. package/dist/types/v1/globals/collections.types.js +5 -0
  177. package/dist/types/v1/globals/payout.types.d.ts +183 -0
  178. package/dist/types/v1/globals/payout.types.js +5 -0
  179. package/dist/types/v1/requery/requery.types.d.ts +49 -0
  180. package/dist/types/v1/requery/requery.types.js +5 -0
  181. package/dist/types/v1/terminals/terminals.types.d.ts +44 -0
  182. package/dist/types/v1/terminals/terminals.types.js +5 -0
  183. package/dist/types/v1/transactions/transactions.types.d.ts +87 -0
  184. package/dist/types/v1/transactions/transactions.types.js +5 -0
  185. package/dist/types/v1/virtual-accounts/virtual-accounts.types.d.ts +64 -0
  186. package/dist/types/v1/virtual-accounts/virtual-accounts.types.js +5 -0
  187. package/dist/types/v1/webhooks/webhooks.types.d.ts +54 -0
  188. package/dist/types/v1/webhooks/webhooks.types.js +5 -0
  189. package/dist/types/v2/airtime/airtime.types.d.ts +31 -0
  190. package/dist/types/v2/airtime/airtime.types.js +5 -0
  191. package/dist/types/v2/betting/betting.types.d.ts +33 -0
  192. package/dist/types/v2/betting/betting.types.js +5 -0
  193. package/dist/types/v2/cable/cable.types.d.ts +32 -0
  194. package/dist/types/v2/cable/cable.types.js +5 -0
  195. package/dist/types/v2/data/data.types.d.ts +32 -0
  196. package/dist/types/v2/data/data.types.js +5 -0
  197. package/dist/types/v2/electricity/electricity.types.d.ts +34 -0
  198. package/dist/types/v2/electricity/electricity.types.js +5 -0
  199. package/dist/types/v2/transfers/transfers.types.d.ts +99 -0
  200. package/dist/types/v2/transfers/transfers.types.js +5 -0
  201. package/package.json +42 -5
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @module nomba/charge
3
+ * @description Nomba SDK for Node.js
4
+ * @author Nomba Financial Services
5
+ * @description Charge resource
6
+ * @version 1.0.0
7
+ * @license MIT
8
+ * @copyright 2026 Nomba
9
+ * @homepage https://nomba.com
10
+ * @support https://nomba.com/support
11
+ * @repository https://github.com/kudi-inc/nomba-sdk-node
12
+ * @docs https://developer.nomba.com
13
+ * @see https://developer.nomba.com/docs/api-reference/charge
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IChargeService } from "../../../interfaces/v1/charge/IChargeService.js";
17
+ import type { CancelChargeTransactionParams, ChargeOrder, ChargeTransactionDetails, FlashAccount, SaveCardOtpRequest, SubmitCardDetailsParams, SubmitCardDetailsResult, SubmitCardOtpParams, SubmitCardOtpResult, SubmitSaveCardOtpParams } from "../../../types/v1/charge/charge.types.js";
18
+ import type { CheckoutResult, TokenizedCardData } from "../../../types/v1/checkout/checkout.types.js";
19
+ /**
20
+ * The Charge API: build your own checkout on top of an order created with `nomba.checkout.createOrder`.
21
+ * Flow: getOrder, submitCardDetails, submitCardOtp, then fetchTransactionDetails.
22
+ * Sandbox variants of these endpoints are not documented, so they always use /v1/checkout.
23
+ */
24
+ export declare class ChargeService implements IChargeService {
25
+ private readonly http;
26
+ constructor(http: IHttpClient);
27
+ /**
28
+ * `GET /v1/checkout/order/{orderReference}`.
29
+ * @param orderReference The order's reference, from `nomba.checkout.createOrder`.
30
+ * @returns The order's details.
31
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
32
+ */
33
+ getOrder(orderReference: string): Promise<ChargeOrder>;
34
+ /**
35
+ * `POST /v1/checkout/checkout-card-detail`.
36
+ * @param params The order reference and card details to charge.
37
+ * @returns The result of submitting the card; an OTP is typically sent next.
38
+ * @throws {NombaError} The call failed, e.g. the card was declined.
39
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
40
+ */
41
+ submitCardDetails(params: SubmitCardDetailsParams): Promise<SubmitCardDetailsResult>;
42
+ /**
43
+ * `POST /v1/checkout/checkout-card-otp`.
44
+ * @param params The order reference and OTP the customer received.
45
+ * @returns The result of submitting the OTP.
46
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
47
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
48
+ */
49
+ submitCardOtp(params: SubmitCardOtpParams): Promise<SubmitCardOtpResult>;
50
+ /**
51
+ * `POST /v1/checkout/resend-otp`. Resends the payment OTP to the customer's phone.
52
+ * @param orderReference The order's reference.
53
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
54
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
55
+ */
56
+ resendOtp(orderReference: string): Promise<CheckoutResult>;
57
+ /**
58
+ * `POST /v1/checkout/confirm-transaction-receipt`. The status after the OTP is submitted or a transfer
59
+ * is made.
60
+ * @param orderReference The order's reference.
61
+ * @returns The transaction's current status.
62
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
63
+ */
64
+ fetchTransactionDetails(orderReference: string): Promise<ChargeTransactionDetails>;
65
+ /**
66
+ * `GET /v1/checkout/get-checkout-kta/{orderReference}`. A Flash account number the customer can pay by
67
+ * transfer.
68
+ * @param orderReference The order's reference.
69
+ * @returns The Flash account to transfer payment to.
70
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
71
+ */
72
+ fetchFlashAccount(orderReference: string): Promise<FlashAccount>;
73
+ /**
74
+ * `POST /v1/checkout/transaction/cancel`. Cancels an incomplete checkout transaction.
75
+ * @param params The order reference to cancel.
76
+ * @throws {NombaError} The call failed, e.g. the transaction already completed.
77
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
78
+ */
79
+ cancelTransaction(params: CancelChargeTransactionParams): Promise<CheckoutResult>;
80
+ /**
81
+ * `POST /v1/checkout/user-card/saved-card/auth`. Sends an OTP; use when `getOrder` says the user has
82
+ * saved cards.
83
+ * @param orderReference The order's reference.
84
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
85
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
86
+ */
87
+ requestSavedCardsOtp(orderReference: string): Promise<CheckoutResult>;
88
+ /**
89
+ * `GET /v1/checkout/user-card/{orderReference}`. Needs the OTP from `requestSavedCardsOtp`.
90
+ * @param orderReference The order's reference.
91
+ * @param otp The OTP sent by `requestSavedCardsOtp`.
92
+ * @returns The customer's saved, tokenized cards.
93
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
94
+ */
95
+ getSavedCards(orderReference: string, otp: string): Promise<{
96
+ tokenizedCardData?: TokenizedCardData[];
97
+ }>;
98
+ /**
99
+ * `POST /v1/checkout/user-card/auth`. Sends an OTP before saving a card; call after a successful
100
+ * payment.
101
+ * @param params The order reference and card to save.
102
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
103
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
104
+ */
105
+ requestSaveCardOtp(params: SaveCardOtpRequest): Promise<CheckoutResult>;
106
+ /**
107
+ * `POST /v1/checkout/user-card`. Submits the OTP, which saves the card for later use.
108
+ * @param params The order reference and OTP from `requestSaveCardOtp`.
109
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
110
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
111
+ */
112
+ submitSaveCardOtp(params: SubmitSaveCardOtpParams): Promise<CheckoutResult>;
113
+ }
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @module nomba/charge
3
+ * @description Nomba SDK for Node.js
4
+ * @author Nomba Financial Services
5
+ * @description Charge resource
6
+ * @version 1.0.0
7
+ * @license MIT
8
+ * @copyright 2026 Nomba
9
+ * @homepage https://nomba.com
10
+ * @support https://nomba.com/support
11
+ * @repository https://github.com/kudi-inc/nomba-sdk-node
12
+ * @docs https://developer.nomba.com
13
+ * @see https://developer.nomba.com/docs/api-reference/charge
14
+ */
15
+ import { pathId } from "../../../lib/util.js";
16
+ /**
17
+ * The Charge API: build your own checkout on top of an order created with `nomba.checkout.createOrder`.
18
+ * Flow: getOrder, submitCardDetails, submitCardOtp, then fetchTransactionDetails.
19
+ * Sandbox variants of these endpoints are not documented, so they always use /v1/checkout.
20
+ */
21
+ export class ChargeService {
22
+ http;
23
+ constructor(http) {
24
+ this.http = http;
25
+ }
26
+ /**
27
+ * `GET /v1/checkout/order/{orderReference}`.
28
+ * @param orderReference The order's reference, from `nomba.checkout.createOrder`.
29
+ * @returns The order's details.
30
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
31
+ */
32
+ async getOrder(orderReference) {
33
+ return this.http.request("GET", `/v1/checkout/order/${pathId(orderReference)}`);
34
+ }
35
+ /**
36
+ * `POST /v1/checkout/checkout-card-detail`.
37
+ * @param params The order reference and card details to charge.
38
+ * @returns The result of submitting the card; an OTP is typically sent next.
39
+ * @throws {NombaError} The call failed, e.g. the card was declined.
40
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
41
+ */
42
+ async submitCardDetails(params) {
43
+ const { cardDetails, orderReference } = params;
44
+ return this.http.request("POST", "/v1/checkout/checkout-card-detail", {
45
+ body: {
46
+ ...params,
47
+ ...(typeof cardDetails === "object" && {
48
+ cardDetails: JSON.stringify(cardDetails),
49
+ }),
50
+ },
51
+ ...(orderReference && { idempotencyKey: orderReference }),
52
+ });
53
+ }
54
+ /**
55
+ * `POST /v1/checkout/checkout-card-otp`.
56
+ * @param params The order reference and OTP the customer received.
57
+ * @returns The result of submitting the OTP.
58
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
59
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
60
+ */
61
+ submitCardOtp(params) {
62
+ return this.http.request("POST", "/v1/checkout/checkout-card-otp", {
63
+ body: params,
64
+ idempotencyKey: params.transactionId,
65
+ });
66
+ }
67
+ /**
68
+ * `POST /v1/checkout/resend-otp`. Resends the payment OTP to the customer's phone.
69
+ * @param orderReference The order's reference.
70
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
71
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
72
+ */
73
+ resendOtp(orderReference) {
74
+ return this.http.request("POST", "/v1/checkout/resend-otp", {
75
+ body: { orderReference },
76
+ idempotencyKey: orderReference,
77
+ });
78
+ }
79
+ /**
80
+ * `POST /v1/checkout/confirm-transaction-receipt`. The status after the OTP is submitted or a transfer
81
+ * is made.
82
+ * @param orderReference The order's reference.
83
+ * @returns The transaction's current status.
84
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
85
+ */
86
+ fetchTransactionDetails(orderReference) {
87
+ return this.http.request("POST", "/v1/checkout/confirm-transaction-receipt", {
88
+ body: { orderReference },
89
+ });
90
+ }
91
+ /**
92
+ * `GET /v1/checkout/get-checkout-kta/{orderReference}`. A Flash account number the customer can pay by
93
+ * transfer.
94
+ * @param orderReference The order's reference.
95
+ * @returns The Flash account to transfer payment to.
96
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
97
+ */
98
+ async fetchFlashAccount(orderReference) {
99
+ return this.http.request("GET", `/v1/checkout/get-checkout-kta/${pathId(orderReference)}`);
100
+ }
101
+ /**
102
+ * `POST /v1/checkout/transaction/cancel`. Cancels an incomplete checkout transaction.
103
+ * @param params The order reference to cancel.
104
+ * @throws {NombaError} The call failed, e.g. the transaction already completed.
105
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
106
+ */
107
+ cancelTransaction(params) {
108
+ return this.http.request("POST", "/v1/checkout/transaction/cancel", {
109
+ body: params,
110
+ idempotencyKey: params.transactionId,
111
+ });
112
+ }
113
+ /**
114
+ * `POST /v1/checkout/user-card/saved-card/auth`. Sends an OTP; use when `getOrder` says the user has
115
+ * saved cards.
116
+ * @param orderReference The order's reference.
117
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
118
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
119
+ */
120
+ requestSavedCardsOtp(orderReference) {
121
+ return this.http.request("POST", "/v1/checkout/user-card/saved-card/auth", {
122
+ body: { orderReference },
123
+ idempotencyKey: orderReference,
124
+ });
125
+ }
126
+ /**
127
+ * `GET /v1/checkout/user-card/{orderReference}`. Needs the OTP from `requestSavedCardsOtp`.
128
+ * @param orderReference The order's reference.
129
+ * @param otp The OTP sent by `requestSavedCardsOtp`.
130
+ * @returns The customer's saved, tokenized cards.
131
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
132
+ */
133
+ async getSavedCards(orderReference, otp) {
134
+ return this.http.request("GET", `/v1/checkout/user-card/${pathId(orderReference)}`, { query: { otp } });
135
+ }
136
+ /**
137
+ * `POST /v1/checkout/user-card/auth`. Sends an OTP before saving a card; call after a successful
138
+ * payment.
139
+ * @param params The order reference and card to save.
140
+ * @throws {NombaError} The call failed, e.g. `orderReference` does not exist.
141
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
142
+ */
143
+ requestSaveCardOtp(params) {
144
+ return this.http.request("POST", "/v1/checkout/user-card/auth", {
145
+ body: params,
146
+ idempotencyKey: params.orderReference,
147
+ });
148
+ }
149
+ /**
150
+ * `POST /v1/checkout/user-card`. Submits the OTP, which saves the card for later use.
151
+ * @param params The order reference and OTP from `requestSaveCardOtp`.
152
+ * @throws {NombaError} The call failed, e.g. the OTP was wrong or expired.
153
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
154
+ */
155
+ submitSaveCardOtp(params) {
156
+ return this.http.request("POST", "/v1/checkout/user-card", {
157
+ body: params,
158
+ idempotencyKey: params.orderReference,
159
+ });
160
+ }
161
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @module nomba/checkout
3
+ * @description Nomba SDK for Node.js
4
+ * @author Nomba Financial Services
5
+ * @version 1.0.0
6
+ * @description Checkout resource
7
+ * @license MIT
8
+ * @copyright 2026 Nomba
9
+ * @homepage https://nomba.com
10
+ * @support https://nomba.com/support
11
+ * @repository https://github.com/kudi-inc/nomba-sdk-node
12
+ * @docs https://developer.nomba.com
13
+ * @see https://developer.nomba.com/docs/api-reference/checkout
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { ICheckoutService } from "../../../interfaces/v1/checkout/ICheckoutService.js";
17
+ import type { CallOptions } from "../../../types/common/common.types.js";
18
+ import type { ChargeTokenizedCardParams, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
19
+ export declare class CheckoutService implements ICheckoutService {
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /**
23
+ * `POST /v1/checkout/order`. Send the customer to `checkoutLink` to pay.
24
+ * Verified against a real sandbox call to use /v1/checkout/order, not /sandbox/checkout/order as the
25
+ * sandbox-testing guide claims (that path 404s); sandbox and production share this path.
26
+ * @param params The order to create; `order.orderReference` is the idempotency key when provided.
27
+ * @returns The created order, including `checkoutLink`.
28
+ * @throws {NombaError} The call failed.
29
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
30
+ */
31
+ createOrder(params: CreateCheckoutOrderParams): Promise<CheckoutOrderCreated>;
32
+ /**
33
+ * `GET /v1/checkout/transaction`. Verified in sandbox; see the note on `createOrder`.
34
+ * @param params Which transaction to fetch, e.g. by `orderReference`.
35
+ * @returns The matching transaction.
36
+ * @throws {NombaError} The call failed, e.g. no transaction matches.
37
+ */
38
+ fetchTransaction(params?: FetchCheckoutTransactionParams): Promise<CheckoutTransaction>;
39
+ /**
40
+ * `POST /v1/checkout/order/cancel`. Only for orders not yet paid; use `refund` after payment.
41
+ * @param orderReference The order's reference (used as idempotency key).
42
+ * @throws {NombaError} The call failed, e.g. the order was already paid.
43
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
44
+ */
45
+ cancelOrder(orderReference: string): Promise<CheckoutResult>;
46
+ /**
47
+ * `POST /v1/checkout/refund`. Verified in sandbox; see the note on `createOrder`.
48
+ * @param params The transaction to refund; `transactionId` is the idempotency key.
49
+ * @param options Outcome polling/mapping and other per-call overrides.
50
+ * @returns The refund result, or the outcome `options` maps it to.
51
+ * @throws {NombaError} The call failed and is not retryable.
52
+ * @throws {UnconfirmedOutcomeError} The outcome stayed pending after polling ran out.
53
+ */
54
+ refund<R = CheckoutResult>(params: RefundCheckoutTransactionParams, options?: CallOptions<CheckoutResult, R>): Promise<CheckoutResult | R>;
55
+ /**
56
+ * `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
57
+ * went through.
58
+ * @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key when provided.
59
+ * @returns The charge result.
60
+ * @throws {NombaError} The call failed, e.g. the token is invalid or expired.
61
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
62
+ */
63
+ chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<TokenizedCardResult>;
64
+ /**
65
+ * `GET /v1/checkout/tokenized-card-data`.
66
+ * @param params Pagination (`page`) and other list filters.
67
+ * @returns One page of the customer's saved, tokenized cards.
68
+ * @throws {NombaError} The call failed.
69
+ */
70
+ listTokenizedCards(params?: ListTokenizedCardsParams): Promise<TokenizedCardList>;
71
+ /**
72
+ * Every tokenized card matching the filters, across all pages. Starts at `params.page` if given.
73
+ * @param params Starting page and other list filters.
74
+ * @throws {NombaError} A page request failed.
75
+ */
76
+ iterateTokenizedCards(params?: ListTokenizedCardsParams): AsyncGenerator<TokenizedCardData>;
77
+ /**
78
+ * `POST /v1/checkout/tokenized-card-data`.
79
+ * @param params The tokenized card's key and the fields to update; `tokenKey` is the idempotency key.
80
+ * @returns The updated tokenized card.
81
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
82
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
83
+ */
84
+ updateTokenizedCard(params: UpdateTokenizedCardParams): Promise<UpdatedTokenizedCard>;
85
+ /**
86
+ * `DELETE /v1/checkout/tokenized-card-data`.
87
+ * @param tokenKey The tokenized card's key (used as idempotency key).
88
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
89
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
90
+ */
91
+ deleteTokenizedCard(tokenKey: string): Promise<TokenizedCardResult>;
92
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @module nomba/checkout
3
+ * @description Nomba SDK for Node.js
4
+ * @author Nomba Financial Services
5
+ * @version 1.0.0
6
+ * @description Checkout resource
7
+ * @license MIT
8
+ * @copyright 2026 Nomba
9
+ * @homepage https://nomba.com
10
+ * @support https://nomba.com/support
11
+ * @repository https://github.com/kudi-inc/nomba-sdk-node
12
+ * @docs https://developer.nomba.com
13
+ * @see https://developer.nomba.com/docs/api-reference/checkout
14
+ */
15
+ import { REJECTED, settle } from "../../../lib/outcome.js";
16
+ import { paginate } from "../../../lib/paginate.js";
17
+ // The refund endpoint documents code "00" and a `success` boolean in data. The docs don't say `false` is final, so
18
+ // it is pending (requery before refunding again), like Global Payout's FAILED.
19
+ const REFUND_OUTCOMES = {
20
+ codes: { "00": "success", ...REJECTED },
21
+ statuses: { true: "success", false: "pending" },
22
+ statusOf: (data) => {
23
+ const ok = data?.success;
24
+ return typeof ok === "boolean" ? String(ok) : undefined;
25
+ },
26
+ };
27
+ export class CheckoutService {
28
+ http;
29
+ constructor(http) {
30
+ this.http = http;
31
+ }
32
+ /**
33
+ * `POST /v1/checkout/order`. Send the customer to `checkoutLink` to pay.
34
+ * Verified against a real sandbox call to use /v1/checkout/order, not /sandbox/checkout/order as the
35
+ * sandbox-testing guide claims (that path 404s); sandbox and production share this path.
36
+ * @param params The order to create; `order.orderReference` is the idempotency key when provided.
37
+ * @returns The created order, including `checkoutLink`.
38
+ * @throws {NombaError} The call failed.
39
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
40
+ */
41
+ createOrder(params) {
42
+ const ref = params.order.orderReference;
43
+ return this.http.request("POST", "/v1/checkout/order", {
44
+ body: params,
45
+ ...(ref ? { idempotencyKey: ref } : {}),
46
+ });
47
+ }
48
+ /**
49
+ * `GET /v1/checkout/transaction`. Verified in sandbox; see the note on `createOrder`.
50
+ * @param params Which transaction to fetch, e.g. by `orderReference`.
51
+ * @returns The matching transaction.
52
+ * @throws {NombaError} The call failed, e.g. no transaction matches.
53
+ */
54
+ fetchTransaction(params = {}) {
55
+ return this.http.request("GET", "/v1/checkout/transaction", {
56
+ query: params,
57
+ });
58
+ }
59
+ /**
60
+ * `POST /v1/checkout/order/cancel`. Only for orders not yet paid; use `refund` after payment.
61
+ * @param orderReference The order's reference (used as idempotency key).
62
+ * @throws {NombaError} The call failed, e.g. the order was already paid.
63
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
64
+ */
65
+ cancelOrder(orderReference) {
66
+ return this.http.request("POST", "/v1/checkout/order/cancel", {
67
+ body: { orderReference },
68
+ idempotencyKey: orderReference,
69
+ });
70
+ }
71
+ /**
72
+ * `POST /v1/checkout/refund`. Verified in sandbox; see the note on `createOrder`.
73
+ * @param params The transaction to refund; `transactionId` is the idempotency key.
74
+ * @param options Outcome polling/mapping and other per-call overrides.
75
+ * @returns The refund result, or the outcome `options` maps it to.
76
+ * @throws {NombaError} The call failed and is not retryable.
77
+ * @throws {UnconfirmedOutcomeError} The outcome stayed pending after polling ran out.
78
+ */
79
+ async refund(params, options = {}) {
80
+ return settle(this.http, "POST", "/v1/checkout/refund", { body: params }, REFUND_OUTCOMES, params.transactionId, options);
81
+ }
82
+ /**
83
+ * `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
84
+ * went through.
85
+ * @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key when provided.
86
+ * @returns The charge result.
87
+ * @throws {NombaError} The call failed, e.g. the token is invalid or expired.
88
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
89
+ */
90
+ chargeTokenizedCard(params) {
91
+ const ref = params.order?.orderReference;
92
+ return this.http.request("POST", "/v1/checkout/tokenized-card-payment", {
93
+ body: params,
94
+ ...(ref ? { idempotencyKey: ref } : {}),
95
+ });
96
+ }
97
+ /**
98
+ * `GET /v1/checkout/tokenized-card-data`.
99
+ * @param params Pagination (`page`) and other list filters.
100
+ * @returns One page of the customer's saved, tokenized cards.
101
+ * @throws {NombaError} The call failed.
102
+ */
103
+ listTokenizedCards(params = {}) {
104
+ return this.http.request("GET", "/v1/checkout/tokenized-card-data", {
105
+ query: params,
106
+ });
107
+ }
108
+ /**
109
+ * Every tokenized card matching the filters, across all pages. Starts at `params.page` if given.
110
+ * @param params Starting page and other list filters.
111
+ * @throws {NombaError} A page request failed.
112
+ */
113
+ iterateTokenizedCards(params = {}) {
114
+ return paginate(async (cursor) => {
115
+ const r = await this.listTokenizedCards(cursor ? { ...params, page: Number(cursor) } : params);
116
+ // nextPage is "0" when there are no more pages.
117
+ const next = r.nextPage && r.nextPage !== "0" ? r.nextPage : "";
118
+ return { results: r.tokenizedCardDataList ?? [], cursor: next };
119
+ });
120
+ }
121
+ /**
122
+ * `POST /v1/checkout/tokenized-card-data`.
123
+ * @param params The tokenized card's key and the fields to update; `tokenKey` is the idempotency key.
124
+ * @returns The updated tokenized card.
125
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
126
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
127
+ */
128
+ updateTokenizedCard(params) {
129
+ return this.http.request("POST", "/v1/checkout/tokenized-card-data", {
130
+ body: params,
131
+ idempotencyKey: params.tokenKey,
132
+ });
133
+ }
134
+ /**
135
+ * `DELETE /v1/checkout/tokenized-card-data`.
136
+ * @param tokenKey The tokenized card's key (used as idempotency key).
137
+ * @throws {NombaError} The call failed, e.g. the token is invalid.
138
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
139
+ */
140
+ deleteTokenizedCard(tokenKey) {
141
+ return this.http.request("DELETE", "/v1/checkout/tokenized-card-data", {
142
+ body: { tokenKey },
143
+ idempotencyKey: tokenKey,
144
+ });
145
+ }
146
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module nomba/services/v1/data
3
+ * @description Data plans (v1): GET /v1/bill/data-plan/{telco}
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
7
+ import type { IDataService } from "../../../interfaces/v1/data/index.js";
8
+ import type { DataPlansResult } from "../../../types/v1/data/data.types.js";
9
+ /** Data bundle plans (v1): lookup only, no purchase endpoint. */
10
+ export declare class DataService implements IDataService {
11
+ private readonly http;
12
+ constructor(http: IHttpClient);
13
+ /**
14
+ * `GET /v1/bill/data-plan/{telco}`.
15
+ * @param telco The telco network to list data plans for.
16
+ * @returns The available data plans for that telco.
17
+ * @throws {NombaError} `telco` is not a recognized network, or the request failed.
18
+ */
19
+ getDataPlans(telco: string): Promise<DataPlansResult>;
20
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module nomba/services/v1/data
3
+ * @description Data plans (v1): GET /v1/bill/data-plan/{telco}
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import { pathId } from "../../../lib/util.js";
7
+ /** Data bundle plans (v1): lookup only, no purchase endpoint. */
8
+ export class DataService {
9
+ http;
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ /**
14
+ * `GET /v1/bill/data-plan/{telco}`.
15
+ * @param telco The telco network to list data plans for.
16
+ * @returns The available data plans for that telco.
17
+ * @throws {NombaError} `telco` is not a recognized network, or the request failed.
18
+ */
19
+ getDataPlans(telco) {
20
+ return this.http.request("GET", `/v1/bill/data-plan/${pathId(telco)}`);
21
+ }
22
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @module nomba/direct-debits
3
+ * @description Nomba SDK for Node.js
4
+ * @description Direct Debits resource
5
+ * @author Nomba Financial Services
6
+ * @version 1.0.0
7
+ * @license MIT
8
+ * @copyright 2026 Nomba
9
+ * @homepage https://nomba.com
10
+ * @support https://nomba.com/support
11
+ * @repository https://github.com/kudi-inc/nomba-sdk-node
12
+ * @docs https://developer.nomba.com
13
+ * @see https://developer.nomba.com/docs/api-reference/direct-debits
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IDirectDebitsService } from "../../../interfaces/v1/direct-debits/IDirectDebitsService.js";
17
+ import type { CreatedMandate, CreateMandateParams, DebitMandateParams, ListMandatesParams, MandateDebitResult, MandatePage, MandateStatus, UpdatedMandateStatus, UpdateMandateStatusParams } from "../../../types/v1/direct-debits/direct-debits.types.js";
18
+ /** Direct debit mandates (v1): create, inspect, debit, and update recurring mandates. */
19
+ export declare class DirectDebitsService implements IDirectDebitsService {
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /**
23
+ * `POST /v1/direct-debits`.
24
+ * ponytail: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
25
+ * other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
26
+ * @param params The mandate to create; `merchantReference` is the idempotency key.
27
+ * @returns The created mandate.
28
+ * @throws {NombaError} The mandate params were rejected.
29
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
30
+ * check the mandate status before retrying.
31
+ */
32
+ createMandate(params: CreateMandateParams): Promise<CreatedMandate>;
33
+ /**
34
+ * `GET /v1/direct-debits/status?mandateId={mandateId}`.
35
+ * @param mandateId The mandate to look up.
36
+ * @returns The mandate's current status.
37
+ * @throws {NombaError} `mandateId` is not found, or the request failed.
38
+ */
39
+ getMandateStatus(mandateId: string): Promise<MandateStatus>;
40
+ /**
41
+ * `POST /v1/direct-debits/debit-mandate`. No per-transaction reference field exists in params, so a
42
+ * random idempotency key is generated for error tracking. If the outcome is unknown, requery the mandate
43
+ * before retrying.
44
+ * @param params The mandate to debit and the amount.
45
+ * @returns The debit result.
46
+ * @throws {NombaError} The mandate is not active, or the debit was rejected.
47
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
48
+ * check the mandate status before retrying.
49
+ */
50
+ debitMandate(params: DebitMandateParams): Promise<MandateDebitResult>;
51
+ /**
52
+ * `GET /v1/direct-debits/mandates`.
53
+ * @param params Pagination and filter params.
54
+ * @returns A page of mandates.
55
+ * @throws {NombaError} The request failed.
56
+ */
57
+ listMandates(params: ListMandatesParams): Promise<MandatePage>;
58
+ /**
59
+ * `PUT /v1/direct-debits/update-status`. No per-change reference field exists in params, so a random
60
+ * idempotency key is generated for error tracking. If the outcome is unknown, check the mandate status
61
+ * before retrying.
62
+ * @param params The mandate and the new status.
63
+ * @returns The mandate's updated status.
64
+ * @throws {NombaError} The status transition is invalid, or the request failed.
65
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
66
+ * check the mandate status before retrying.
67
+ */
68
+ updateMandateStatus(params: UpdateMandateStatusParams): Promise<UpdatedMandateStatus>;
69
+ }