@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,91 @@
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
+ /** Direct debit mandates (v1): create, inspect, debit, and update recurring mandates. */
16
+ export class DirectDebitsService {
17
+ http;
18
+ constructor(http) {
19
+ this.http = http;
20
+ }
21
+ /**
22
+ * `POST /v1/direct-debits`.
23
+ * ponytail: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
24
+ * other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
25
+ * @param params The mandate to create; `merchantReference` is the idempotency key.
26
+ * @returns The created mandate.
27
+ * @throws {NombaError} The mandate params were rejected.
28
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
29
+ * check the mandate status before retrying.
30
+ */
31
+ createMandate(params) {
32
+ return this.http.request("POST", "/v1/direct-debits", {
33
+ body: params,
34
+ codeField: "responseCode",
35
+ descriptionField: "responseMessage",
36
+ idempotencyKey: params.merchantReference,
37
+ });
38
+ }
39
+ /**
40
+ * `GET /v1/direct-debits/status?mandateId={mandateId}`.
41
+ * @param mandateId The mandate to look up.
42
+ * @returns The mandate's current status.
43
+ * @throws {NombaError} `mandateId` is not found, or the request failed.
44
+ */
45
+ getMandateStatus(mandateId) {
46
+ return this.http.request("GET", "/v1/direct-debits/status", {
47
+ query: { mandateId },
48
+ });
49
+ }
50
+ /**
51
+ * `POST /v1/direct-debits/debit-mandate`. No per-transaction reference field exists in params, so a
52
+ * random idempotency key is generated for error tracking. If the outcome is unknown, requery the mandate
53
+ * before retrying.
54
+ * @param params The mandate to debit and the amount.
55
+ * @returns The debit result.
56
+ * @throws {NombaError} The mandate is not active, or the debit was rejected.
57
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
58
+ * check the mandate status before retrying.
59
+ */
60
+ debitMandate(params) {
61
+ return this.http.request("POST", "/v1/direct-debits/debit-mandate", {
62
+ body: params,
63
+ });
64
+ }
65
+ /**
66
+ * `GET /v1/direct-debits/mandates`.
67
+ * @param params Pagination and filter params.
68
+ * @returns A page of mandates.
69
+ * @throws {NombaError} The request failed.
70
+ */
71
+ listMandates(params) {
72
+ return this.http.request("GET", "/v1/direct-debits/mandates", {
73
+ query: params,
74
+ });
75
+ }
76
+ /**
77
+ * `PUT /v1/direct-debits/update-status`. No per-change reference field exists in params, so a random
78
+ * idempotency key is generated for error tracking. If the outcome is unknown, check the mandate status
79
+ * before retrying.
80
+ * @param params The mandate and the new status.
81
+ * @returns The mandate's updated status.
82
+ * @throws {NombaError} The status transition is invalid, or the request failed.
83
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
84
+ * check the mandate status before retrying.
85
+ */
86
+ updateMandateStatus(params) {
87
+ return this.http.request("PUT", "/v1/direct-debits/update-status", {
88
+ body: params,
89
+ });
90
+ }
91
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @module nomba/services/v1/electricity
3
+ * @description Electricity (v1): GET /v1/bill/electricity/discos, GET /v1/bill/electricity/lookup
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
7
+ import type { IElectricityService } from "../../../interfaces/v1/electricity/index.js";
8
+ import type { ElectricityProvidersResult, MeterLookupParams, MeterLookupResult } from "../../../types/v1/electricity/electricity.types.js";
9
+ /** Electricity bill lookup (v1): disco listing and meter lookup, no payment endpoint. */
10
+ export declare class ElectricityService implements IElectricityService {
11
+ private readonly http;
12
+ constructor(http: IHttpClient);
13
+ /**
14
+ * `GET /v1/bill/electricity/discos`.
15
+ * @returns The electricity distribution companies (discos) available for meter lookup.
16
+ * @throws {NombaError} The request failed.
17
+ */
18
+ getElectricityProviders(): Promise<ElectricityProvidersResult>;
19
+ /**
20
+ * `GET /v1/bill/electricity/lookup`.
21
+ * @param params The disco and meter number to look up.
22
+ * @returns The meter's customer details.
23
+ * @throws {NombaError} The meter number is invalid or not found, or the request failed.
24
+ */
25
+ lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
26
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module nomba/services/v1/electricity
3
+ * @description Electricity (v1): GET /v1/bill/electricity/discos, GET /v1/bill/electricity/lookup
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ /** Electricity bill lookup (v1): disco listing and meter lookup, no payment endpoint. */
7
+ export class ElectricityService {
8
+ http;
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /**
13
+ * `GET /v1/bill/electricity/discos`.
14
+ * @returns The electricity distribution companies (discos) available for meter lookup.
15
+ * @throws {NombaError} The request failed.
16
+ */
17
+ getElectricityProviders() {
18
+ return this.http.request("GET", "/v1/bill/electricity/discos");
19
+ }
20
+ /**
21
+ * `GET /v1/bill/electricity/lookup`.
22
+ * @param params The disco and meter number to look up.
23
+ * @returns The meter's customer details.
24
+ * @throws {NombaError} The meter number is invalid or not found, or the request failed.
25
+ */
26
+ lookupMeter(params) {
27
+ return this.http.request("GET", "/v1/bill/electricity/lookup", {
28
+ query: params,
29
+ });
30
+ }
31
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @module nomba/globals/collections
3
+ * @description Nomba SDK for Node.js
4
+ * @description Global Collections resource: DRC mobile money inflows
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/products/global-collections/introduction
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IGlobalCollectionsService } from "../../../interfaces/v1/globals/collections/IGlobalCollectionsService.js";
17
+ import type { CollectionTransaction, InflowProvider, InflowResult, InitiateInflowParams } from "../../../types/v1/globals/collections.types.js";
18
+ /** Global Collections (v1): DRC mobile money inflows. */
19
+ export declare class GlobalCollectionsService implements IGlobalCollectionsService {
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /**
23
+ * `GET /v1/global-collection/drc/inflow/providers`.
24
+ * @returns The mobile money providers available for DRC inflows.
25
+ * @throws {NombaError} The request failed.
26
+ */
27
+ inflowProviders(): Promise<InflowProvider[]>;
28
+ /**
29
+ * `POST /v1/global-collection/inflow/initiate`. Prompts the customer to approve the charge on their phone.
30
+ * @param params The inflow to initiate; `idempotencyKey` defaults to a generated one.
31
+ * @returns The initiated inflow, including its `transactionReference`.
32
+ * @throws {NombaError} The inflow params were rejected.
33
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
34
+ * check the transaction status before retrying.
35
+ */
36
+ initiateInflow(params: InitiateInflowParams): Promise<InflowResult>;
37
+ /**
38
+ * `GET /v1/global-collection/transactions/{transactionId}`, with the `transactionReference` from `initiateInflow`.
39
+ * @param transactionId The transaction reference to look up.
40
+ * @returns The transaction's current state.
41
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
42
+ */
43
+ getTransaction(transactionId: string): Promise<CollectionTransaction>;
44
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module nomba/globals/collections
3
+ * @description Nomba SDK for Node.js
4
+ * @description Global Collections resource: DRC mobile money inflows
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/products/global-collections/introduction
14
+ */
15
+ import { randomUUID } from "node:crypto";
16
+ import { pathId } from "../../../lib/util.js";
17
+ /** Global Collections (v1): DRC mobile money inflows. */
18
+ export class GlobalCollectionsService {
19
+ http;
20
+ constructor(http) {
21
+ this.http = http;
22
+ }
23
+ /**
24
+ * `GET /v1/global-collection/drc/inflow/providers`.
25
+ * @returns The mobile money providers available for DRC inflows.
26
+ * @throws {NombaError} The request failed.
27
+ */
28
+ inflowProviders() {
29
+ return this.http.request("GET", "/v1/global-collection/drc/inflow/providers");
30
+ }
31
+ /**
32
+ * `POST /v1/global-collection/inflow/initiate`. Prompts the customer to approve the charge on their phone.
33
+ * @param params The inflow to initiate; `idempotencyKey` defaults to a generated one.
34
+ * @returns The initiated inflow, including its `transactionReference`.
35
+ * @throws {NombaError} The inflow params were rejected.
36
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
37
+ * check the transaction status before retrying.
38
+ */
39
+ initiateInflow(params) {
40
+ const idempotencyKey = params.idempotencyKey || randomUUID();
41
+ return this.http.request("POST", "/v1/global-collection/inflow/initiate", {
42
+ body: { ...params, idempotencyKey },
43
+ idempotencyKey,
44
+ });
45
+ }
46
+ /**
47
+ * `GET /v1/global-collection/transactions/{transactionId}`, with the `transactionReference` from `initiateInflow`.
48
+ * @param transactionId The transaction reference to look up.
49
+ * @returns The transaction's current state.
50
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
51
+ */
52
+ async getTransaction(transactionId) {
53
+ return this.http.request("GET", `/v1/global-collection/transactions/${pathId(transactionId)}`);
54
+ }
55
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @module nomba/globals/payouts
3
+ * @description Nomba SDK for Node.js
4
+ * @description Cross-border transfers and currency exchange 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/products/global-payout/introduction
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IGlobalPayoutService } from "../../../interfaces/v1/globals/payouts/IGlobalPayoutService.js";
17
+ import type { CallOptions } from "../../../types/common/common.types.js";
18
+ import type { AuthorizeExchangeParams, AuthorizeTransferParams, Conversion, ConvertMoneyParams, ExchangeRate, ExchangeRatesParams, InstitutionProvider, InstitutionProvidersParams, PaymentMethodInfo, PaymentMethodsParams, PayoutAccount, PayoutResult, PayoutTransaction } from "../../../types/v1/globals/payout.types.js";
19
+ /** Global Payout (v1): cross-border transfers, currency exchange, and multi-currency wallets. */
20
+ export declare class GlobalPayoutService implements IGlobalPayoutService {
21
+ #private;
22
+ private readonly http;
23
+ constructor(http: IHttpClient);
24
+ /**
25
+ * `GET /v1/global-payout/accounts`.
26
+ * @returns Every currency wallet, with its balance.
27
+ * @throws {NombaError} The request failed.
28
+ */
29
+ listAccounts(): Promise<PayoutAccount[]>;
30
+ /**
31
+ * `GET /v1/global-payout/accounts/{accountId}`.
32
+ * @param accountId The wallet to look up.
33
+ * @returns The wallet's details and balance.
34
+ * @throws {NombaError} `accountId` is not one of your wallets (404), or the request failed.
35
+ */
36
+ getAccount(accountId: string): Promise<PayoutAccount>;
37
+ /**
38
+ * `GET /v1/sandbox/global-payout/accounts`.
39
+ * @returns Canned test wallet data.
40
+ * @throws {NombaError} The request failed.
41
+ */
42
+ listSandboxAccounts(): Promise<PayoutAccount[]>;
43
+ /**
44
+ * `GET /v1/sandbox/global-payout/accounts/{accountId}`. Canned test data; any id is echoed back.
45
+ * @param accountId The wallet id to echo back in the canned response.
46
+ * @returns Canned test wallet data for that id.
47
+ * @throws {NombaError} The request failed.
48
+ */
49
+ getSandboxAccount(accountId: string): Promise<PayoutAccount>;
50
+ /**
51
+ * `GET /v1/global-payout/exchange-rates`.
52
+ * @param params The currency pair to get a rate for.
53
+ * @returns The matching exchange rates.
54
+ * @throws {NombaError} The request failed.
55
+ */
56
+ exchangeRates(params: ExchangeRatesParams): Promise<ExchangeRate[]>;
57
+ /**
58
+ * `POST /v1/global-payout/money/convert`. A calculation only; no money moves.
59
+ * @param params The amount and currency pair to convert.
60
+ * @returns The converted amount and rate used.
61
+ * @throws {NombaError} The request failed.
62
+ */
63
+ convert(params: ConvertMoneyParams): Promise<Conversion>;
64
+ /**
65
+ * `GET /v1/global-payout/bank/providers`.
66
+ * @param params Filters, e.g. by country or currency.
67
+ * @returns The receiving institutions available for payout.
68
+ * @throws {NombaError} The request failed.
69
+ */
70
+ institutionProviders(params?: InstitutionProvidersParams): Promise<InstitutionProvider[]>;
71
+ /**
72
+ * `GET /v1/global-payout/payment-methods`.
73
+ * @param params Filters, e.g. by country or currency.
74
+ * @returns The payment methods available for payout.
75
+ * @throws {NombaError} The request failed.
76
+ */
77
+ paymentMethods(params?: PaymentMethodsParams): Promise<PaymentMethodInfo[]>;
78
+ /**
79
+ * `POST /v1/global-payout/transfer/authorize`. Sends money cross-border.
80
+ * @param params The transfer to authorize; `idempotencyKey` defaults to a generated one.
81
+ * @param options Per-call overrides, including `okCodes`/`onOutcome` via `CallOptions`.
82
+ * @returns The settled payout result (or the type `options` maps it to).
83
+ * @throws {NombaError} The transfer was rejected.
84
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed
85
+ * (not thrown if `options` resolves unknown outcomes instead).
86
+ */
87
+ authorizeTransfer<R = PayoutResult>(params: AuthorizeTransferParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
88
+ /**
89
+ * `POST /v1/global-payout/exchange/authorize`. Moves money between your own wallets in different currencies.
90
+ * @param params The exchange to authorize; `idempotencyKey` defaults to a generated one.
91
+ * @param options Per-call overrides, including `okCodes`/`onOutcome` via `CallOptions`.
92
+ * @returns The settled payout result (or the type `options` maps it to).
93
+ * @throws {NombaError} The exchange was rejected.
94
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed
95
+ * (not thrown if `options` resolves unknown outcomes instead).
96
+ */
97
+ authorizeExchange<R = PayoutResult>(params: AuthorizeExchangeParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
98
+ /**
99
+ * `GET /v1/global-payout/transactions/{transactionId}`, with a `wtTransactionId`.
100
+ * @param transactionId The transaction to look up.
101
+ * @returns The transaction's current state.
102
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
103
+ */
104
+ getTransaction(transactionId: string): Promise<PayoutTransaction>;
105
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @module nomba/globals/payouts
3
+ * @description Nomba SDK for Node.js
4
+ * @description Cross-border transfers and currency exchange 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/products/global-payout/introduction
14
+ */
15
+ import { randomUUID } from "node:crypto";
16
+ import { REJECTED, settle } from "../../../lib/outcome.js";
17
+ import { pathId } from "../../../lib/util.js";
18
+ // authorize-transfer documents data.status PROCESSING, PENDING, COMPLETED and FAILED. The docs never say FAILED is
19
+ // final or safe to refund, so it stays pending until confirmed (see CORRECTIONS.md); only COMPLETED is success.
20
+ const TRANSFER_OUTCOMES = {
21
+ codes: { "00": "success", ...REJECTED },
22
+ statuses: {
23
+ COMPLETED: "success",
24
+ PROCESSING: "pending",
25
+ PENDING: "pending",
26
+ FAILED: "pending",
27
+ },
28
+ };
29
+ // authorize-exchange documents no status values (examples only), so it is classified by code alone.
30
+ const EXCHANGE_OUTCOMES = {
31
+ codes: { "00": "success", ...REJECTED },
32
+ };
33
+ /** Global Payout (v1): cross-border transfers, currency exchange, and multi-currency wallets. */
34
+ export class GlobalPayoutService {
35
+ http;
36
+ constructor(http) {
37
+ this.http = http;
38
+ }
39
+ /**
40
+ * `GET /v1/global-payout/accounts`.
41
+ * @returns Every currency wallet, with its balance.
42
+ * @throws {NombaError} The request failed.
43
+ */
44
+ listAccounts() {
45
+ return this.http.request("GET", "/v1/global-payout/accounts");
46
+ }
47
+ /**
48
+ * `GET /v1/global-payout/accounts/{accountId}`.
49
+ * @param accountId The wallet to look up.
50
+ * @returns The wallet's details and balance.
51
+ * @throws {NombaError} `accountId` is not one of your wallets (404), or the request failed.
52
+ */
53
+ async getAccount(accountId) {
54
+ return this.http.request("GET", `/v1/global-payout/accounts/${pathId(accountId)}`);
55
+ }
56
+ /**
57
+ * `GET /v1/sandbox/global-payout/accounts`.
58
+ * @returns Canned test wallet data.
59
+ * @throws {NombaError} The request failed.
60
+ */
61
+ listSandboxAccounts() {
62
+ return this.http.request("GET", "/v1/sandbox/global-payout/accounts");
63
+ }
64
+ /**
65
+ * `GET /v1/sandbox/global-payout/accounts/{accountId}`. Canned test data; any id is echoed back.
66
+ * @param accountId The wallet id to echo back in the canned response.
67
+ * @returns Canned test wallet data for that id.
68
+ * @throws {NombaError} The request failed.
69
+ */
70
+ async getSandboxAccount(accountId) {
71
+ return this.http.request("GET", `/v1/sandbox/global-payout/accounts/${pathId(accountId)}`);
72
+ }
73
+ /**
74
+ * `GET /v1/global-payout/exchange-rates`.
75
+ * @param params The currency pair to get a rate for.
76
+ * @returns The matching exchange rates.
77
+ * @throws {NombaError} The request failed.
78
+ */
79
+ async exchangeRates(params) {
80
+ const data = await this.http.request("GET", "/v1/global-payout/exchange-rates", { query: params });
81
+ return data.rates;
82
+ }
83
+ /**
84
+ * `POST /v1/global-payout/money/convert`. A calculation only; no money moves.
85
+ * @param params The amount and currency pair to convert.
86
+ * @returns The converted amount and rate used.
87
+ * @throws {NombaError} The request failed.
88
+ */
89
+ convert(params) {
90
+ return this.http.request("POST", "/v1/global-payout/money/convert", {
91
+ body: params,
92
+ });
93
+ }
94
+ /**
95
+ * `GET /v1/global-payout/bank/providers`.
96
+ * @param params Filters, e.g. by country or currency.
97
+ * @returns The receiving institutions available for payout.
98
+ * @throws {NombaError} The request failed.
99
+ */
100
+ institutionProviders(params = {}) {
101
+ return this.http.request("GET", "/v1/global-payout/bank/providers", {
102
+ query: params,
103
+ });
104
+ }
105
+ /**
106
+ * `GET /v1/global-payout/payment-methods`.
107
+ * @param params Filters, e.g. by country or currency.
108
+ * @returns The payment methods available for payout.
109
+ * @throws {NombaError} The request failed.
110
+ */
111
+ paymentMethods(params = {}) {
112
+ return this.http.request("GET", "/v1/global-payout/payment-methods", {
113
+ query: params,
114
+ });
115
+ }
116
+ /**
117
+ * `POST /v1/global-payout/transfer/authorize`. Sends money cross-border.
118
+ * @param params The transfer to authorize; `idempotencyKey` defaults to a generated one.
119
+ * @param options Per-call overrides, including `okCodes`/`onOutcome` via `CallOptions`.
120
+ * @returns The settled payout result (or the type `options` maps it to).
121
+ * @throws {NombaError} The transfer was rejected.
122
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed
123
+ * (not thrown if `options` resolves unknown outcomes instead).
124
+ */
125
+ async authorizeTransfer(params, options = {}) {
126
+ return this.#authorize("/v1/global-payout/transfer/authorize", params, options, TRANSFER_OUTCOMES);
127
+ }
128
+ /**
129
+ * `POST /v1/global-payout/exchange/authorize`. Moves money between your own wallets in different currencies.
130
+ * @param params The exchange to authorize; `idempotencyKey` defaults to a generated one.
131
+ * @param options Per-call overrides, including `okCodes`/`onOutcome` via `CallOptions`.
132
+ * @returns The settled payout result (or the type `options` maps it to).
133
+ * @throws {NombaError} The exchange was rejected.
134
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed
135
+ * (not thrown if `options` resolves unknown outcomes instead).
136
+ */
137
+ async authorizeExchange(params, options = {}) {
138
+ return this.#authorize("/v1/global-payout/exchange/authorize", params, options, EXCHANGE_OUTCOMES);
139
+ }
140
+ /**
141
+ * `GET /v1/global-payout/transactions/{transactionId}`, with a `wtTransactionId`.
142
+ * @param transactionId The transaction to look up.
143
+ * @returns The transaction's current state.
144
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
145
+ */
146
+ async getTransaction(transactionId) {
147
+ return this.http.request("GET", `/v1/global-payout/transactions/${pathId(transactionId)}`);
148
+ }
149
+ // One key in the body (the one the API dedupes on) and the header, so OutcomeUnknownError reports it.
150
+ #authorize(path, params, options, table) {
151
+ const idempotencyKey = params.idempotencyKey || randomUUID();
152
+ return settle(this.http, "POST", path, { body: { ...params, idempotencyKey } }, table, idempotencyKey, options);
153
+ }
154
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module nomba/requery
3
+ * @description Nomba SDK for Node.js
4
+ * @description Requery 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/requery
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IRequeryService } from "../../../interfaces/v1/requery/IRequeryService.js";
17
+ import type { Transaction, TransactionLookup } from "../../../types/v1/requery/requery.types.js";
18
+ export declare class RequeryService implements IRequeryService {
19
+ private readonly http;
20
+ constructor(http: IHttpClient);
21
+ /** GET /v1/transactions/accounts/single */
22
+ fetchParentTransaction(lookup: TransactionLookup): Promise<Transaction>;
23
+ /** GET /v1/transactions/accounts/{subAccountId}/single */
24
+ fetchSubAccountTransaction(subAccountId: string, lookup: TransactionLookup): Promise<Transaction>;
25
+ /**
26
+ * GET /v1/transactions/requery/{sessionId}. Use for transfers made through both parent and sub
27
+ * accounts. Nomba-to-Nomba wallet transfers return no sessionId; use fetchParentTransaction or
28
+ * fetchSubAccountTransaction for those instead.
29
+ */
30
+ requeryBySession(sessionId: string): Promise<Transaction>;
31
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @module nomba/requery
3
+ * @description Nomba SDK for Node.js
4
+ * @description Requery 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/requery
14
+ */
15
+ import { pathId } from "../../../lib/util.js";
16
+ export class RequeryService {
17
+ http;
18
+ constructor(http) {
19
+ this.http = http;
20
+ }
21
+ /** GET /v1/transactions/accounts/single */
22
+ fetchParentTransaction(lookup) {
23
+ return this.http.request("GET", "/v1/transactions/accounts/single", {
24
+ query: lookup,
25
+ });
26
+ }
27
+ /** GET /v1/transactions/accounts/{subAccountId}/single */
28
+ async fetchSubAccountTransaction(subAccountId, lookup) {
29
+ return this.http.request("GET", `/v1/transactions/accounts/${pathId(subAccountId)}/single`, {
30
+ query: lookup,
31
+ });
32
+ }
33
+ /**
34
+ * GET /v1/transactions/requery/{sessionId}. Use for transfers made through both parent and sub
35
+ * accounts. Nomba-to-Nomba wallet transfers return no sessionId; use fetchParentTransaction or
36
+ * fetchSubAccountTransaction for those instead.
37
+ */
38
+ async requeryBySession(sessionId) {
39
+ return this.http.request("GET", `/v1/transactions/requery/${pathId(sessionId)}`);
40
+ }
41
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module nomba/terminals
3
+ * @description Nomba SDK for Node.js
4
+ * @description Terminals 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/terminals
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { ITerminalsService } from "../../../interfaces/v1/terminals/index.js";
17
+ import type { CallOptions } from "../../../types/common/common.types.js";
18
+ import type { AssignTerminalParams, PushPaymentRequestParams, Terminal, TerminalPayment } from "../../../types/v1/terminals/terminals.types.js";
19
+ export declare class TerminalsService implements ITerminalsService {
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /** POST /v1/terminals/assign */
23
+ assignToParent(params: AssignTerminalParams): Promise<Terminal>;
24
+ /** POST /v1/terminals/assign/{subAccountId} */
25
+ assignToSubAccount(subAccountId: string, params: AssignTerminalParams): Promise<Terminal>;
26
+ /** POST /v1/terminals/unassign */
27
+ unassignFromParent(params: AssignTerminalParams): Promise<Terminal>;
28
+ /** POST /v1/terminals/unassign/{subAccountId} */
29
+ unassignFromSubAccount(subAccountId: string, params: AssignTerminalParams): Promise<Terminal>;
30
+ /**
31
+ * POST /v1/terminals/payment-request/{terminalId}. Triggers a payment prompt on the physical terminal.
32
+ * ponytail: the spec lists no accountId header for this endpoint, unlike every other one; sent anyway
33
+ * since every sibling endpoint requires it and an unused header is harmless. Drop it if a real call 4xxs.
34
+ * Defaults the idempotency key to `merchantTxRef`, same as transfers, so a retry after a timeout doesn't
35
+ * re-prompt the terminal.
36
+ */
37
+ pushPaymentRequest<R = TerminalPayment>(terminalId: string, params: PushPaymentRequestParams, options?: CallOptions<TerminalPayment, R>): Promise<TerminalPayment | R>;
38
+ }