@nomba/node-sdk 0.5.0 → 0.6.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.
- package/README.md +1 -1
- package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +4 -3
- package/dist/lib/sdk-version.generated.d.ts +1 -1
- package/dist/lib/sdk-version.generated.js +1 -1
- package/dist/services/v1/checkout/checkout.service.d.ts +4 -3
- package/dist/services/v1/checkout/checkout.service.js +2 -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 +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ Token handling is automatic, but the client exposes it directly too:
|
|
|
152
152
|
| `fetchTransaction(params?)` | `GET /v1/checkout/transaction` | |
|
|
153
153
|
| `cancelOrder(orderReference)` | `POST /v1/checkout/order/cancel` | Unpaid orders only; use `refund` after payment |
|
|
154
154
|
| `refund(params)` | `POST /v1/checkout/refund` | |
|
|
155
|
-
| `chargeTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-payment` | Check `status`
|
|
155
|
+
| `chargeTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-payment` | Check `status`; if `otpRequired`, submit the OTP via `ChargeService.submitCardOtp` using the returned `transactionId` |
|
|
156
156
|
| `listTokenizedCards(params?)` / `iterateTokenizedCards(params?)` | `GET /v1/checkout/tokenized-card-data` | Paginated |
|
|
157
157
|
| `updateTokenizedCard(params)` | `POST /v1/checkout/tokenized-card-data` | |
|
|
158
158
|
| `deleteTokenizedCard(tokenKey)` | `DELETE /v1/checkout/tokenized-card-data` | |
|
|
@@ -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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.6.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.6.0";
|
|
@@ -15,7 +15,7 @@
|
|
|
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.
|
|
@@ -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.
|
|
@@ -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"> & {
|