@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,20 @@
1
+ /**
2
+ * @module nomba/interfaces/v1/electricity
3
+ * @description Electricity v1 service contract for validation endpoints
4
+ */
5
+ import type { ElectricityProvidersResult, MeterLookupParams, MeterLookupResult } from "../../../types/v1/electricity/electricity.types.js";
6
+ export interface IElectricityService {
7
+ /**
8
+ * `GET /v1/bill/electricity/discos`.
9
+ * @returns The electricity distribution companies (discos) available for meter lookup.
10
+ * @throws {NombaError} The request failed.
11
+ */
12
+ getElectricityProviders(): Promise<ElectricityProvidersResult>;
13
+ /**
14
+ * `GET /v1/bill/electricity/lookup`.
15
+ * @param params The disco and meter number to look up.
16
+ * @returns The meter's customer details.
17
+ * @throws {NombaError} The meter number is invalid or not found, or the request failed.
18
+ */
19
+ lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
20
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/v1/electricity
3
+ * @description Electricity v1 service contract for validation endpoints
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type { IElectricityService } from "./IElectricityService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @module nomba/interfaces/global-collections
3
+ * @description GlobalCollections service contract
4
+ */
5
+ import type { CollectionTransaction, InflowProvider, InflowResult, InitiateInflowParams } from "../../../../types/v1/globals/collections.types.js";
6
+ export interface IGlobalCollectionsService {
7
+ /**
8
+ * `GET /v1/global-collection/drc/inflow/providers`.
9
+ * @returns The mobile money providers available for DRC inflows.
10
+ * @throws {NombaError} The request failed.
11
+ */
12
+ inflowProviders(): Promise<InflowProvider[]>;
13
+ /**
14
+ * `POST /v1/global-collection/inflow/initiate`. Prompts the customer to approve the charge on their phone.
15
+ * @param params The inflow to initiate; `idempotencyKey` defaults to a generated one.
16
+ * @returns The initiated inflow, including its `transactionReference`.
17
+ * @throws {NombaError} The inflow params were rejected.
18
+ * @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed;
19
+ * check the transaction status before retrying.
20
+ */
21
+ initiateInflow(params: InitiateInflowParams): Promise<InflowResult>;
22
+ /**
23
+ * `GET /v1/global-collection/transactions/{transactionId}`, with the `transactionReference` from `initiateInflow`.
24
+ * @param transactionId The transaction reference to look up.
25
+ * @returns The transaction's current state.
26
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
27
+ */
28
+ getTransaction(transactionId: string): Promise<CollectionTransaction>;
29
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/global-collections
3
+ * @description GlobalCollections service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IGlobalCollectionsService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @module nomba/interfaces/global-payout
3
+ * @description GlobalPayout service contract
4
+ */
5
+ import type { CallOptions } from "../../../../types/common/common.types.js";
6
+ import type { AuthorizeExchangeParams, AuthorizeTransferParams, Conversion, ConvertMoneyParams, ExchangeRate, ExchangeRatesParams, InstitutionProvider, InstitutionProvidersParams, PaymentMethodInfo, PaymentMethodsParams, PayoutAccount, PayoutResult, PayoutTransaction } from "../../../../types/v1/globals/payout.types.js";
7
+ export interface IGlobalPayoutService {
8
+ /**
9
+ * `GET /v1/global-payout/accounts`.
10
+ * @returns Every currency wallet, with its balance.
11
+ * @throws {NombaError} The request failed.
12
+ */
13
+ listAccounts(): Promise<PayoutAccount[]>;
14
+ /**
15
+ * `GET /v1/global-payout/accounts/{accountId}`.
16
+ * @param accountId The wallet to look up.
17
+ * @returns The wallet's details and balance.
18
+ * @throws {NombaError} `accountId` is not one of your wallets (404), or the request failed.
19
+ */
20
+ getAccount(accountId: string): Promise<PayoutAccount>;
21
+ /**
22
+ * `GET /v1/sandbox/global-payout/accounts`.
23
+ * @returns Canned test wallet data.
24
+ * @throws {NombaError} The request failed.
25
+ */
26
+ listSandboxAccounts(): Promise<PayoutAccount[]>;
27
+ /**
28
+ * `GET /v1/sandbox/global-payout/accounts/{accountId}`. Canned test data; any id is echoed back.
29
+ * @param accountId The wallet id to echo back in the canned response.
30
+ * @returns Canned test wallet data for that id.
31
+ * @throws {NombaError} The request failed.
32
+ */
33
+ getSandboxAccount(accountId: string): Promise<PayoutAccount>;
34
+ /**
35
+ * `GET /v1/global-payout/exchange-rates`.
36
+ * @param params The currency pair to get a rate for.
37
+ * @returns The matching exchange rates.
38
+ * @throws {NombaError} The request failed.
39
+ */
40
+ exchangeRates(params: ExchangeRatesParams): Promise<ExchangeRate[]>;
41
+ /**
42
+ * `POST /v1/global-payout/money/convert`. A calculation only; no money moves.
43
+ * @param params The amount and currency pair to convert.
44
+ * @returns The converted amount and rate used.
45
+ * @throws {NombaError} The request failed.
46
+ */
47
+ convert(params: ConvertMoneyParams): Promise<Conversion>;
48
+ /**
49
+ * `GET /v1/global-payout/bank/providers`.
50
+ * @param params Filters, e.g. by country or currency.
51
+ * @returns The receiving institutions available for payout.
52
+ * @throws {NombaError} The request failed.
53
+ */
54
+ institutionProviders(params?: InstitutionProvidersParams): Promise<InstitutionProvider[]>;
55
+ /**
56
+ * `GET /v1/global-payout/payment-methods`.
57
+ * @param params Filters, e.g. by country or currency.
58
+ * @returns The payment methods available for payout.
59
+ * @throws {NombaError} The request failed.
60
+ */
61
+ paymentMethods(params?: PaymentMethodsParams): Promise<PaymentMethodInfo[]>;
62
+ /**
63
+ * `POST /v1/global-payout/transfer/authorize`. Sends money cross-border.
64
+ * @param params The transfer to authorize; `idempotencyKey` defaults to a generated one.
65
+ * @param options Per-call overrides, including `idempotencyKey` and the `onSuccess`/`onPending`/`onFailed`
66
+ * outcome handlers.
67
+ * @returns The settled payout result (or the type `options` maps it to).
68
+ * @throws {NombaError} The transfer was rejected.
69
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
70
+ * @throws {UnconfirmedOutcomeError} The response was pending or undocumented and no `onPending` was supplied.
71
+ */
72
+ authorizeTransfer<R = PayoutResult>(params: AuthorizeTransferParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
73
+ /**
74
+ * `POST /v1/global-payout/exchange/authorize`. Moves money between your own wallets in different currencies.
75
+ * @param params The exchange to authorize; `idempotencyKey` defaults to a generated one.
76
+ * @param options Per-call overrides, including `idempotencyKey` and the `onSuccess`/`onPending`/`onFailed`
77
+ * outcome handlers.
78
+ * @returns The settled payout result (or the type `options` maps it to).
79
+ * @throws {NombaError} The exchange was rejected.
80
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
81
+ * @throws {UnconfirmedOutcomeError} The response was pending or undocumented and no `onPending` was supplied.
82
+ */
83
+ authorizeExchange<R = PayoutResult>(params: AuthorizeExchangeParams, options?: CallOptions<PayoutResult, R>): Promise<PayoutResult | R>;
84
+ /**
85
+ * `GET /v1/global-payout/transactions/{transactionId}`, with a `wtTransactionId`.
86
+ * @param transactionId The transaction to look up.
87
+ * @returns The transaction's current state.
88
+ * @throws {NombaError} `transactionId` is not found, or the request failed.
89
+ */
90
+ getTransaction(transactionId: string): Promise<PayoutTransaction>;
91
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/global-payout
3
+ * @description GlobalPayout service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IGlobalPayoutService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module nomba/interfaces/requery
3
+ * @description Requery service contract
4
+ */
5
+ import type { Transaction, TransactionLookup } from "../../../types/v1/requery/requery.types.js";
6
+ export interface IRequeryService {
7
+ /**
8
+ * `GET /v1/transactions/accounts/single`. Looks up one transaction on the parent account.
9
+ * @param lookup Fields identifying the transaction.
10
+ * @returns The matching transaction.
11
+ * @throws {NombaError} No matching transaction, or the lookup was rejected.
12
+ */
13
+ fetchParentTransaction(lookup: TransactionLookup): Promise<Transaction>;
14
+ /**
15
+ * `GET /v1/transactions/accounts/{subAccountId}/single`. Looks up one transaction on a sub account.
16
+ * @param subAccountId The sub account's ID.
17
+ * @param lookup Fields identifying the transaction.
18
+ * @returns The matching transaction.
19
+ * @throws {NombaError} No matching transaction, or the lookup was rejected.
20
+ */
21
+ fetchSubAccountTransaction(subAccountId: string, lookup: TransactionLookup): Promise<Transaction>;
22
+ /**
23
+ * `GET /v1/transactions/requery/{sessionId}`. Use for transfers made through both parent and sub
24
+ * accounts. Nomba-to-Nomba wallet transfers return no sessionId; use `fetchParentTransaction` or
25
+ * `fetchSubAccountTransaction` for those instead.
26
+ * @param sessionId The transfer's session ID.
27
+ * @returns The matching transaction.
28
+ * @throws {NombaError} No matching transaction, or the lookup was rejected.
29
+ */
30
+ requeryBySession(sessionId: string): Promise<Transaction>;
31
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/requery
3
+ * @description Requery service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IRequeryService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @module nomba/interfaces/terminals
3
+ * @description Terminals service contract
4
+ */
5
+ import type { CallOptions } from "../../../types/common/common.types.js";
6
+ import type { AssignTerminalParams, PushPaymentRequestParams, Terminal, TerminalPayment } from "../../../types/v1/terminals/terminals.types.js";
7
+ export interface ITerminalsService {
8
+ /**
9
+ * `POST /v1/terminals/assign`. Assigns a terminal to the parent account.
10
+ * @param params The terminal to assign.
11
+ * @returns The assigned terminal.
12
+ * @throws {NombaError} The assignment was rejected.
13
+ */
14
+ assignToParent(params: AssignTerminalParams): Promise<Terminal>;
15
+ /**
16
+ * `POST /v1/terminals/assign/{subAccountId}`. Assigns a terminal to a sub account.
17
+ * @param subAccountId The sub account's ID.
18
+ * @param params The terminal to assign.
19
+ * @returns The assigned terminal.
20
+ * @throws {NombaError} The assignment was rejected.
21
+ */
22
+ assignToSubAccount(subAccountId: string, params: AssignTerminalParams): Promise<Terminal>;
23
+ /**
24
+ * `POST /v1/terminals/unassign`. Unassigns a terminal from the parent account.
25
+ * @param params The terminal to unassign.
26
+ * @returns The unassigned terminal.
27
+ * @throws {NombaError} The unassignment was rejected.
28
+ */
29
+ unassignFromParent(params: AssignTerminalParams): Promise<Terminal>;
30
+ /**
31
+ * `POST /v1/terminals/unassign/{subAccountId}`. Unassigns a terminal from a sub account.
32
+ * @param subAccountId The sub account's ID.
33
+ * @param params The terminal to unassign.
34
+ * @returns The unassigned terminal.
35
+ * @throws {NombaError} The unassignment was rejected.
36
+ */
37
+ unassignFromSubAccount(subAccountId: string, params: AssignTerminalParams): Promise<Terminal>;
38
+ /**
39
+ * `POST /v1/terminals/payment-request/{terminalId}`. Pushes a payment request to a terminal for the
40
+ * cardholder to complete.
41
+ * @param terminalId The terminal's ID.
42
+ * @param params The payment request details.
43
+ * @param options Idempotency key, outcome closures (`onSuccess`/`onPending`/`onFailed`), and related
44
+ * per-call overrides.
45
+ * @returns The created payment request, or the matching outcome closure's result.
46
+ * @throws {NombaError} The request was rejected and no `onFailed` closure was given.
47
+ * @throws {OutcomeUnknownError} The request outcome could not be determined and no `onPending` was supplied.
48
+ * @throws {UnconfirmedOutcomeError} The response status is pending or undocumented and no `onPending` was supplied.
49
+ */
50
+ pushPaymentRequest<R = TerminalPayment>(terminalId: string, params: PushPaymentRequestParams, options?: CallOptions<TerminalPayment, R>): Promise<TerminalPayment | R>;
51
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/terminals
3
+ * @description Terminals service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./ITerminalsService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @module nomba/interfaces/transactions
3
+ * @description Transactions service contract
4
+ */
5
+ import type { Page } from "../../../lib/util.js";
6
+ import type { Transaction } from "../../../types/v1/requery/requery.types.js";
7
+ import type { BankTransaction, BankTransactionList, FilterTransactionsParams, TransactionList, TransactionListParams, VirtualAccountTransaction, VirtualAccountTransactionParams } from "../../../types/v1/transactions/transactions.types.js";
8
+ export interface ITransactionsService {
9
+ /**
10
+ * `GET /v1/transactions/bank`. Credit/debit transactions on the parent account.
11
+ * @param params Filters and paging (`cursor`, `limit`).
12
+ * @returns One page of transactions.
13
+ * @throws {NombaError} The request was rejected.
14
+ */
15
+ listBankTransactions(params?: TransactionListParams): Promise<BankTransactionList>;
16
+ /**
17
+ * Every credit/debit transaction, across all pages. Starts at `params.cursor` if given.
18
+ * @param params Filters and the starting cursor.
19
+ * @throws {NombaError} A page request was rejected.
20
+ */
21
+ iterateBankTransactions(params?: TransactionListParams): AsyncGenerator<BankTransaction>;
22
+ /**
23
+ * `GET /v1/transactions/virtual`. Documented in the guide only. The response carries a `cursor`, but
24
+ * the guide names no paging parameter, so only the first page is returned.
25
+ * @param params The virtual account number and date range.
26
+ * @returns The first page of transactions.
27
+ * @throws {NombaError} The request was rejected.
28
+ */
29
+ listVirtualAccountTransactions({ accountNumber, ...dates }: VirtualAccountTransactionParams): Promise<Page<VirtualAccountTransaction>>;
30
+ /**
31
+ * `GET /v1/transactions/accounts`. Transactions on the parent account.
32
+ * @param params Filters and paging (`cursor`, `limit`).
33
+ * @returns One page of transactions.
34
+ * @throws {NombaError} The request was rejected.
35
+ */
36
+ listParentTransactions(params?: TransactionListParams): Promise<TransactionList>;
37
+ /**
38
+ * Every transaction on the parent account, across all pages. Starts at `params.cursor` if given.
39
+ * @param params Filters and the starting cursor.
40
+ * @throws {NombaError} A page request was rejected.
41
+ */
42
+ iterateParentTransactions(params?: TransactionListParams): AsyncGenerator<Transaction>;
43
+ /**
44
+ * `GET /v1/transactions/accounts/{subAccountId}`. Transactions on a sub account.
45
+ * @param subAccountId The sub account's ID.
46
+ * @param params Filters and paging (`cursor`, `limit`).
47
+ * @returns One page of transactions.
48
+ * @throws {NombaError} The request was rejected.
49
+ */
50
+ listSubAccountTransactions(subAccountId: string, params?: TransactionListParams): Promise<TransactionList>;
51
+ /**
52
+ * Every transaction on a sub account, across all pages. Starts at `params.cursor` if given.
53
+ * @param subAccountId The sub account's ID.
54
+ * @param params Filters and the starting cursor.
55
+ * @throws {NombaError} A page request was rejected.
56
+ */
57
+ iterateSubAccountTransactions(subAccountId: string, params?: TransactionListParams): AsyncGenerator<Transaction>;
58
+ /**
59
+ * `POST /v1/transactions/accounts`. Filters parent account transactions by criteria too complex for
60
+ * query params.
61
+ * @param filter The filter criteria.
62
+ * @param page Paging (`cursor`, `limit`).
63
+ * @returns One page of matching transactions.
64
+ * @throws {NombaError} The request was rejected.
65
+ */
66
+ filterParentTransactions(filter?: FilterTransactionsParams, page?: TransactionListParams): Promise<TransactionList>;
67
+ /**
68
+ * Every parent transaction matching the filter, across all pages. Starts at `page.cursor` if given.
69
+ * @param filter The filter criteria.
70
+ * @param page The starting cursor and page size.
71
+ * @throws {NombaError} A page request was rejected.
72
+ */
73
+ iterateFilteredParentTransactions(filter?: FilterTransactionsParams, page?: TransactionListParams): AsyncGenerator<Transaction>;
74
+ /**
75
+ * `POST /v1/transactions/accounts/{subAccountId}`. Filters a sub account's transactions by criteria too
76
+ * complex for query params.
77
+ * @param subAccountId The sub account's ID.
78
+ * @param filter The filter criteria.
79
+ * @param page Paging (`cursor`, `limit`).
80
+ * @returns One page of matching transactions.
81
+ * @throws {NombaError} The request was rejected.
82
+ */
83
+ filterSubAccountTransactions(subAccountId: string, filter?: FilterTransactionsParams, page?: TransactionListParams): Promise<TransactionList>;
84
+ /**
85
+ * Every sub account transaction matching the filter, across all pages. Starts at `page.cursor` if
86
+ * given.
87
+ * @param subAccountId The sub account's ID.
88
+ * @param filter The filter criteria.
89
+ * @param page The starting cursor and page size.
90
+ * @throws {NombaError} A page request was rejected.
91
+ */
92
+ iterateFilteredSubAccountTransactions(subAccountId: string, filter?: FilterTransactionsParams, page?: TransactionListParams): AsyncGenerator<Transaction>;
93
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/transactions
3
+ * @description Transactions service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./ITransactionsService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @module nomba/interfaces/virtual-accounts
3
+ * @description VirtualAccounts service contract
4
+ */
5
+ import type { PageParams } from "../../../lib/util.js";
6
+ import type { CreatedVirtualAccount, CreateVirtualAccountParams, FilterVirtualAccountsParams, UpdateVirtualAccountParams, VirtualAccount, VirtualAccountList } from "../../../types/v1/virtual-accounts/virtual-accounts.types.js";
7
+ export interface IVirtualAccountsService {
8
+ /**
9
+ * `POST /v1/accounts/virtual`. Creates a virtual account funding the parent account.
10
+ * @param params The account to create.
11
+ * @returns The created virtual account.
12
+ * @throws {NombaError} The creation was rejected.
13
+ */
14
+ create(params: CreateVirtualAccountParams): Promise<CreatedVirtualAccount>;
15
+ /**
16
+ * `POST /v1/accounts/virtual/{subAccountId}`. Creates a virtual account; funds are collected in that
17
+ * sub account.
18
+ * @param subAccountId The sub account's ID.
19
+ * @param params The account to create.
20
+ * @returns The created virtual account.
21
+ * @throws {NombaError} The creation was rejected.
22
+ */
23
+ createForSubAccount(subAccountId: string, params: CreateVirtualAccountParams): Promise<CreatedVirtualAccount>;
24
+ /**
25
+ * `GET /v1/accounts/virtual/{identifier}`.
26
+ * @param identifier The accountRef or the virtual account number.
27
+ * @returns The matching virtual account.
28
+ * @throws {NombaError} No matching account, or the request was rejected.
29
+ */
30
+ get(identifier: string): Promise<VirtualAccount>;
31
+ /**
32
+ * `PUT /v1/accounts/virtual/{identifier}`.
33
+ * @param identifier The accountRef or the 10 digit account number.
34
+ * @param params The fields to update.
35
+ * @returns Whether the update took effect.
36
+ * @throws {NombaError} The update was rejected.
37
+ */
38
+ update(identifier: string, params: UpdateVirtualAccountParams): Promise<{
39
+ updated: boolean;
40
+ }>;
41
+ /**
42
+ * `DELETE /v1/accounts/virtual/{identifier}`. Stops the account accepting payments.
43
+ * @param identifier The accountRef or the virtual account number.
44
+ * @returns Whether the account was expired.
45
+ * @throws {NombaError} The request was rejected.
46
+ */
47
+ expire(identifier: string): Promise<{
48
+ expired: boolean;
49
+ }>;
50
+ /**
51
+ * `POST /v1/accounts/virtual/list`.
52
+ * @param filter The filter criteria.
53
+ * @param page Paging (`cursor`, `limit`).
54
+ * @returns One page of matching virtual accounts.
55
+ * @throws {NombaError} The request was rejected.
56
+ */
57
+ list(filter?: FilterVirtualAccountsParams, page?: PageParams): Promise<VirtualAccountList>;
58
+ /**
59
+ * Every matching virtual account, across all pages. Starts at `page.cursor` if given.
60
+ * @param filter The filter criteria.
61
+ * @param page The starting cursor and page size.
62
+ * @throws {NombaError} A page request was rejected.
63
+ */
64
+ iterate(filter?: FilterVirtualAccountsParams, page?: PageParams): AsyncGenerator<VirtualAccount>;
65
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module nomba/interfaces/virtual-accounts
3
+ * @description VirtualAccounts service contract
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export type * from "./IVirtualAccountsService.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module nomba/interfaces/webhooks
3
+ * @description Webhooks service contract
4
+ */
5
+ import type { EventLog, EventLogsParams, EventsParams, ReplayParams, WebhookList, WebhookSubscription } from "../../../types/v1/webhooks/webhooks.types.js";
6
+ export interface IWebhooksService {
7
+ /**
8
+ * `POST /v1/webhooks/event-logs`. Webhooks sent to your system and how your server answered.
9
+ * @param params Filters and paging.
10
+ * @returns The matching event logs.
11
+ * @throws {NombaError} The request was rejected.
12
+ */
13
+ eventLogs(params?: EventLogsParams): Promise<WebhookList<EventLog>>;
14
+ /**
15
+ * `POST /v1/webhooks/events`. Your webhook subscriptions.
16
+ * @param params Filters and paging.
17
+ * @returns The matching subscriptions.
18
+ * @throws {NombaError} The request was rejected.
19
+ */
20
+ events(params?: EventsParams): Promise<WebhookList<WebhookSubscription>>;
21
+ /**
22
+ * `POST /v1/webhooks/re-push`. Resends one event. Takes an event log's `hookRequestId`; the request
23
+ * field is spelled `hooksRequestId`, as the guide shows.
24
+ * @param hookRequestId The event log's `hookRequestId`.
25
+ * @throws {NombaError} The resend was rejected.
26
+ */
27
+ repush(hookRequestId: string): Promise<void>;
28
+ /**
29
+ * `POST /v1/webhooks/bulk-re-push`.
30
+ * @param hookRequestIds The event logs' `hookRequestId`s.
31
+ * @throws {NombaError} The resend was rejected.
32
+ */
33
+ bulkRepush(hookRequestIds: string[]): Promise<void>;
34
+ /**
35
+ * `POST /v1/webhooks/replay`. Resends every matching event in the time window.
36
+ * @param params The event type and time window to replay.
37
+ * @throws {NombaError} The replay was rejected.
38
+ */
39
+ replay(params: ReplayParams): Promise<void>;
40
+ }
@@ -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,31 @@
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
+ /**
9
+ * `POST /v2/bill/topup`. Buys airtime from the parent account.
10
+ * @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
11
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
12
+ * a rejection or pending outcome throws.
13
+ * @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
14
+ * @throws {NombaError} The purchase was rejected (4xx).
15
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
16
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
17
+ */
18
+ buyAirtime<R = AirtimePurchaseV2Result>(params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
19
+ /**
20
+ * `POST /v2/bill/topup/{subAccountId}`. Buys airtime from a sub account.
21
+ * @param subAccountId The sub account to buy from.
22
+ * @param params The phone number, network 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 purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
26
+ * @throws {NombaError} The purchase 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
+ buyAirtimeFromSubAccount<R = AirtimePurchaseV2Result>(subAccountId: string, params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
31
+ }
@@ -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,31 @@
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
+ /**
9
+ * `POST /v2/bill/betting`. Funds a betting wallet from the parent account.
10
+ * @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
11
+ * @param options Outcome closures and per-call overrides; without them, success resolves the result and
12
+ * a rejection or pending outcome throws.
13
+ * @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
14
+ * @throws {NombaError} The payment was rejected (4xx).
15
+ * @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
16
+ * @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
17
+ */
18
+ payBetting<R = BettingPaymentV2Result>(params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
19
+ /**
20
+ * `POST /v2/bill/betting/{subAccountId}`. Pays from a sub account.
21
+ * @param subAccountId The sub account to pay from.
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
+ payBettingFromSubAccount<R = BettingPaymentV2Result>(subAccountId: string, params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
31
+ }
@@ -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 {};