@nomba/node-sdk 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.
Files changed (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +550 -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 +24 -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 +11 -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 +11 -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 +33 -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 +30 -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 +9 -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 +31 -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 +11 -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 +14 -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 +30 -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 +17 -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 +18 -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 +34 -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 +27 -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 +21 -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 +12 -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 +12 -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 +12 -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 +12 -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 +12 -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 +20 -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 +18 -0
  96. package/dist/lib/outcome.js +107 -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 +63 -0
  110. package/dist/nomba.js +97 -0
  111. package/dist/services/http/http-client.service.d.ts +27 -0
  112. package/dist/services/http/http-client.service.js +317 -0
  113. package/dist/services/v1/accounts/accounts.service.d.ts +38 -0
  114. package/dist/services/v1/accounts/accounts.service.js +58 -0
  115. package/dist/services/v1/betting/betting.service.d.ts +16 -0
  116. package/dist/services/v1/betting/betting.service.js +21 -0
  117. package/dist/services/v1/cable/cable.service.d.ts +16 -0
  118. package/dist/services/v1/cable/cable.service.js +23 -0
  119. package/dist/services/v1/charge/charge.service.d.ts +52 -0
  120. package/dist/services/v1/charge/charge.service.js +99 -0
  121. package/dist/services/v1/checkout/checkout.service.d.ts +44 -0
  122. package/dist/services/v1/checkout/checkout.service.js +100 -0
  123. package/dist/services/v1/data/data.service.d.ts +14 -0
  124. package/dist/services/v1/data/data.service.js +16 -0
  125. package/dist/services/v1/direct-debits/direct-debits.service.d.ts +45 -0
  126. package/dist/services/v1/direct-debits/direct-debits.service.js +69 -0
  127. package/dist/services/v1/electricity/electricity.service.d.ts +16 -0
  128. package/dist/services/v1/electricity/electricity.service.js +21 -0
  129. package/dist/services/v1/globals/collections.service.d.ts +28 -0
  130. package/dist/services/v1/globals/collections.service.js +38 -0
  131. package/dist/services/v1/globals/payout.service.d.ts +45 -0
  132. package/dist/services/v1/globals/payout.service.js +95 -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 +69 -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 +41 -0
  140. package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +56 -0
  141. package/dist/services/v1/webhooks/webhooks.service.d.ts +36 -0
  142. package/dist/services/v1/webhooks/webhooks.service.js +60 -0
  143. package/dist/services/v2/airtime/airtime.service.d.ts +18 -0
  144. package/dist/services/v2/airtime/airtime.service.js +35 -0
  145. package/dist/services/v2/betting/betting.service.d.ts +19 -0
  146. package/dist/services/v2/betting/betting.service.js +36 -0
  147. package/dist/services/v2/cable/cable.service.d.ts +19 -0
  148. package/dist/services/v2/cable/cable.service.js +36 -0
  149. package/dist/services/v2/data/data.service.d.ts +18 -0
  150. package/dist/services/v2/data/data.service.js +35 -0
  151. package/dist/services/v2/electricity/electricity.service.d.ts +19 -0
  152. package/dist/services/v2/electricity/electricity.service.js +36 -0
  153. package/dist/services/v2/transfers/transfers.service.d.ts +30 -0
  154. package/dist/services/v2/transfers/transfers.service.js +67 -0
  155. package/dist/types/common/common.types.d.ts +78 -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,21 @@
1
+ /**
2
+ * @module nomba/interfaces/webhooks
3
+ * @description Webhooks service contract
4
+ */
5
+ import type { RequestOptions } from "../../../types/common/common.types.js";
6
+ import type { EventLog, EventLogsParams, EventsParams, ReplayParams, WebhookList, WebhookSubscription } from "../../../types/v1/webhooks/webhooks.types.js";
7
+ export interface IWebhooksService {
8
+ /** POST /v1/webhooks/event-logs. Webhooks sent to your system and how your server answered. */
9
+ eventLogs(params?: EventLogsParams): Promise<WebhookList<EventLog>>;
10
+ /** POST /v1/webhooks/events. Your webhook subscriptions. */
11
+ events(params?: EventsParams): Promise<WebhookList<WebhookSubscription>>;
12
+ /**
13
+ * POST /v1/webhooks/re-push. Resends one event. Takes an event log's `hookRequestId`; the request field
14
+ * is spelled `hooksRequestId`, as the guide shows.
15
+ */
16
+ repush(hookRequestId: string, options?: RequestOptions): Promise<void>;
17
+ /** POST /v1/webhooks/bulk-re-push */
18
+ bulkRepush(hookRequestIds: string[], options?: RequestOptions): Promise<void>;
19
+ /** POST /v1/webhooks/replay. Resends every matching event in the time window. */
20
+ replay(params: ReplayParams, options?: RequestOptions): Promise<void>;
21
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/webhooks
3
+ * @description Webhooks service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IWebhooksService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/airtime
3
+ * @description Airtime v2 service contract
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { AirtimePurchaseParams, AirtimePurchaseV2Result } from "../../../types/v2/airtime/airtime.types.js";
7
+ export interface IAirtimeV2Service {
8
+ /** POST /v2/bill/topup, from the parent account. */
9
+ buyAirtime<R = AirtimePurchaseV2Result>(params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
10
+ /** POST /v2/bill/topup/{subAccountId} */
11
+ buyAirtimeFromSubAccount<R = AirtimePurchaseV2Result>(subAccountId: string, params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
12
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/airtime
3
+ * @description Airtime v2 service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IAirtimeV2Service.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/betting
3
+ * @description Betting v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { BettingPaymentParams, BettingPaymentV2Result } from "../../../types/v2/betting/betting.types.js";
7
+ export interface IBettingV2Service {
8
+ /** POST /v2/bill/betting, from the parent account. */
9
+ payBetting<R = BettingPaymentV2Result>(params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
10
+ /** POST /v2/bill/betting/{subAccountId} */
11
+ payBettingFromSubAccount<R = BettingPaymentV2Result>(subAccountId: string, params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
12
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/betting
3
+ * @description Betting v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IBettingV2Service.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/cable
3
+ * @description Cable TV v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { CablePaymentV2Result, CableTvSubscriptionParams } from "../../../types/v2/cable/cable.types.js";
7
+ export interface ICableV2Service {
8
+ /** POST /v2/bill/cabletv, from the parent account. */
9
+ subscribeCableTv<R = CablePaymentV2Result>(params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
10
+ /** POST /v2/bill/cabletv/{subAccountId} */
11
+ subscribeCableTvFromSubAccount<R = CablePaymentV2Result>(subAccountId: string, params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
12
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/cable
3
+ * @description Cable TV v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./ICableV2Service.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/data
3
+ * @description Data v2 service contract
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { DataPurchaseParams, DataPurchaseV2Result } from "../../../types/v2/data/data.types.js";
7
+ export interface IDataV2Service {
8
+ /** POST /v2/bill/data, from the parent account. */
9
+ buyData<R = DataPurchaseV2Result>(params: DataPurchaseParams, options?: CallOptions<DataPurchaseV2Result, R>): Promise<DataPurchaseV2Result | R>;
10
+ /** POST /v2/bill/data/{subAccountId} */
11
+ buyDataFromSubAccount<R = DataPurchaseV2Result>(subAccountId: string, params: DataPurchaseParams, options?: CallOptions<DataPurchaseV2Result, R>): Promise<DataPurchaseV2Result | R>;
12
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/data
3
+ * @description Data v2 service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IDataV2Service.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/electricity
3
+ * @description Electricity v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { ElectricityPaymentParams, ElectricityPaymentV2Result } from "../../../types/v2/electricity/electricity.types.js";
7
+ export interface IElectricityV2Service {
8
+ /** POST /v2/bill/electricity, from the parent account. */
9
+ payElectricity<R = ElectricityPaymentV2Result>(params: ElectricityPaymentParams, options?: CallOptions<ElectricityPaymentV2Result, R>): Promise<ElectricityPaymentV2Result | R>;
10
+ /** POST /v2/bill/electricity/{subAccountId} */
11
+ payElectricityFromSubAccount<R = ElectricityPaymentV2Result>(subAccountId: string, params: ElectricityPaymentParams, options?: CallOptions<ElectricityPaymentV2Result, R>): Promise<ElectricityPaymentV2Result | R>;
12
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v2/electricity
3
+ * @description Electricity v2 service contract. v2 has purchase endpoints only.
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IElectricityV2Service.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module nomba/interfaces/transfers
3
+ * @description Transfers service contract
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { Bank, BankAccountLookupParams, BankAccountLookupResult, BankTransferParams, BankTransferResult, WalletTransferParams, WalletTransferResult } from "../../../types/v2/transfers/transfers.types.js";
7
+ export interface ITransfersService {
8
+ /** GET /v1/transfers/banks */
9
+ listBanks(): Promise<Bank[]>;
10
+ /** POST /v1/transfers/bank/lookup */
11
+ lookupBankAccount(params: BankAccountLookupParams): Promise<BankAccountLookupResult>;
12
+ /** POST /v2/transfers/bank, from the parent account. */
13
+ bankTransfer<R = BankTransferResult>(params: BankTransferParams, options?: CallOptions<BankTransferResult, R>): Promise<BankTransferResult | R>;
14
+ /** POST /v2/transfers/bank/{subAccountId}. You must ask Nomba to profile you for sub account transfers. */
15
+ bankTransferFromSubAccount<R = BankTransferResult>(subAccountId: string, params: BankTransferParams, options?: CallOptions<BankTransferResult, R>): Promise<BankTransferResult | R>;
16
+ /** POST /v2/transfers/wallet, from the parent account to another Nomba account. */
17
+ walletTransfer<R = WalletTransferResult>(params: WalletTransferParams, options?: CallOptions<WalletTransferResult, R>): Promise<WalletTransferResult | R>;
18
+ /** POST /v2/transfers/wallet/{subAccountId} */
19
+ walletTransferFromSubAccount<R = WalletTransferResult>(subAccountId: string, params: WalletTransferParams, options?: CallOptions<WalletTransferResult, R>): Promise<WalletTransferResult | R>;
20
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/transfers
3
+ * @description Transfers service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./ITransfersService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @module nomba/lib/errors
3
+ * @description Nomba SDK for Node.js
4
+ * @description Error classes
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
+ */
14
+ /** Thrown for any non-2xx response, or a 2xx whose body `code` is not "00". */
15
+ export declare class NombaError extends Error {
16
+ readonly status: number;
17
+ readonly code: string;
18
+ readonly description: string;
19
+ constructor(status: number, code: string, description: string);
20
+ }
21
+ /**
22
+ * A mutating request failed in a way that does not say whether it was processed (timeout, network error,
23
+ * 5xx, or a 409). The SDK makes one attempt at a mutating call and does not retry automatically: Nomba
24
+ * uses merchantTxRef (in the request body) for idempotency, so an automatic retry with a different reference
25
+ * could double-execute a payment. It may already have gone through. Do not send it again as a new request:
26
+ * check its status (webhook or requery) before deciding whether to retry it yourself, with the same
27
+ * `idempotencyKey` (typically merchantTxRef).
28
+ */
29
+ export declare class OutcomeUnknownError extends Error {
30
+ readonly method: string;
31
+ readonly path: string;
32
+ readonly idempotencyKey: string;
33
+ readonly attempts: number;
34
+ constructor(method: string, path: string, idempotencyKey: string, attempts: number, cause: unknown);
35
+ }
36
+ /**
37
+ * A money-moving call got a readable answer whose body `code` or `data.status` is not one the docs list for
38
+ * that endpoint. The docs say never to act on an undocumented value: the transfer, bill or top-up may still
39
+ * complete. Wait for the webhook or requery the transaction before refunding or retrying.
40
+ */
41
+ export declare class UnconfirmedOutcomeError extends Error {
42
+ readonly method: string;
43
+ readonly path: string;
44
+ /** Which value the docs don't list: the body `code`, or `data.status` (including a missing one). */
45
+ readonly reason: "code" | "status";
46
+ readonly code: string | undefined;
47
+ readonly status: string | undefined;
48
+ readonly data: unknown;
49
+ readonly idempotencyKey: string | undefined;
50
+ constructor(method: string, path: string,
51
+ /** Which value the docs don't list: the body `code`, or `data.status` (including a missing one). */
52
+ reason: "code" | "status", code: string | undefined, status: string | undefined, data: unknown, idempotencyKey: string | undefined, cause?: unknown);
53
+ }
54
+ /** True when a call's result is not final: wait for the webhook or requery, never refund or resend. */
55
+ export declare const isPending: (e: unknown) => e is OutcomeUnknownError | UnconfirmedOutcomeError;
56
+ /**
57
+ * Getting or renewing the access token failed, so the request itself was never sent. Nothing happened on
58
+ * Nomba's side: fix the credentials or retry later. `cause` holds the underlying error (often a NombaError).
59
+ */
60
+ export declare class TokenError extends Error {
61
+ constructor(cause: unknown);
62
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @module nomba/lib/errors
3
+ * @description Nomba SDK for Node.js
4
+ * @description Error classes
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
+ */
14
+ /** Thrown for any non-2xx response, or a 2xx whose body `code` is not "00". */
15
+ export class NombaError extends Error {
16
+ status;
17
+ code;
18
+ description;
19
+ constructor(status, code, description) {
20
+ super(`[${code}] ${description}`);
21
+ this.status = status;
22
+ this.code = code;
23
+ this.description = description;
24
+ this.name = "NombaError";
25
+ }
26
+ }
27
+ /**
28
+ * A mutating request failed in a way that does not say whether it was processed (timeout, network error,
29
+ * 5xx, or a 409). The SDK makes one attempt at a mutating call and does not retry automatically: Nomba
30
+ * uses merchantTxRef (in the request body) for idempotency, so an automatic retry with a different reference
31
+ * could double-execute a payment. It may already have gone through. Do not send it again as a new request:
32
+ * check its status (webhook or requery) before deciding whether to retry it yourself, with the same
33
+ * `idempotencyKey` (typically merchantTxRef).
34
+ */
35
+ export class OutcomeUnknownError extends Error {
36
+ method;
37
+ path;
38
+ idempotencyKey;
39
+ attempts;
40
+ constructor(method, path, idempotencyKey, attempts, cause) {
41
+ super(`Outcome unknown for ${method} ${path} (idempotencyKey "${idempotencyKey}"); it may have been processed. Check its status (webhook or requery) before retrying it yourself. Do not send it as a new request with a different reference.`, { cause });
42
+ this.method = method;
43
+ this.path = path;
44
+ this.idempotencyKey = idempotencyKey;
45
+ this.attempts = attempts;
46
+ this.name = "OutcomeUnknownError";
47
+ }
48
+ }
49
+ /**
50
+ * A money-moving call got a readable answer whose body `code` or `data.status` is not one the docs list for
51
+ * that endpoint. The docs say never to act on an undocumented value: the transfer, bill or top-up may still
52
+ * complete. Wait for the webhook or requery the transaction before refunding or retrying.
53
+ */
54
+ export class UnconfirmedOutcomeError extends Error {
55
+ method;
56
+ path;
57
+ reason;
58
+ code;
59
+ status;
60
+ data;
61
+ idempotencyKey;
62
+ constructor(method, path,
63
+ /** Which value the docs don't list: the body `code`, or `data.status` (including a missing one). */
64
+ reason, code, status, data, idempotencyKey, cause) {
65
+ const what = reason === "code"
66
+ ? `code "${code}"`
67
+ : status === undefined
68
+ ? "missing data.status"
69
+ : `status "${status}"`;
70
+ super(`Unconfirmed outcome for ${method} ${path}: undocumented ${what}. It may still complete; wait for the webhook or requery before acting.`, { cause });
71
+ this.method = method;
72
+ this.path = path;
73
+ this.reason = reason;
74
+ this.code = code;
75
+ this.status = status;
76
+ this.data = data;
77
+ this.idempotencyKey = idempotencyKey;
78
+ this.name = "UnconfirmedOutcomeError";
79
+ }
80
+ }
81
+ /** True when a call's result is not final: wait for the webhook or requery, never refund or resend. */
82
+ export const isPending = (e) => e instanceof OutcomeUnknownError || e instanceof UnconfirmedOutcomeError;
83
+ /**
84
+ * Getting or renewing the access token failed, so the request itself was never sent. Nothing happened on
85
+ * Nomba's side: fix the credentials or retry later. `cause` holds the underlying error (often a NombaError).
86
+ */
87
+ export class TokenError extends Error {
88
+ constructor(cause) {
89
+ super(`Could not get an access token, so the request was not sent: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
90
+ this.name = "TokenError";
91
+ }
92
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module nomba/lib/outcome
3
+ * @description Classifies a money-moving call as success, pending or failed, using only documented values
4
+ */
5
+ import type { IHttpClient } from "../interfaces/http/IHttpClient.js";
6
+ import type { HttpMethod, HttpRequestOptions, RequestOptions } from "../types/common/common.types.js";
7
+ import type { Outcome, OutcomeHandlers, OutcomeTable } from "../types/common/outcome.types.js";
8
+ /** Documented 4xx body codes (docs/api-basics/response-codes): definite rejections, safe to report as failed. */
9
+ export declare const REJECTED: Readonly<Record<string, "failed">>;
10
+ /** Anything the table does not list is pending: an undocumented value is never acted on. */
11
+ export declare const classify: (table: OutcomeTable, code: string, status: string | undefined) => Outcome;
12
+ /**
13
+ * Makes one money-moving call and settles it into exactly one outcome.
14
+ * With a closure for that outcome, resolves to what the closure returns. Without one:
15
+ * success resolves `data`; a rejection throws NombaError; a pending result (documented or not),
16
+ * a lost response, or an undocumented code/status throws UnconfirmedOutcomeError.
17
+ */
18
+ export declare function settle<T, R = T>(http: IHttpClient, method: HttpMethod, path: string, request: Omit<HttpRequestOptions, "okCodes" | "envelope" | "idempotencyKey">, table: OutcomeTable, options?: RequestOptions & OutcomeHandlers<T, R>): Promise<T | R>;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @module nomba/lib/outcome
3
+ * @description Classifies a money-moving call as success, pending or failed, using only documented values
4
+ */
5
+ import { isPending, NombaError, OutcomeUnknownError, UnconfirmedOutcomeError, } from "./errors.js";
6
+ /** Documented 4xx body codes (docs/api-basics/response-codes): definite rejections, safe to report as failed. */
7
+ export const REJECTED = {
8
+ "400": "failed",
9
+ "401": "failed",
10
+ "403": "failed",
11
+ "404": "failed",
12
+ "422": "failed",
13
+ "429": "failed",
14
+ };
15
+ // Own keys only: a status like "constructor" must not match Object.prototype.
16
+ const lookup = (record, key) => record && key !== undefined && Object.hasOwn(record, key)
17
+ ? record[key]
18
+ : undefined;
19
+ /** Anything the table does not list is pending: an undocumented value is never acted on. */
20
+ export const classify = (table, code, status) => {
21
+ const byCode = lookup(table.codes, code) ?? "pending";
22
+ if (byCode !== "success" || !table.statuses)
23
+ return byCode;
24
+ return lookup(table.statuses, status) ?? "pending";
25
+ };
26
+ const defaultStatusOf = (data) => {
27
+ const s = data?.status;
28
+ return typeof s === "string" ? s : undefined;
29
+ };
30
+ /**
31
+ * Makes one money-moving call and settles it into exactly one outcome.
32
+ * With a closure for that outcome, resolves to what the closure returns. Without one:
33
+ * success resolves `data`; a rejection throws NombaError; a pending result (documented or not),
34
+ * a lost response, or an undocumented code/status throws UnconfirmedOutcomeError.
35
+ */
36
+ export async function settle(http, method, path, request, table, options = {}) {
37
+ const { onSuccess, onPending, onFailed, idempotencyKey } = options;
38
+ const report = (outcome, code, status, key = idempotencyKey) => http.reportOutcome({
39
+ method,
40
+ path,
41
+ outcome,
42
+ ...(code === undefined ? {} : { code }),
43
+ ...(status === undefined ? {} : { status }),
44
+ ...(key === undefined ? {} : { idempotencyKey: key }),
45
+ });
46
+ let res;
47
+ try {
48
+ res = await http.request(method, path, {
49
+ ...request,
50
+ ...(idempotencyKey === undefined ? {} : { idempotencyKey }),
51
+ // Only documented non-failure codes come back as data; the rest arrive as NombaError below.
52
+ okCodes: Object.keys(table.codes).filter((c) => lookup(table.codes, c) !== "failed"),
53
+ envelope: true,
54
+ ...(idempotencyKey === undefined ? {} : { idempotencyKey }),
55
+ });
56
+ }
57
+ catch (caught) {
58
+ let e = caught;
59
+ // Only a documented rejection (by HTTP status or body code) is a failure. Anything else (a 2xx with an
60
+ // unlisted body code, a 409 key conflict, a 408) may mean the payment went through: unconfirmed, never failed.
61
+ if (e instanceof NombaError &&
62
+ lookup(table.codes, String(e.status)) !== "failed" &&
63
+ lookup(table.codes, e.code) !== "failed")
64
+ e = new UnconfirmedOutcomeError(method, path, "code", e.code, undefined, undefined, idempotencyKey, e);
65
+ if (isPending(e)) {
66
+ const key = e instanceof OutcomeUnknownError ? e.idempotencyKey : idempotencyKey;
67
+ const code = e instanceof UnconfirmedOutcomeError ? e.code : undefined;
68
+ report("pending", code, undefined, key);
69
+ if (!onPending)
70
+ throw e;
71
+ return onPending({
72
+ cause: e,
73
+ ...(code === undefined ? {} : { code }),
74
+ ...(key === undefined ? {} : { idempotencyKey: key }),
75
+ });
76
+ }
77
+ if (e instanceof NombaError) {
78
+ report("failed", e.code);
79
+ if (!onFailed)
80
+ throw e;
81
+ return onFailed({ error: e, code: e.code });
82
+ }
83
+ throw e;
84
+ }
85
+ const status = (table.statusOf ?? defaultStatusOf)(res.data);
86
+ const outcome = classify(table, res.code, status);
87
+ report(outcome, res.code, status);
88
+ if (outcome === "success")
89
+ return onSuccess ? onSuccess(res.data) : res.data;
90
+ if (onPending)
91
+ return onPending({
92
+ data: res.data,
93
+ code: res.code,
94
+ ...(status === undefined ? {} : { status }),
95
+ ...(idempotencyKey === undefined ? {} : { idempotencyKey }),
96
+ });
97
+ // No onPending: documented or not, pending always throws so it can never be mistaken for success.
98
+ // reason tells what to check when debugging: an unlisted code, or an unlisted status when the code is listed.
99
+ const reason = lookup(table.codes, res.code) === undefined
100
+ ? "code"
101
+ : status !== undefined && lookup(table.statuses, status) === undefined
102
+ ? "status"
103
+ : lookup(table.codes, res.code) === "pending"
104
+ ? "code"
105
+ : "status";
106
+ throw new UnconfirmedOutcomeError(method, path, reason, res.code, status, res.data, idempotencyKey);
107
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module nomba/lib/paginate
3
+ * @description Nomba SDK for Node.js
4
+ * @description Pagination helper
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
+ */
14
+ /**
15
+ * Yields every item across pages. Per the docs, keep requesting with the returned `cursor`
16
+ * until the API returns none. Lazy: a page is fetched only when the previous one is consumed.
17
+ */
18
+ export declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<{
19
+ results: T[];
20
+ cursor: string;
21
+ }>): AsyncGenerator<T>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @module nomba/lib/paginate
3
+ * @description Nomba SDK for Node.js
4
+ * @description Pagination helper
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
+ */
14
+ /**
15
+ * Yields every item across pages. Per the docs, keep requesting with the returned `cursor`
16
+ * until the API returns none. Lazy: a page is fetched only when the previous one is consumed.
17
+ */
18
+ export async function* paginate(fetchPage) {
19
+ let cursor;
20
+ do {
21
+ const page = await fetchPage(cursor);
22
+ yield* page.results;
23
+ cursor = page.cursor;
24
+ } while (cursor);
25
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/lib/sdk-version
3
+ * @description The installed package version, generated at build/test time into sdk-version.generated.ts.
4
+ */
5
+ export { SDK_VERSION } from "./sdk-version.generated.js";
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "0.1.0";
@@ -0,0 +1 @@
1
+ export const SDK_VERSION = "0.1.0";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/lib/sdk-version
3
+ * @description The installed package version, generated at build/test time into sdk-version.generated.ts.
4
+ */
5
+ export { SDK_VERSION } from "./sdk-version.generated.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @module nomba/lib/paginate
3
+ * @description Nomba SDK for Node.js
4
+ * @description Token store helper
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
+ */
14
+ export interface TokenData {
15
+ businessId: string;
16
+ access_token: string;
17
+ refresh_token: string;
18
+ /** ISO 8601 UTC, e.g. 2022-07-08T14:33:00Z */
19
+ expiresAt: string;
20
+ }
21
+ /**
22
+ * Where the SDK keeps the current token. Implement it over Redis, a database, etc. so
23
+ * several instances share one token. Nomba allows a single session per client, so
24
+ * instances that share a store should also implement `lock`.
25
+ *
26
+ * Contract for shared stores:
27
+ * - `get`, `set` and `clear` must be atomic and durable (a `set` that resolves must be readable
28
+ * by every instance).
29
+ * - `lock` must expire (a TTL) so a crashed instance cannot hold it forever.
30
+ * - Store errors never fail a request: the SDK retries `set` twice, then keeps the token in
31
+ * process memory and reports the error through the `onStoreError` option.
32
+ */
33
+ export interface TokenStore {
34
+ get(): TokenData | undefined | Promise<TokenData | undefined>;
35
+ set(token: TokenData): void | Promise<void>;
36
+ clear(): void | Promise<void>;
37
+ /**
38
+ * Optional cross-instance lock. The SDK runs every issue/refresh inside `fn` so only
39
+ * one instance authenticates at a time (issue, refresh and revoke); others then pick up the stored token.
40
+ */
41
+ lock?<T>(fn: () => Promise<T>): Promise<T>;
42
+ }
43
+ /** Default store: one token, this process only. */
44
+ export declare class MemoryTokenStore implements TokenStore {
45
+ #private;
46
+ get(): TokenData | undefined;
47
+ set(token: TokenData): void;
48
+ clear(): void;
49
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @module nomba/lib/paginate
3
+ * @description Nomba SDK for Node.js
4
+ * @description Token store helper
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
+ */
14
+ /** Default store: one token, this process only. */
15
+ export class MemoryTokenStore {
16
+ #token;
17
+ get() {
18
+ return this.#token;
19
+ }
20
+ set(token) {
21
+ this.#token = token;
22
+ }
23
+ clear() {
24
+ this.#token = undefined;
25
+ }
26
+ }