@nomba/node-sdk 0.5.0 → 0.6.1
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.
- package/README.md +20 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +4 -3
- package/dist/interfaces/v1/direct-debits/IDirectDebitsService.d.ts +1 -1
- package/dist/lib/errors.d.ts +1 -1
- package/dist/lib/errors.js +1 -1
- package/dist/lib/paginate.d.ts +1 -1
- package/dist/lib/paginate.js +1 -1
- package/dist/lib/sdk-version.generated.d.ts +1 -1
- package/dist/lib/sdk-version.generated.js +1 -1
- package/dist/lib/token-store.d.ts +1 -1
- package/dist/lib/token-store.js +1 -1
- package/dist/lib/util.d.ts +1 -1
- package/dist/lib/util.js +1 -1
- package/dist/lib/webhooks.d.ts +3 -2
- package/dist/lib/webhooks.js +5 -4
- package/dist/services/http/http-client.service.js +2 -0
- package/dist/services/v1/accounts/accounts.service.d.ts +1 -1
- package/dist/services/v1/accounts/accounts.service.js +1 -1
- package/dist/services/v1/charge/charge.service.d.ts +1 -1
- package/dist/services/v1/charge/charge.service.js +1 -1
- package/dist/services/v1/checkout/checkout.service.d.ts +5 -4
- package/dist/services/v1/checkout/checkout.service.js +3 -2
- package/dist/services/v1/direct-debits/direct-debits.service.d.ts +2 -2
- package/dist/services/v1/direct-debits/direct-debits.service.js +2 -2
- package/dist/services/v1/globals/collections.service.d.ts +1 -1
- package/dist/services/v1/globals/collections.service.js +1 -1
- package/dist/services/v1/globals/payout.service.d.ts +1 -1
- package/dist/services/v1/globals/payout.service.js +2 -2
- package/dist/services/v1/requery/requery.service.d.ts +1 -1
- package/dist/services/v1/requery/requery.service.js +1 -1
- package/dist/services/v1/terminals/terminals.service.d.ts +1 -1
- package/dist/services/v1/terminals/terminals.service.js +1 -1
- package/dist/services/v1/transactions/transactions.service.d.ts +1 -1
- package/dist/services/v1/transactions/transactions.service.js +1 -1
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.d.ts +1 -1
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +1 -1
- package/dist/services/v1/webhooks/webhooks.service.d.ts +1 -1
- package/dist/services/v1/webhooks/webhooks.service.js +1 -1
- package/dist/types/v1/checkout/checkout.types.d.ts +8 -0
- package/dist/types/v1/virtual-accounts/virtual-accounts.types.d.ts +6 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/banner-dark.svg">
|
|
3
|
+
<img alt="Nomba Node SDK" src=".github/assets/banner-light.svg" width="100%">
|
|
4
|
+
</picture>
|
|
5
|
+
|
|
1
6
|
# Nomba Node SDK
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
TypeScript/Node.js client for [Nomba's](https://nomba.com) payments and banking APIs.
|
|
4
9
|
|
|
10
|
+
[](https://github.com/NombaOSS/nomba-node-sdk/actions/workflows/ci.yml)
|
|
11
|
+
[](https://www.npmjs.com/package/@nomba/node-sdk)
|
|
5
12
|
[](LICENSE)
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- Node.js **22** or newer (see `.nvmrc`)
|
|
10
|
-
- A Nomba account with API credentials (`clientId`, `clientSecret`, `accountId`) from the [Nomba dashboard](https://nomba.com)
|
|
14
|
+
- Checkout, transfers, virtual accounts, direct debits, terminals, electricity, cable TV, betting, airtime and data, cross-border payouts and collections, webhooks, and account/transaction lookups.
|
|
15
|
+
- Built for production use: automatic token management, safe retries, idempotent mutations, and cursor pagination.
|
|
16
|
+
- Requires Node.js **22** or newer (see `.nvmrc`) and a Nomba account with API credentials (`clientId`, `clientSecret`, `accountId`) from the [Nomba dashboard](https://nomba.com).
|
|
11
17
|
|
|
12
|
-
##
|
|
18
|
+
## Install
|
|
13
19
|
|
|
14
20
|
```bash
|
|
15
21
|
npm install @nomba/node-sdk
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
##
|
|
24
|
+
## Quickstart
|
|
19
25
|
|
|
20
26
|
```ts
|
|
21
27
|
import { Nomba } from "@nomba/node-sdk";
|
|
@@ -152,7 +158,7 @@ Token handling is automatic, but the client exposes it directly too:
|
|
|
152
158
|
| `fetchTransaction(params?)` | `GET /v1/checkout/transaction` | |
|
|
153
159
|
| `cancelOrder(orderReference)` | `POST /v1/checkout/order/cancel` | Unpaid orders only; use `refund` after payment |
|
|
154
160
|
| `refund(params)` | `POST /v1/checkout/refund` | |
|
|
155
|
-
| `chargeTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-payment` | Check `status`
|
|
161
|
+
| `chargeTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-payment` | Check `status`; if `otpRequired`, submit the OTP via `ChargeService.submitCardOtp` using the returned `transactionId` |
|
|
156
162
|
| `listTokenizedCards(params?)` / `iterateTokenizedCards(params?)` | `GET /v1/checkout/tokenized-card-data` | Paginated |
|
|
157
163
|
| `updateTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-data` | |
|
|
158
164
|
| `deleteTokenizedCard(tokenKey)` | `DELETE /v1/checkout/tokenized-card-data` | |
|
|
@@ -607,6 +613,12 @@ npm run build # emit dist/
|
|
|
607
613
|
|
|
608
614
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contribution guide (Nomba-docs-first, tests required, Conventional Commits).
|
|
609
615
|
|
|
616
|
+
## Links
|
|
617
|
+
|
|
618
|
+
- [Nomba API documentation](https://developer.nomba.com)
|
|
619
|
+
- [Contributing guide](CONTRIBUTING.md), [Security policy](SECURITY.md), [Releasing](RELEASING.md)
|
|
620
|
+
- [Changelog](CHANGELOG.md)
|
|
621
|
+
|
|
610
622
|
## License
|
|
611
623
|
|
|
612
624
|
[MIT](LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @copyright 2026 Nomba
|
|
8
8
|
* @homepage https://nomba.com
|
|
9
9
|
* @support https://nomba.com/support
|
|
10
|
-
* @repository https://github.com/
|
|
10
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
11
11
|
* @docs https://developer.nomba.com
|
|
12
12
|
*/
|
|
13
13
|
export type { IHttpClient } from "./interfaces/http/IHttpClient.js";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @copyright 2026 Nomba
|
|
8
8
|
* @homepage https://nomba.com
|
|
9
9
|
* @support https://nomba.com/support
|
|
10
|
-
* @repository https://github.com/
|
|
10
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
11
11
|
* @docs https://developer.nomba.com
|
|
12
12
|
*/
|
|
13
13
|
export { IdempotencyKeyAbsentError, isPending, NombaError, OutcomeUnknownError, TokenError, UnconfirmedOutcomeError, } from "./lib/errors.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Checkout service contract
|
|
4
4
|
*/
|
|
5
5
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
6
|
-
import type { ChargeTokenizedCardParams, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
|
|
6
|
+
import type { ChargeTokenizedCardParams, ChargeTokenizedCardResult, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
|
|
7
7
|
export interface ICheckoutService {
|
|
8
8
|
/**
|
|
9
9
|
* `POST /v1/checkout/order`. Send the customer to `checkoutLink` to pay.
|
|
@@ -41,13 +41,14 @@ export interface ICheckoutService {
|
|
|
41
41
|
refund<R = CheckoutResult>(params: RefundCheckoutTransactionParams, options?: CallOptions<CheckoutResult, R>): Promise<CheckoutResult | R>;
|
|
42
42
|
/**
|
|
43
43
|
* `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
|
|
44
|
-
* went through.
|
|
44
|
+
* went through. If `otpRequired` is true, the charge is pending: call `ChargeService.submitCardOtp`
|
|
45
|
+
* with the returned `transactionId` and `orderReference`.
|
|
45
46
|
* @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key.
|
|
46
47
|
* @returns The charge result.
|
|
47
48
|
* @throws {NombaError} The call failed, e.g. the token is invalid or expired.
|
|
48
49
|
* @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
|
|
49
50
|
*/
|
|
50
|
-
chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<
|
|
51
|
+
chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<ChargeTokenizedCardResult>;
|
|
51
52
|
/**
|
|
52
53
|
* `GET /v1/checkout/tokenized-card-data`.
|
|
53
54
|
* @param params Pagination (`page`) and other list filters.
|
|
@@ -6,7 +6,7 @@ import type { CreatedMandate, CreateMandateParams, DebitMandateParams, ListManda
|
|
|
6
6
|
export interface IDirectDebitsService {
|
|
7
7
|
/**
|
|
8
8
|
* `POST /v1/direct-debits`.
|
|
9
|
-
*
|
|
9
|
+
* limit: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
|
|
10
10
|
* other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
|
|
11
11
|
* @param params The mandate to create; `merchantReference` is the idempotency key.
|
|
12
12
|
* @returns The created mandate.
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
/** Thrown for any non-2xx response, or a 2xx whose body `code` is not "00". */
|
package/dist/lib/errors.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
/** Thrown for any non-2xx response, or a 2xx whose body `code` is not "00". */
|
package/dist/lib/paginate.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
/**
|
package/dist/lib/paginate.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.6.1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.6.1";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
export interface TokenData {
|
package/dist/lib/token-store.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
/** Default store: one token, this process only. */
|
package/dist/lib/util.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
export type PageParams = {
|
package/dist/lib/util.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
*/
|
|
14
14
|
// Path ids come from callers; reject values that would change the endpoint ("", ".", "..").
|
package/dist/lib/webhooks.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-basics/webhook
|
|
14
14
|
*/
|
|
@@ -38,6 +38,7 @@ export interface WebhookEvent {
|
|
|
38
38
|
* True when `signature` (the nomba-signature header) matches the event, signed with your dashboard's
|
|
39
39
|
* webhook signature key and the nomba-timestamp header. `body` is the raw request body (string or Buffer) or the parsed event.
|
|
40
40
|
* A missing or malformed signature or body returns false rather than throwing.
|
|
41
|
-
*
|
|
41
|
+
* Compared exact-case: folding case before comparing would shrink the effective alphabet and weaken
|
|
42
|
+
* forgery resistance, and nothing backs case-insensitivity as real API behavior.
|
|
42
43
|
*/
|
|
43
44
|
export declare function verifyWebhook(body: string | Buffer | WebhookEvent, signature: string | undefined, timestamp: string, secret: string): boolean;
|
package/dist/lib/webhooks.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-basics/webhook
|
|
14
14
|
*/
|
|
@@ -41,7 +41,8 @@ function webhookSignature(event, secret, timestamp) {
|
|
|
41
41
|
* True when `signature` (the nomba-signature header) matches the event, signed with your dashboard's
|
|
42
42
|
* webhook signature key and the nomba-timestamp header. `body` is the raw request body (string or Buffer) or the parsed event.
|
|
43
43
|
* A missing or malformed signature or body returns false rather than throwing.
|
|
44
|
-
*
|
|
44
|
+
* Compared exact-case: folding case before comparing would shrink the effective alphabet and weaken
|
|
45
|
+
* forgery resistance, and nothing backs case-insensitivity as real API behavior.
|
|
45
46
|
*/
|
|
46
47
|
export function verifyWebhook(body, signature, timestamp, secret) {
|
|
47
48
|
if (typeof signature !== "string")
|
|
@@ -58,7 +59,7 @@ export function verifyWebhook(body, signature, timestamp, secret) {
|
|
|
58
59
|
}
|
|
59
60
|
if (typeof event !== "object" || event === null)
|
|
60
61
|
return false;
|
|
61
|
-
const expected = Buffer.from(webhookSignature(event, secret, timestamp)
|
|
62
|
-
const given = Buffer.from(signature
|
|
62
|
+
const expected = Buffer.from(webhookSignature(event, secret, timestamp));
|
|
63
|
+
const given = Buffer.from(signature);
|
|
63
64
|
return expected.length === given.length && timingSafeEqual(expected, given);
|
|
64
65
|
}
|
|
@@ -295,6 +295,8 @@ export class HttpClient {
|
|
|
295
295
|
...(bearer ? { Authorization: `Bearer ${bearer}` } : {}),
|
|
296
296
|
},
|
|
297
297
|
...(payload === undefined ? {} : { body: payload }),
|
|
298
|
+
// The bearer token must never follow a redirect to another host.
|
|
299
|
+
redirect: "error",
|
|
298
300
|
signal: AbortSignal.timeout(this.#options.timeoutMs ?? 30_000),
|
|
299
301
|
});
|
|
300
302
|
let json = null;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/accounts
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/accounts
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/charge
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/charge
|
|
14
14
|
*/
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/checkout
|
|
14
14
|
*/
|
|
15
15
|
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
16
|
import type { ICheckoutService } from "../../../interfaces/v1/checkout/ICheckoutService.js";
|
|
17
17
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
18
|
-
import type { ChargeTokenizedCardParams, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
|
|
18
|
+
import type { ChargeTokenizedCardParams, ChargeTokenizedCardResult, CheckoutOrderCreated, CheckoutResult, CheckoutTransaction, CreateCheckoutOrderParams, FetchCheckoutTransactionParams, ListTokenizedCardsParams, RefundCheckoutTransactionParams, TokenizedCardData, TokenizedCardList, TokenizedCardResult, UpdatedTokenizedCard, UpdateTokenizedCardParams } from "../../../types/v1/checkout/checkout.types.js";
|
|
19
19
|
export declare class CheckoutService implements ICheckoutService {
|
|
20
20
|
private readonly http;
|
|
21
21
|
constructor(http: IHttpClient);
|
|
@@ -54,13 +54,14 @@ export declare class CheckoutService implements ICheckoutService {
|
|
|
54
54
|
refund<R = CheckoutResult>(params: RefundCheckoutTransactionParams, options?: CallOptions<CheckoutResult, R>): Promise<CheckoutResult | R>;
|
|
55
55
|
/**
|
|
56
56
|
* `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
|
|
57
|
-
* went through.
|
|
57
|
+
* went through. If `otpRequired` is true, the charge is pending: call `ChargeService.submitCardOtp`
|
|
58
|
+
* with the returned `transactionId` and `orderReference`.
|
|
58
59
|
* @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key when provided.
|
|
59
60
|
* @returns The charge result.
|
|
60
61
|
* @throws {NombaError} The call failed, e.g. the token is invalid or expired.
|
|
61
62
|
* @throws {OutcomeUnknownError} The call failed in a way that does not say whether it was processed.
|
|
62
63
|
*/
|
|
63
|
-
chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<
|
|
64
|
+
chargeTokenizedCard(params: ChargeTokenizedCardParams): Promise<ChargeTokenizedCardResult>;
|
|
64
65
|
/**
|
|
65
66
|
* `GET /v1/checkout/tokenized-card-data`.
|
|
66
67
|
* @param params Pagination (`page`) and other list filters.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/checkout
|
|
14
14
|
*/
|
|
@@ -81,7 +81,8 @@ export class CheckoutService {
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* `POST /v1/checkout/tokenized-card-payment`. Check `status` on the result: it says whether the charge
|
|
84
|
-
* went through.
|
|
84
|
+
* went through. If `otpRequired` is true, the charge is pending: call `ChargeService.submitCardOtp`
|
|
85
|
+
* with the returned `transactionId` and `orderReference`.
|
|
85
86
|
* @param params The tokenized card and amount to charge; `order.orderReference` is the idempotency key when provided.
|
|
86
87
|
* @returns The charge result.
|
|
87
88
|
* @throws {NombaError} The call failed, e.g. the token is invalid or expired.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/direct-debits
|
|
14
14
|
*/
|
|
@@ -21,7 +21,7 @@ export declare class DirectDebitsService implements IDirectDebitsService {
|
|
|
21
21
|
constructor(http: IHttpClient);
|
|
22
22
|
/**
|
|
23
23
|
* `POST /v1/direct-debits`.
|
|
24
|
-
*
|
|
24
|
+
* limit: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
|
|
25
25
|
* other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
|
|
26
26
|
* @param params The mandate to create; `merchantReference` is the idempotency key.
|
|
27
27
|
* @returns The created mandate.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/direct-debits
|
|
14
14
|
*/
|
|
@@ -20,7 +20,7 @@ export class DirectDebitsService {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* `POST /v1/direct-debits`.
|
|
23
|
-
*
|
|
23
|
+
* limit: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
|
|
24
24
|
* other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
|
|
25
25
|
* @param params The mandate to create; `merchantReference` is the idempotency key.
|
|
26
26
|
* @returns The created mandate.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/products/global-collections/introduction
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/products/global-collections/introduction
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/products/global-payout/introduction
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/products/global-payout/introduction
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ import { IdempotencyKeyAbsentError } from "../../../lib/errors.js";
|
|
|
16
16
|
import { REJECTED, settle } from "../../../lib/outcome.js";
|
|
17
17
|
import { pathId } from "../../../lib/util.js";
|
|
18
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
|
|
19
|
+
// final or safe to refund, so it stays pending until confirmed; only COMPLETED is success.
|
|
20
20
|
const TRANSFER_OUTCOMES = {
|
|
21
21
|
codes: { "00": "success", ...REJECTED },
|
|
22
22
|
statuses: {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/requery
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/requery
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/terminals
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/terminals
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/transactions
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/transactions
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/virtual-accounts
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-reference/virtual-accounts
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-basics/troubleshoot-webhooks
|
|
14
14
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @copyright 2026 Nomba
|
|
9
9
|
* @homepage https://nomba.com
|
|
10
10
|
* @support https://nomba.com/support
|
|
11
|
-
* @repository https://github.com/
|
|
11
|
+
* @repository https://github.com/NombaOSS/nomba-node-sdk
|
|
12
12
|
* @docs https://developer.nomba.com
|
|
13
13
|
* @see https://developer.nomba.com/docs/api-basics/troubleshoot-webhooks
|
|
14
14
|
*/
|
|
@@ -122,6 +122,14 @@ export type TokenizedCardResult = {
|
|
|
122
122
|
status?: boolean;
|
|
123
123
|
message?: string;
|
|
124
124
|
};
|
|
125
|
+
export type ChargeTokenizedCardResult = TokenizedCardResult & {
|
|
126
|
+
orderId?: string;
|
|
127
|
+
orderReference?: string;
|
|
128
|
+
/** `true` if the bank requires an OTP; the charge is pending until `submitCardOtp` is called with `transactionId`. */
|
|
129
|
+
otpRequired?: boolean;
|
|
130
|
+
/** Only present when `otpRequired` is true. Pass to `ChargeService.submitCardOtp`. */
|
|
131
|
+
transactionId?: string;
|
|
132
|
+
};
|
|
125
133
|
export type TokenizedCardData = {
|
|
126
134
|
tokenKey?: string;
|
|
127
135
|
customerEmail?: string;
|
|
@@ -17,6 +17,10 @@ export type CreateVirtualAccountParams = {
|
|
|
17
17
|
expiryDate?: string;
|
|
18
18
|
/** The account then accepts only this exact amount. */
|
|
19
19
|
expectedAmount?: number;
|
|
20
|
+
/** Receives `payment_success`/`payment_failed` webhook events for inflows into this account. */
|
|
21
|
+
callbackUrl?: string;
|
|
22
|
+
/** Reject inflows whose sender name doesn't match `accountName` (name order is ignored). Sends a `payment_failed` webhook and reverses the funds per the sending bank's policy. */
|
|
23
|
+
restrictInflowToAccountName?: boolean;
|
|
20
24
|
};
|
|
21
25
|
export type UpdateVirtualAccountParams = {
|
|
22
26
|
/** 8 to 64 characters. Advised in the webhook after the update. */
|
|
@@ -50,6 +54,8 @@ export type VirtualAccount = {
|
|
|
50
54
|
/** The spec lists it as required, but the docs' own lookup example omits it. */
|
|
51
55
|
callbackUrl?: string;
|
|
52
56
|
expired: boolean;
|
|
57
|
+
/** Whether name-based inflow restriction is active. */
|
|
58
|
+
restrictInflowToAccountName?: boolean;
|
|
53
59
|
};
|
|
54
60
|
/** The create response. Its spec's `required` list names fields it does not define, so only what the docs' example shows is required. */
|
|
55
61
|
export type CreatedVirtualAccount = Omit<VirtualAccount, "expired"> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomba/node-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Node.js SDK for Nomba's APIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"prebuild": "node scripts/generate-sdk-version.cjs",
|
|
23
23
|
"build": "tsc -p tsconfig.build.json",
|
|
24
24
|
"lint": "biome check .",
|
|
25
|
+
"lint:architecture": "node scripts/check-architecture.cjs",
|
|
25
26
|
"pretest": "node scripts/generate-sdk-version.cjs",
|
|
26
27
|
"test": "vitest run",
|
|
27
28
|
"pretypecheck": "node scripts/generate-sdk-version.cjs",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
},
|
|
36
37
|
"repository": {
|
|
37
38
|
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/NombaOSS/nomba-node-sdk.git"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|