@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,58 @@
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 { REJECTED, settle } from "../../../lib/outcome.js";
16
+ import { pathId } from "../../../lib/util.js";
17
+ // Documented: code "00"; data.status pending, completed or failed. As with Global Payout, the docs never say
18
+ // "failed" is final, so only "completed" is success.
19
+ const PAYMENT_REQUEST_OUTCOMES = {
20
+ codes: { "00": "success", ...REJECTED },
21
+ statuses: { completed: "success", pending: "pending", failed: "pending" },
22
+ };
23
+ export class TerminalsService {
24
+ http;
25
+ constructor(http) {
26
+ this.http = http;
27
+ }
28
+ /** POST /v1/terminals/assign */
29
+ assignToParent(params) {
30
+ return this.http.request("POST", "/v1/terminals/assign", {
31
+ body: params,
32
+ });
33
+ }
34
+ /** POST /v1/terminals/assign/{subAccountId} */
35
+ async assignToSubAccount(subAccountId, params) {
36
+ return this.http.request("POST", `/v1/terminals/assign/${pathId(subAccountId)}`, { body: params });
37
+ }
38
+ /** POST /v1/terminals/unassign */
39
+ unassignFromParent(params) {
40
+ return this.http.request("POST", "/v1/terminals/unassign", {
41
+ body: params,
42
+ });
43
+ }
44
+ /** POST /v1/terminals/unassign/{subAccountId} */
45
+ async unassignFromSubAccount(subAccountId, params) {
46
+ return this.http.request("POST", `/v1/terminals/unassign/${pathId(subAccountId)}`, { body: params });
47
+ }
48
+ /**
49
+ * POST /v1/terminals/payment-request/{terminalId}. Triggers a payment prompt on the physical terminal.
50
+ * ponytail: the spec lists no accountId header for this endpoint, unlike every other one; sent anyway
51
+ * since every sibling endpoint requires it and an unused header is harmless. Drop it if a real call 4xxs.
52
+ * Defaults the idempotency key to `merchantTxRef`, same as transfers, so a retry after a timeout doesn't
53
+ * re-prompt the terminal.
54
+ */
55
+ async pushPaymentRequest(terminalId, params, options = {}) {
56
+ return settle(this.http, "POST", `/v1/terminals/payment-request/${pathId(terminalId)}`, { body: params }, PAYMENT_REQUEST_OUTCOMES, params.merchantTxRef, options);
57
+ }
58
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @module nomba/transactions
3
+ * @description Nomba SDK for Node.js
4
+ * @description Transactions 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/transactions
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { ITransactionsService } from "../../../interfaces/v1/transactions/ITransactionsService.js";
17
+ import type { Page } from "../../../lib/util.js";
18
+ import type { Transaction } from "../../../types/v1/requery/requery.types.js";
19
+ import type { BankTransaction, BankTransactionList, FilterTransactionsParams, TransactionList, TransactionListParams, VirtualAccountTransaction, VirtualAccountTransactionParams } from "../../../types/v1/transactions/transactions.types.js";
20
+ export declare class TransactionsService implements ITransactionsService {
21
+ private readonly http;
22
+ constructor(http: IHttpClient);
23
+ /** GET /v1/transactions/bank. Credit/debit transactions on the parent account. */
24
+ listBankTransactions(params?: TransactionListParams): Promise<BankTransactionList>;
25
+ /** Every credit/debit transaction, across all pages. Starts at `params.cursor` if given. */
26
+ iterateBankTransactions(params?: TransactionListParams): AsyncGenerator<BankTransaction>;
27
+ /**
28
+ * GET /v1/transactions/virtual. Documented in the guide only. The response carries a `cursor`, but the
29
+ * guide names no paging parameter, so only the first page is returned.
30
+ */
31
+ listVirtualAccountTransactions({ accountNumber, ...dates }: VirtualAccountTransactionParams): Promise<Page<VirtualAccountTransaction>>;
32
+ /** GET /v1/transactions/accounts */
33
+ listParentTransactions(params?: TransactionListParams): Promise<TransactionList>;
34
+ /** Every transaction on the parent account, across all pages. Starts at `params.cursor` if given. */
35
+ iterateParentTransactions(params?: TransactionListParams): AsyncGenerator<Transaction>;
36
+ /** GET /v1/transactions/accounts/{subAccountId} */
37
+ listSubAccountTransactions(subAccountId: string, params?: TransactionListParams): Promise<TransactionList>;
38
+ /** Every transaction on a sub account, across all pages. Starts at `params.cursor` if given. */
39
+ iterateSubAccountTransactions(subAccountId: string, params?: TransactionListParams): AsyncGenerator<Transaction>;
40
+ /** POST /v1/transactions/accounts */
41
+ filterParentTransactions(filter?: FilterTransactionsParams, page?: TransactionListParams): Promise<TransactionList>;
42
+ /** Every parent transaction matching the filter, across all pages. Starts at `page.cursor` if given. */
43
+ iterateFilteredParentTransactions(filter?: FilterTransactionsParams, page?: TransactionListParams): AsyncGenerator<Transaction>;
44
+ /** POST /v1/transactions/accounts/{subAccountId} */
45
+ filterSubAccountTransactions(subAccountId: string, filter?: FilterTransactionsParams, page?: TransactionListParams): Promise<TransactionList>;
46
+ /** Every sub account transaction matching the filter, across all pages. Starts at `page.cursor` if given. */
47
+ iterateFilteredSubAccountTransactions(subAccountId: string, filter?: FilterTransactionsParams, page?: TransactionListParams): AsyncGenerator<Transaction>;
48
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @module nomba/transactions
3
+ * @description Nomba SDK for Node.js
4
+ * @description Transactions 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/transactions
14
+ */
15
+ import { paginate } from "../../../lib/paginate.js";
16
+ import { pageQuery, pathId } from "../../../lib/util.js";
17
+ export class TransactionsService {
18
+ http;
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ /** GET /v1/transactions/bank. Credit/debit transactions on the parent account. */
23
+ listBankTransactions(params = {}) {
24
+ return this.http.request("GET", "/v1/transactions/bank", {
25
+ query: pageQuery(params),
26
+ });
27
+ }
28
+ /** Every credit/debit transaction, across all pages. Starts at `params.cursor` if given. */
29
+ iterateBankTransactions(params = {}) {
30
+ return paginate(async (cursor) => {
31
+ const page = await this.listBankTransactions(cursor ? { ...params, cursor } : params);
32
+ return { results: page.results ?? [], cursor: page.cursor ?? "" };
33
+ });
34
+ }
35
+ /**
36
+ * GET /v1/transactions/virtual. Documented in the guide only. The response carries a `cursor`, but the
37
+ * guide names no paging parameter, so only the first page is returned.
38
+ */
39
+ listVirtualAccountTransactions({ accountNumber, ...dates }) {
40
+ return this.http.request("GET", "/v1/transactions/virtual", {
41
+ query: { virtual_account: accountNumber, ...dates },
42
+ });
43
+ }
44
+ /** GET /v1/transactions/accounts */
45
+ listParentTransactions(params = {}) {
46
+ return this.http.request("GET", "/v1/transactions/accounts", {
47
+ query: pageQuery(params),
48
+ });
49
+ }
50
+ /** Every transaction on the parent account, across all pages. Starts at `params.cursor` if given. */
51
+ iterateParentTransactions(params = {}) {
52
+ return paginate(async (cursor) => {
53
+ const page = await this.listParentTransactions(cursor ? { ...params, cursor } : params);
54
+ return { results: page.results ?? [], cursor: page.cursor ?? "" };
55
+ });
56
+ }
57
+ /** GET /v1/transactions/accounts/{subAccountId} */
58
+ async listSubAccountTransactions(subAccountId, params = {}) {
59
+ return this.http.request("GET", `/v1/transactions/accounts/${pathId(subAccountId)}`, {
60
+ query: pageQuery(params),
61
+ });
62
+ }
63
+ /** Every transaction on a sub account, across all pages. Starts at `params.cursor` if given. */
64
+ iterateSubAccountTransactions(subAccountId, params = {}) {
65
+ return paginate(async (cursor) => {
66
+ const page = await this.listSubAccountTransactions(subAccountId, cursor ? { ...params, cursor } : params);
67
+ return { results: page.results ?? [], cursor: page.cursor ?? "" };
68
+ });
69
+ }
70
+ /** POST /v1/transactions/accounts */
71
+ filterParentTransactions(filter = {}, page = {}) {
72
+ return this.http.request("POST", "/v1/transactions/accounts", {
73
+ body: filter,
74
+ query: pageQuery(page),
75
+ });
76
+ }
77
+ /** Every parent transaction matching the filter, across all pages. Starts at `page.cursor` if given. */
78
+ iterateFilteredParentTransactions(filter = {}, page = {}) {
79
+ return paginate(async (cursor) => {
80
+ const p = await this.filterParentTransactions(filter, cursor ? { ...page, cursor } : page);
81
+ return { results: p.results ?? [], cursor: p.cursor ?? "" };
82
+ });
83
+ }
84
+ /** POST /v1/transactions/accounts/{subAccountId} */
85
+ async filterSubAccountTransactions(subAccountId, filter = {}, page = {}) {
86
+ return this.http.request("POST", `/v1/transactions/accounts/${pathId(subAccountId)}`, {
87
+ body: filter,
88
+ query: pageQuery(page),
89
+ });
90
+ }
91
+ /** Every sub account transaction matching the filter, across all pages. Starts at `page.cursor` if given. */
92
+ iterateFilteredSubAccountTransactions(subAccountId, filter = {}, page = {}) {
93
+ return paginate(async (cursor) => {
94
+ const p = await this.filterSubAccountTransactions(subAccountId, filter, cursor ? { ...page, cursor } : page);
95
+ return { results: p.results ?? [], cursor: p.cursor ?? "" };
96
+ });
97
+ }
98
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module nomba/virtual-accounts
3
+ * @description Nomba SDK for Node.js
4
+ * @description Virtual Accounts 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/virtual-accounts
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IVirtualAccountsService } from "../../../interfaces/v1/virtual-accounts/IVirtualAccountsService.js";
17
+ import type { PageParams } from "../../../lib/util.js";
18
+ import type { CreatedVirtualAccount, CreateVirtualAccountParams, FilterVirtualAccountsParams, UpdateVirtualAccountParams, VirtualAccount, VirtualAccountList } from "../../../types/v1/virtual-accounts/virtual-accounts.types.js";
19
+ export declare class VirtualAccountsService implements IVirtualAccountsService {
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /** POST /v1/accounts/virtual */
23
+ create(params: CreateVirtualAccountParams): Promise<CreatedVirtualAccount>;
24
+ /** POST /v1/accounts/virtual/{subAccountId}. Funds are collected in that sub account. */
25
+ createForSubAccount(subAccountId: string, params: CreateVirtualAccountParams): Promise<CreatedVirtualAccount>;
26
+ /** GET /v1/accounts/virtual/{identifier}. `identifier` is the accountRef or the virtual account number. */
27
+ get(identifier: string): Promise<VirtualAccount>;
28
+ /** PUT /v1/accounts/virtual/{identifier}. `identifier` is the accountRef or the 10 digit account number. */
29
+ update(identifier: string, params: UpdateVirtualAccountParams): Promise<{
30
+ updated: boolean;
31
+ }>;
32
+ /** DELETE /v1/accounts/virtual/{identifier}. Stops the account accepting payments. */
33
+ expire(identifier: string): Promise<{
34
+ expired: boolean;
35
+ }>;
36
+ /** POST /v1/accounts/virtual/list */
37
+ list(filter?: FilterVirtualAccountsParams, page?: PageParams): Promise<VirtualAccountList>;
38
+ /** Every matching virtual account, across all pages. Starts at `page.cursor` if given. */
39
+ iterate(filter?: FilterVirtualAccountsParams, page?: PageParams): AsyncGenerator<VirtualAccount>;
40
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module nomba/virtual-accounts
3
+ * @description Nomba SDK for Node.js
4
+ * @description Virtual Accounts 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/virtual-accounts
14
+ */
15
+ import { paginate } from "../../../lib/paginate.js";
16
+ import { pageQuery, pathId } from "../../../lib/util.js";
17
+ export class VirtualAccountsService {
18
+ http;
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ /** POST /v1/accounts/virtual */
23
+ create(params) {
24
+ return this.http.request("POST", "/v1/accounts/virtual", {
25
+ body: params,
26
+ });
27
+ }
28
+ /** POST /v1/accounts/virtual/{subAccountId}. Funds are collected in that sub account. */
29
+ async createForSubAccount(subAccountId, params) {
30
+ return this.http.request("POST", `/v1/accounts/virtual/${pathId(subAccountId)}`, { body: params });
31
+ }
32
+ /** GET /v1/accounts/virtual/{identifier}. `identifier` is the accountRef or the virtual account number. */
33
+ async get(identifier) {
34
+ return this.http.request("GET", `/v1/accounts/virtual/${pathId(identifier)}`);
35
+ }
36
+ /** PUT /v1/accounts/virtual/{identifier}. `identifier` is the accountRef or the 10 digit account number. */
37
+ async update(identifier, params) {
38
+ return this.http.request("PUT", `/v1/accounts/virtual/${pathId(identifier)}`, { body: params });
39
+ }
40
+ /** DELETE /v1/accounts/virtual/{identifier}. Stops the account accepting payments. */
41
+ async expire(identifier) {
42
+ return this.http.request("DELETE", `/v1/accounts/virtual/${pathId(identifier)}`);
43
+ }
44
+ /** POST /v1/accounts/virtual/list */
45
+ list(filter = {}, page = {}) {
46
+ return this.http.request("POST", "/v1/accounts/virtual/list", {
47
+ body: filter,
48
+ query: pageQuery(page),
49
+ });
50
+ }
51
+ /** Every matching virtual account, across all pages. Starts at `page.cursor` if given. */
52
+ iterate(filter = {}, page = {}) {
53
+ return paginate((cursor) => this.list(filter, cursor ? { ...page, cursor } : page));
54
+ }
55
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @module nomba/webhooks
3
+ * @description Nomba SDK for Node.js
4
+ * @description Webhooks resource: delivery logs, re-push and replay
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-basics/troubleshoot-webhooks
14
+ */
15
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
16
+ import type { IWebhooksService } from "../../../interfaces/v1/webhooks/IWebhooksService.js";
17
+ import type { EventLog, EventLogsParams, EventsParams, ReplayParams, WebhookList, WebhookSubscription } from "../../../types/v1/webhooks/webhooks.types.js";
18
+ export declare class WebhooksService implements IWebhooksService {
19
+ #private;
20
+ private readonly http;
21
+ constructor(http: IHttpClient);
22
+ /** POST /v1/webhooks/event-logs. Webhooks sent to your system and how your server answered. */
23
+ eventLogs(params?: EventLogsParams): Promise<WebhookList<EventLog>>;
24
+ /** POST /v1/webhooks/events. Your webhook subscriptions. */
25
+ events(params?: EventsParams): Promise<WebhookList<WebhookSubscription>>;
26
+ /**
27
+ * POST /v1/webhooks/re-push. Resends one event. Takes an event log's `hookRequestId`; the request field
28
+ * is spelled `hooksRequestId`, as the guide shows.
29
+ */
30
+ repush(hookRequestId: string): Promise<void>;
31
+ /** POST /v1/webhooks/bulk-re-push */
32
+ bulkRepush(hookRequestIds: string[]): Promise<void>;
33
+ /** POST /v1/webhooks/replay. Resends every matching event in the time window. */
34
+ replay(params: ReplayParams): Promise<void>;
35
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @module nomba/webhooks
3
+ * @description Nomba SDK for Node.js
4
+ * @description Webhooks resource: delivery logs, re-push and replay
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-basics/troubleshoot-webhooks
14
+ */
15
+ // Documented in the guide only (no API reference page). Its examples answer code "200", not "00", and never
16
+ // mark request fields as required, so every field is optional here.
17
+ const OK_CODES = ["00", "200"];
18
+ export class WebhooksService {
19
+ http;
20
+ constructor(http) {
21
+ this.http = http;
22
+ }
23
+ /** POST /v1/webhooks/event-logs. Webhooks sent to your system and how your server answered. */
24
+ eventLogs(params = {}) {
25
+ return this.http.request("POST", "/v1/webhooks/event-logs", {
26
+ body: params,
27
+ okCodes: OK_CODES,
28
+ });
29
+ }
30
+ /** POST /v1/webhooks/events. Your webhook subscriptions. */
31
+ events(params = {}) {
32
+ return this.http.request("POST", "/v1/webhooks/events", {
33
+ body: params,
34
+ okCodes: OK_CODES,
35
+ });
36
+ }
37
+ /**
38
+ * POST /v1/webhooks/re-push. Resends one event. Takes an event log's `hookRequestId`; the request field
39
+ * is spelled `hooksRequestId`, as the guide shows.
40
+ */
41
+ repush(hookRequestId) {
42
+ return this.#post("re-push", { hooksRequestId: hookRequestId });
43
+ }
44
+ /** POST /v1/webhooks/bulk-re-push */
45
+ bulkRepush(hookRequestIds) {
46
+ return this.#post("bulk-re-push", { hooksRequestIds: hookRequestIds });
47
+ }
48
+ /** POST /v1/webhooks/replay. Resends every matching event in the time window. */
49
+ replay(params) {
50
+ return this.#post("replay", params);
51
+ }
52
+ // These answer with no `data`, so the client resolves to undefined.
53
+ #post(path, body) {
54
+ return this.http.request("POST", `/v1/webhooks/${path}`, {
55
+ body,
56
+ okCodes: OK_CODES,
57
+ });
58
+ }
59
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @module nomba/services/v2/airtime
3
+ * @description AirtimeV2 (v2): POST /v2/bill/topup
4
+ * @see https://developer.nomba.com/docs/api-reference/airtime-and-data-vending
5
+ */
6
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
7
+ import type { IAirtimeV2Service } from "../../../interfaces/v2/airtime/index.js";
8
+ import type { CallOptions } from "../../../types/common/common.types.js";
9
+ import type { AirtimePurchaseParams, AirtimePurchaseV2Result } from "../../../types/v2/airtime/airtime.types.js";
10
+ /**
11
+ * Airtime top-ups (v2). A call that throws a NombaError with a 4xx status was rejected and did nothing.
12
+ * Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
13
+ * `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
14
+ */
15
+ export declare class AirtimeV2Service implements IAirtimeV2Service {
16
+ #private;
17
+ private readonly http;
18
+ constructor(http: IHttpClient);
19
+ /**
20
+ * `POST /v2/bill/topup`. Buys airtime from the parent account.
21
+ * @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
22
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
23
+ * a rejection or pending outcome throws.
24
+ * @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
25
+ * @throws {NombaError} The purchase was rejected (4xx).
26
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
27
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
28
+ */
29
+ buyAirtime<R = AirtimePurchaseV2Result>(params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
30
+ /**
31
+ * `POST /v2/bill/topup/{subAccountId}`. Buys airtime from a sub account.
32
+ * @param subAccountId The sub account to buy from.
33
+ * @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
34
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
35
+ * a rejection or pending outcome throws.
36
+ * @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
37
+ * @throws {NombaError} The purchase was rejected (4xx).
38
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
39
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
40
+ */
41
+ buyAirtimeFromSubAccount<R = AirtimePurchaseV2Result>(subAccountId: string, params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
42
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module nomba/services/v2/airtime
3
+ * @description AirtimeV2 (v2): POST /v2/bill/topup
4
+ * @see https://developer.nomba.com/docs/api-reference/airtime-and-data-vending
5
+ */
6
+ import { REJECTED, settle } from "../../../lib/outcome.js";
7
+ import { pathId } from "../../../lib/util.js";
8
+ // The v2 reference documents code "200" (done) or "201" (still processing), and data.status SUCCESS or
9
+ // PENDING_BILLING; anything else is to be treated as pending. A sandbox call (2026-09-29) returned "200" +
10
+ // SUCCESS. The guides show "00" for success too, so we accept both.
11
+ const OUTCOMES = {
12
+ codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
13
+ statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
14
+ };
15
+ /**
16
+ * Airtime top-ups (v2). A call that throws a NombaError with a 4xx status was rejected and did nothing.
17
+ * Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
18
+ * `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
19
+ */
20
+ export class AirtimeV2Service {
21
+ http;
22
+ constructor(http) {
23
+ this.http = http;
24
+ }
25
+ /**
26
+ * `POST /v2/bill/topup`. Buys airtime from the parent account.
27
+ * @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
28
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
29
+ * a rejection or pending outcome throws.
30
+ * @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
31
+ * @throws {NombaError} The purchase was rejected (4xx).
32
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
33
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
34
+ */
35
+ async buyAirtime(params, options = {}) {
36
+ return this.#buy("/v2/bill/topup", params, options);
37
+ }
38
+ /**
39
+ * `POST /v2/bill/topup/{subAccountId}`. Buys airtime from a sub account.
40
+ * @param subAccountId The sub account to buy from.
41
+ * @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
42
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
43
+ * a rejection or pending outcome throws.
44
+ * @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
45
+ * @throws {NombaError} The purchase was rejected (4xx).
46
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
47
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
48
+ */
49
+ async buyAirtimeFromSubAccount(subAccountId, params, options = {}) {
50
+ return this.#buy(`/v2/bill/topup/${pathId(subAccountId)}`, params, options);
51
+ }
52
+ #buy(path, params, options) {
53
+ return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
54
+ }
55
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module nomba/services/v2/betting
3
+ * @description BettingV2 (v2): POST /v2/bill/betting[/{subAccountId}]
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
7
+ import type { IBettingV2Service } from "../../../interfaces/v2/betting/index.js";
8
+ import type { CallOptions } from "../../../types/common/common.types.js";
9
+ import type { BettingPaymentParams, BettingPaymentV2Result } from "../../../types/v2/betting/betting.types.js";
10
+ /**
11
+ * Betting wallet funding (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
12
+ * status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
13
+ * unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
14
+ * reference.
15
+ */
16
+ export declare class BettingV2Service implements IBettingV2Service {
17
+ #private;
18
+ private readonly http;
19
+ constructor(http: IHttpClient);
20
+ /**
21
+ * `POST /v2/bill/betting`. Funds a betting wallet from the parent account.
22
+ * @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
23
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
24
+ * a rejection or pending outcome throws.
25
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
26
+ * @throws {NombaError} The payment was rejected (4xx).
27
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
28
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
29
+ */
30
+ payBetting<R = BettingPaymentV2Result>(params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
31
+ /**
32
+ * `POST /v2/bill/betting/{subAccountId}`. Pays from a sub account.
33
+ * @param subAccountId The sub account to pay from.
34
+ * @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
35
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
36
+ * a rejection or pending outcome throws.
37
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
38
+ * @throws {NombaError} The payment was rejected (4xx).
39
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
40
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
41
+ */
42
+ payBettingFromSubAccount<R = BettingPaymentV2Result>(subAccountId: string, params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
43
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @module nomba/services/v2/betting
3
+ * @description BettingV2 (v2): POST /v2/bill/betting[/{subAccountId}]
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import { REJECTED, settle } from "../../../lib/outcome.js";
7
+ import { pathId } from "../../../lib/util.js";
8
+ // The v2 reference documents code "200" (done) or "201" (still processing), and data.status SUCCESS or
9
+ // PENDING_BILLING; anything else is to be treated as pending. Sandbox calls (2026-09-29) returned "200" +
10
+ // SUCCESS. The guides show "00" for success too, so we accept both.
11
+ const OUTCOMES = {
12
+ codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
13
+ statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
14
+ };
15
+ /**
16
+ * Betting wallet funding (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
17
+ * status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
18
+ * unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
19
+ * reference.
20
+ */
21
+ export class BettingV2Service {
22
+ http;
23
+ constructor(http) {
24
+ this.http = http;
25
+ }
26
+ /**
27
+ * `POST /v2/bill/betting`. Funds a betting wallet from the parent account.
28
+ * @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
29
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
30
+ * a rejection or pending outcome throws.
31
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
32
+ * @throws {NombaError} The payment was rejected (4xx).
33
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
34
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
35
+ */
36
+ async payBetting(params, options = {}) {
37
+ return this.#pay("/v2/bill/betting", params, options);
38
+ }
39
+ /**
40
+ * `POST /v2/bill/betting/{subAccountId}`. Pays from a sub account.
41
+ * @param subAccountId The sub account to pay from.
42
+ * @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
43
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
44
+ * a rejection or pending outcome throws.
45
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
46
+ * @throws {NombaError} The payment was rejected (4xx).
47
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
48
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
49
+ */
50
+ async payBettingFromSubAccount(subAccountId, params, options = {}) {
51
+ return this.#pay(`/v2/bill/betting/${pathId(subAccountId)}`, params, options);
52
+ }
53
+ #pay(path, params, options) {
54
+ return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
55
+ }
56
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module nomba/services/v2/cable
3
+ * @description CableV2 (v2): POST /v2/bill/cabletv[/{subAccountId}]
4
+ * @see https://developer.nomba.com/docs/api-reference/bills
5
+ */
6
+ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
7
+ import type { ICableV2Service } from "../../../interfaces/v2/cable/index.js";
8
+ import type { CallOptions } from "../../../types/common/common.types.js";
9
+ import type { CablePaymentV2Result, CableTvSubscriptionParams } from "../../../types/v2/cable/cable.types.js";
10
+ /**
11
+ * Cable TV subscription payments (v2 has purchase endpoints only). A call that throws a NombaError with a
12
+ * 4xx status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the
13
+ * outcome unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a
14
+ * new reference.
15
+ */
16
+ export declare class CableV2Service implements ICableV2Service {
17
+ #private;
18
+ private readonly http;
19
+ constructor(http: IHttpClient);
20
+ /**
21
+ * `POST /v2/bill/cabletv`. Pays a cable TV subscription from the parent account.
22
+ * @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
23
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
24
+ * a rejection or pending outcome throws.
25
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
26
+ * @throws {NombaError} The payment was rejected (4xx).
27
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
28
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
29
+ */
30
+ subscribeCableTv<R = CablePaymentV2Result>(params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
31
+ /**
32
+ * `POST /v2/bill/cabletv/{subAccountId}`. Pays from a sub account.
33
+ * @param subAccountId The sub account to pay from.
34
+ * @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
35
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
36
+ * a rejection or pending outcome throws.
37
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
38
+ * @throws {NombaError} The payment was rejected (4xx).
39
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
40
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
41
+ */
42
+ subscribeCableTvFromSubAccount<R = CablePaymentV2Result>(subAccountId: string, params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
43
+ }