@nomba/node-sdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +550 -2
- package/dist/index.d.ts +86 -0
- package/dist/index.js +53 -0
- package/dist/interfaces/http/IHttpClient.d.ts +17 -0
- package/dist/interfaces/http/IHttpClient.js +5 -0
- package/dist/interfaces/http/index.d.ts +1 -0
- package/dist/interfaces/http/index.js +1 -0
- package/dist/interfaces/v1/accounts/IAccountsService.d.ts +24 -0
- package/dist/interfaces/v1/accounts/IAccountsService.js +5 -0
- package/dist/interfaces/v1/accounts/index.d.ts +1 -0
- package/dist/interfaces/v1/accounts/index.js +1 -0
- package/dist/interfaces/v1/betting/IBettingService.d.ts +11 -0
- package/dist/interfaces/v1/betting/IBettingService.js +5 -0
- package/dist/interfaces/v1/betting/index.d.ts +1 -0
- package/dist/interfaces/v1/betting/index.js +1 -0
- package/dist/interfaces/v1/cable/ICableService.d.ts +11 -0
- package/dist/interfaces/v1/cable/ICableService.js +5 -0
- package/dist/interfaces/v1/cable/index.d.ts +1 -0
- package/dist/interfaces/v1/cable/index.js +1 -0
- package/dist/interfaces/v1/charge/IChargeService.d.ts +33 -0
- package/dist/interfaces/v1/charge/IChargeService.js +5 -0
- package/dist/interfaces/v1/charge/index.d.ts +1 -0
- package/dist/interfaces/v1/charge/index.js +1 -0
- package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +30 -0
- package/dist/interfaces/v1/checkout/ICheckoutService.js +5 -0
- package/dist/interfaces/v1/checkout/index.d.ts +1 -0
- package/dist/interfaces/v1/checkout/index.js +1 -0
- package/dist/interfaces/v1/data/IDataService.d.ts +9 -0
- package/dist/interfaces/v1/data/IDataService.js +5 -0
- package/dist/interfaces/v1/data/index.d.ts +1 -0
- package/dist/interfaces/v1/data/index.js +1 -0
- package/dist/interfaces/v1/direct-debits/IDirectDebitsService.d.ts +31 -0
- package/dist/interfaces/v1/direct-debits/IDirectDebitsService.js +5 -0
- package/dist/interfaces/v1/direct-debits/index.d.ts +1 -0
- package/dist/interfaces/v1/direct-debits/index.js +1 -0
- package/dist/interfaces/v1/electricity/IElectricityService.d.ts +11 -0
- package/dist/interfaces/v1/electricity/IElectricityService.js +5 -0
- package/dist/interfaces/v1/electricity/index.d.ts +1 -0
- package/dist/interfaces/v1/electricity/index.js +1 -0
- package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.d.ts +14 -0
- package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.js +5 -0
- package/dist/interfaces/v1/globals/collections/index.d.ts +1 -0
- package/dist/interfaces/v1/globals/collections/index.js +1 -0
- package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.d.ts +30 -0
- package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.js +5 -0
- package/dist/interfaces/v1/globals/payouts/index.d.ts +1 -0
- package/dist/interfaces/v1/globals/payouts/index.js +1 -0
- package/dist/interfaces/v1/requery/IRequeryService.d.ts +17 -0
- package/dist/interfaces/v1/requery/IRequeryService.js +5 -0
- package/dist/interfaces/v1/requery/index.d.ts +1 -0
- package/dist/interfaces/v1/requery/index.js +1 -0
- package/dist/interfaces/v1/terminals/ITerminalsService.d.ts +18 -0
- package/dist/interfaces/v1/terminals/ITerminalsService.js +5 -0
- package/dist/interfaces/v1/terminals/index.d.ts +1 -0
- package/dist/interfaces/v1/terminals/index.js +1 -0
- package/dist/interfaces/v1/transactions/ITransactionsService.d.ts +34 -0
- package/dist/interfaces/v1/transactions/ITransactionsService.js +5 -0
- package/dist/interfaces/v1/transactions/index.d.ts +1 -0
- package/dist/interfaces/v1/transactions/index.js +1 -0
- package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.d.ts +27 -0
- package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.js +5 -0
- package/dist/interfaces/v1/virtual-accounts/index.d.ts +1 -0
- package/dist/interfaces/v1/virtual-accounts/index.js +1 -0
- package/dist/interfaces/v1/webhooks/IWebhooksService.d.ts +21 -0
- package/dist/interfaces/v1/webhooks/IWebhooksService.js +5 -0
- package/dist/interfaces/v1/webhooks/index.d.ts +1 -0
- package/dist/interfaces/v1/webhooks/index.js +1 -0
- package/dist/interfaces/v2/airtime/IAirtimeV2Service.d.ts +12 -0
- package/dist/interfaces/v2/airtime/IAirtimeV2Service.js +5 -0
- package/dist/interfaces/v2/airtime/index.d.ts +1 -0
- package/dist/interfaces/v2/airtime/index.js +1 -0
- package/dist/interfaces/v2/betting/IBettingV2Service.d.ts +12 -0
- package/dist/interfaces/v2/betting/IBettingV2Service.js +5 -0
- package/dist/interfaces/v2/betting/index.d.ts +1 -0
- package/dist/interfaces/v2/betting/index.js +1 -0
- package/dist/interfaces/v2/cable/ICableV2Service.d.ts +12 -0
- package/dist/interfaces/v2/cable/ICableV2Service.js +5 -0
- package/dist/interfaces/v2/cable/index.d.ts +1 -0
- package/dist/interfaces/v2/cable/index.js +1 -0
- package/dist/interfaces/v2/data/IDataV2Service.d.ts +12 -0
- package/dist/interfaces/v2/data/IDataV2Service.js +5 -0
- package/dist/interfaces/v2/data/index.d.ts +1 -0
- package/dist/interfaces/v2/data/index.js +1 -0
- package/dist/interfaces/v2/electricity/IElectricityV2Service.d.ts +12 -0
- package/dist/interfaces/v2/electricity/IElectricityV2Service.js +5 -0
- package/dist/interfaces/v2/electricity/index.d.ts +1 -0
- package/dist/interfaces/v2/electricity/index.js +1 -0
- package/dist/interfaces/v2/transfers/ITransfersService.d.ts +20 -0
- package/dist/interfaces/v2/transfers/ITransfersService.js +5 -0
- package/dist/interfaces/v2/transfers/index.d.ts +1 -0
- package/dist/interfaces/v2/transfers/index.js +1 -0
- package/dist/lib/errors.d.ts +62 -0
- package/dist/lib/errors.js +92 -0
- package/dist/lib/outcome.d.ts +18 -0
- package/dist/lib/outcome.js +107 -0
- package/dist/lib/paginate.d.ts +21 -0
- package/dist/lib/paginate.js +25 -0
- package/dist/lib/sdk-version.d.ts +5 -0
- package/dist/lib/sdk-version.generated.d.ts +1 -0
- package/dist/lib/sdk-version.generated.js +1 -0
- package/dist/lib/sdk-version.js +5 -0
- package/dist/lib/token-store.d.ts +49 -0
- package/dist/lib/token-store.js +26 -0
- package/dist/lib/util.d.ts +31 -0
- package/dist/lib/util.js +31 -0
- package/dist/lib/webhooks.d.ts +43 -0
- package/dist/lib/webhooks.js +64 -0
- package/dist/nomba.d.ts +63 -0
- package/dist/nomba.js +97 -0
- package/dist/services/http/http-client.service.d.ts +27 -0
- package/dist/services/http/http-client.service.js +317 -0
- package/dist/services/v1/accounts/accounts.service.d.ts +38 -0
- package/dist/services/v1/accounts/accounts.service.js +58 -0
- package/dist/services/v1/betting/betting.service.d.ts +16 -0
- package/dist/services/v1/betting/betting.service.js +21 -0
- package/dist/services/v1/cable/cable.service.d.ts +16 -0
- package/dist/services/v1/cable/cable.service.js +23 -0
- package/dist/services/v1/charge/charge.service.d.ts +52 -0
- package/dist/services/v1/charge/charge.service.js +99 -0
- package/dist/services/v1/checkout/checkout.service.d.ts +44 -0
- package/dist/services/v1/checkout/checkout.service.js +100 -0
- package/dist/services/v1/data/data.service.d.ts +14 -0
- package/dist/services/v1/data/data.service.js +16 -0
- package/dist/services/v1/direct-debits/direct-debits.service.d.ts +45 -0
- package/dist/services/v1/direct-debits/direct-debits.service.js +69 -0
- package/dist/services/v1/electricity/electricity.service.d.ts +16 -0
- package/dist/services/v1/electricity/electricity.service.js +21 -0
- package/dist/services/v1/globals/collections.service.d.ts +28 -0
- package/dist/services/v1/globals/collections.service.js +38 -0
- package/dist/services/v1/globals/payout.service.d.ts +45 -0
- package/dist/services/v1/globals/payout.service.js +95 -0
- package/dist/services/v1/requery/requery.service.d.ts +31 -0
- package/dist/services/v1/requery/requery.service.js +41 -0
- package/dist/services/v1/terminals/terminals.service.d.ts +38 -0
- package/dist/services/v1/terminals/terminals.service.js +69 -0
- package/dist/services/v1/transactions/transactions.service.d.ts +48 -0
- package/dist/services/v1/transactions/transactions.service.js +98 -0
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.d.ts +41 -0
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +56 -0
- package/dist/services/v1/webhooks/webhooks.service.d.ts +36 -0
- package/dist/services/v1/webhooks/webhooks.service.js +60 -0
- package/dist/services/v2/airtime/airtime.service.d.ts +18 -0
- package/dist/services/v2/airtime/airtime.service.js +35 -0
- package/dist/services/v2/betting/betting.service.d.ts +19 -0
- package/dist/services/v2/betting/betting.service.js +36 -0
- package/dist/services/v2/cable/cable.service.d.ts +19 -0
- package/dist/services/v2/cable/cable.service.js +36 -0
- package/dist/services/v2/data/data.service.d.ts +18 -0
- package/dist/services/v2/data/data.service.js +35 -0
- package/dist/services/v2/electricity/electricity.service.d.ts +19 -0
- package/dist/services/v2/electricity/electricity.service.js +36 -0
- package/dist/services/v2/transfers/transfers.service.d.ts +30 -0
- package/dist/services/v2/transfers/transfers.service.js +67 -0
- package/dist/types/common/common.types.d.ts +78 -0
- package/dist/types/common/common.types.js +5 -0
- package/dist/types/common/outcome.types.d.ts +53 -0
- package/dist/types/common/outcome.types.js +5 -0
- package/dist/types/v1/accounts/accounts.types.d.ts +37 -0
- package/dist/types/v1/accounts/accounts.types.js +8 -0
- package/dist/types/v1/betting/betting.types.d.ts +26 -0
- package/dist/types/v1/betting/betting.types.js +5 -0
- package/dist/types/v1/cable/cable.types.d.ts +24 -0
- package/dist/types/v1/cable/cable.types.js +5 -0
- package/dist/types/v1/charge/charge.types.d.ts +102 -0
- package/dist/types/v1/charge/charge.types.js +5 -0
- package/dist/types/v1/checkout/checkout.types.d.ts +139 -0
- package/dist/types/v1/checkout/checkout.types.js +5 -0
- package/dist/types/v1/data/data.types.d.ts +14 -0
- package/dist/types/v1/data/data.types.js +5 -0
- package/dist/types/v1/direct-debits/direct-debits.types.d.ts +104 -0
- package/dist/types/v1/direct-debits/direct-debits.types.js +5 -0
- package/dist/types/v1/electricity/electricity.types.d.ts +21 -0
- package/dist/types/v1/electricity/electricity.types.js +5 -0
- package/dist/types/v1/globals/collections.types.d.ts +49 -0
- package/dist/types/v1/globals/collections.types.js +5 -0
- package/dist/types/v1/globals/payout.types.d.ts +183 -0
- package/dist/types/v1/globals/payout.types.js +5 -0
- package/dist/types/v1/requery/requery.types.d.ts +49 -0
- package/dist/types/v1/requery/requery.types.js +5 -0
- package/dist/types/v1/terminals/terminals.types.d.ts +44 -0
- package/dist/types/v1/terminals/terminals.types.js +5 -0
- package/dist/types/v1/transactions/transactions.types.d.ts +87 -0
- package/dist/types/v1/transactions/transactions.types.js +5 -0
- package/dist/types/v1/virtual-accounts/virtual-accounts.types.d.ts +64 -0
- package/dist/types/v1/virtual-accounts/virtual-accounts.types.js +5 -0
- package/dist/types/v1/webhooks/webhooks.types.d.ts +54 -0
- package/dist/types/v1/webhooks/webhooks.types.js +5 -0
- package/dist/types/v2/airtime/airtime.types.d.ts +31 -0
- package/dist/types/v2/airtime/airtime.types.js +5 -0
- package/dist/types/v2/betting/betting.types.d.ts +33 -0
- package/dist/types/v2/betting/betting.types.js +5 -0
- package/dist/types/v2/cable/cable.types.d.ts +32 -0
- package/dist/types/v2/cable/cable.types.js +5 -0
- package/dist/types/v2/data/data.types.d.ts +32 -0
- package/dist/types/v2/data/data.types.js +5 -0
- package/dist/types/v2/electricity/electricity.types.d.ts +34 -0
- package/dist/types/v2/electricity/electricity.types.js +5 -0
- package/dist/types/v2/transfers/transfers.types.d.ts +99 -0
- package/dist/types/v2/transfers/transfers.types.js +5 -0
- package/package.json +42 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/accounts
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @description 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/accounts
|
|
14
|
+
*/
|
|
15
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
|
+
import type { IAccountsService } from "../../../interfaces/v1/accounts/index.js";
|
|
17
|
+
import type { AccountBalance, AccountDetails, SubAccountLookup } from "../../../types/v1/accounts/accounts.types.js";
|
|
18
|
+
import type { Terminal, TerminalList, TerminalListParams } from "../../../types/v1/terminals/terminals.types.js";
|
|
19
|
+
export declare class AccountsService implements IAccountsService {
|
|
20
|
+
private readonly http;
|
|
21
|
+
constructor(http: IHttpClient);
|
|
22
|
+
/** GET /v1/accounts/parent */
|
|
23
|
+
getParentAccount(): Promise<AccountDetails>;
|
|
24
|
+
/** GET /v1/accounts/balance */
|
|
25
|
+
getParentBalance(): Promise<AccountBalance>;
|
|
26
|
+
/** GET /v1/accounts/sub-account-details */
|
|
27
|
+
getSubAccount(lookup?: SubAccountLookup): Promise<AccountDetails>;
|
|
28
|
+
/** GET /v1/accounts/{subAccountId}/balance */
|
|
29
|
+
getSubAccountBalance(subAccountId: string): Promise<AccountBalance>;
|
|
30
|
+
/** GET /v1/accounts/terminals */
|
|
31
|
+
listParentTerminals(params?: TerminalListParams): Promise<TerminalList>;
|
|
32
|
+
/** GET /v1/accounts/{accountId}/terminals */
|
|
33
|
+
listSubAccountTerminals(accountId: string, params?: TerminalListParams): Promise<TerminalList>;
|
|
34
|
+
/** Every terminal of the parent account, across all pages. Starts at `params.cursor` if given. */
|
|
35
|
+
iterateParentTerminals(params?: TerminalListParams): AsyncGenerator<Terminal>;
|
|
36
|
+
/** Every terminal of a sub account, across all pages. Starts at `params.cursor` if given. */
|
|
37
|
+
iterateSubAccountTerminals(accountId: string, params?: TerminalListParams): AsyncGenerator<Terminal>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/accounts
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @description 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/accounts
|
|
14
|
+
*/
|
|
15
|
+
import { paginate } from "../../../lib/paginate.js";
|
|
16
|
+
import { pageQuery, pathId } from "../../../lib/util.js";
|
|
17
|
+
export class AccountsService {
|
|
18
|
+
http;
|
|
19
|
+
constructor(http) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
/** GET /v1/accounts/parent */
|
|
23
|
+
getParentAccount() {
|
|
24
|
+
return this.http.request("GET", "/v1/accounts/parent");
|
|
25
|
+
}
|
|
26
|
+
/** GET /v1/accounts/balance */
|
|
27
|
+
getParentBalance() {
|
|
28
|
+
return this.http.request("GET", "/v1/accounts/balance");
|
|
29
|
+
}
|
|
30
|
+
/** GET /v1/accounts/sub-account-details */
|
|
31
|
+
getSubAccount(lookup = {}) {
|
|
32
|
+
return this.http.request("GET", "/v1/accounts/sub-account-details", {
|
|
33
|
+
query: lookup,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** GET /v1/accounts/{subAccountId}/balance */
|
|
37
|
+
async getSubAccountBalance(subAccountId) {
|
|
38
|
+
return this.http.request("GET", `/v1/accounts/${pathId(subAccountId)}/balance`);
|
|
39
|
+
}
|
|
40
|
+
/** GET /v1/accounts/terminals */
|
|
41
|
+
listParentTerminals(params = {}) {
|
|
42
|
+
return this.http.request("GET", "/v1/accounts/terminals", {
|
|
43
|
+
query: pageQuery(params),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** GET /v1/accounts/{accountId}/terminals */
|
|
47
|
+
async listSubAccountTerminals(accountId, params = {}) {
|
|
48
|
+
return this.http.request("GET", `/v1/accounts/${pathId(accountId)}/terminals`, { query: pageQuery(params) });
|
|
49
|
+
}
|
|
50
|
+
/** Every terminal of the parent account, across all pages. Starts at `params.cursor` if given. */
|
|
51
|
+
iterateParentTerminals(params = {}) {
|
|
52
|
+
return paginate((cursor) => this.listParentTerminals(cursor ? { ...params, cursor } : params));
|
|
53
|
+
}
|
|
54
|
+
/** Every terminal of a sub account, across all pages. Starts at `params.cursor` if given. */
|
|
55
|
+
iterateSubAccountTerminals(accountId, params = {}) {
|
|
56
|
+
return paginate((cursor) => this.listSubAccountTerminals(accountId, cursor ? { ...params, cursor } : params));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/betting
|
|
3
|
+
* @description Betting (v1): GET /v1/bill/betting/providers, GET /v1/bill/betting/lookup
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
7
|
+
import type { IBettingService } from "../../../interfaces/v1/betting/index.js";
|
|
8
|
+
import type { BettingCustomerLookupParams, BettingCustomerLookupResult, BettingProvidersResult } from "../../../types/v1/betting/betting.types.js";
|
|
9
|
+
export declare class BettingService implements IBettingService {
|
|
10
|
+
private readonly http;
|
|
11
|
+
constructor(http: IHttpClient);
|
|
12
|
+
/** GET /v1/bill/betting/providers */
|
|
13
|
+
getBettingProviders(): Promise<BettingProvidersResult>;
|
|
14
|
+
/** GET /v1/bill/betting/lookup */
|
|
15
|
+
lookupCustomer(params: BettingCustomerLookupParams): Promise<BettingCustomerLookupResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/betting
|
|
3
|
+
* @description Betting (v1): GET /v1/bill/betting/providers, GET /v1/bill/betting/lookup
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
export class BettingService {
|
|
7
|
+
http;
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
/** GET /v1/bill/betting/providers */
|
|
12
|
+
getBettingProviders() {
|
|
13
|
+
return this.http.request("GET", "/v1/bill/betting/providers");
|
|
14
|
+
}
|
|
15
|
+
/** GET /v1/bill/betting/lookup */
|
|
16
|
+
lookupCustomer(params) {
|
|
17
|
+
return this.http.request("GET", "/v1/bill/betting/lookup", {
|
|
18
|
+
query: params,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/cable
|
|
3
|
+
* @description Cable TV (v1): GET /v1/bill/cableTvProduct, GET /v1/bill/cable/lookup
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
7
|
+
import type { ICableService } from "../../../interfaces/v1/cable/index.js";
|
|
8
|
+
import type { CableCustomerLookupParams, CableCustomerLookupResult, CablePlansParams, CablePlansResult } from "../../../types/v1/cable/cable.types.js";
|
|
9
|
+
export declare class CableService implements ICableService {
|
|
10
|
+
private readonly http;
|
|
11
|
+
constructor(http: IHttpClient);
|
|
12
|
+
/** GET /v1/bill/cableTvProduct */
|
|
13
|
+
getCablePlans(params: CablePlansParams): Promise<CablePlansResult>;
|
|
14
|
+
/** GET /v1/bill/cable/lookup */
|
|
15
|
+
lookupCustomer(params: CableCustomerLookupParams): Promise<CableCustomerLookupResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/cable
|
|
3
|
+
* @description Cable TV (v1): GET /v1/bill/cableTvProduct, GET /v1/bill/cable/lookup
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
export class CableService {
|
|
7
|
+
http;
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
/** GET /v1/bill/cableTvProduct */
|
|
12
|
+
getCablePlans(params) {
|
|
13
|
+
return this.http.request("GET", "/v1/bill/cableTvProduct", {
|
|
14
|
+
query: params,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** GET /v1/bill/cable/lookup */
|
|
18
|
+
lookupCustomer(params) {
|
|
19
|
+
return this.http.request("GET", "/v1/bill/cable/lookup", {
|
|
20
|
+
query: params,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/charge
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @author Nomba Financial Services
|
|
5
|
+
* @description Charge resource
|
|
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/charge
|
|
14
|
+
*/
|
|
15
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
|
+
import type { IChargeService } from "../../../interfaces/v1/charge/IChargeService.js";
|
|
17
|
+
import type { RequestOptions } from "../../../types/common/common.types.js";
|
|
18
|
+
import type { CancelChargeTransactionParams, ChargeOrder, ChargeTransactionDetails, FlashAccount, SaveCardOtpRequest, SubmitCardDetailsParams, SubmitCardDetailsResult, SubmitCardOtpParams, SubmitCardOtpResult, SubmitSaveCardOtpParams } from "../../../types/v1/charge/charge.types.js";
|
|
19
|
+
import type { CheckoutResult, TokenizedCardData } from "../../../types/v1/checkout/checkout.types.js";
|
|
20
|
+
/**
|
|
21
|
+
* The Charge API: build your own checkout on top of an order created with `nomba.checkout.createOrder`.
|
|
22
|
+
* Flow: getOrder, submitCardDetails, submitCardOtp, then fetchTransactionDetails.
|
|
23
|
+
* Sandbox variants of these endpoints are not documented, so they always use /v1/checkout.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ChargeService implements IChargeService {
|
|
26
|
+
private readonly http;
|
|
27
|
+
constructor(http: IHttpClient);
|
|
28
|
+
/** GET /v1/checkout/order/{orderReference} */
|
|
29
|
+
getOrder(orderReference: string): Promise<ChargeOrder>;
|
|
30
|
+
/** POST /v1/checkout/checkout-card-detail */
|
|
31
|
+
submitCardDetails(params: SubmitCardDetailsParams, options?: RequestOptions): Promise<SubmitCardDetailsResult>;
|
|
32
|
+
/** POST /v1/checkout/checkout-card-otp */
|
|
33
|
+
submitCardOtp(params: SubmitCardOtpParams, options?: RequestOptions): Promise<SubmitCardOtpResult>;
|
|
34
|
+
/** POST /v1/checkout/resend-otp. Resends the payment OTP to the customer's phone. */
|
|
35
|
+
resendOtp(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
|
|
36
|
+
/** POST /v1/checkout/confirm-transaction-receipt. The status after the OTP is submitted or a transfer is made. */
|
|
37
|
+
fetchTransactionDetails(orderReference: string): Promise<ChargeTransactionDetails>;
|
|
38
|
+
/** GET /v1/checkout/get-checkout-kta/{orderReference}. A Flash account number the customer can pay by transfer. */
|
|
39
|
+
fetchFlashAccount(orderReference: string): Promise<FlashAccount>;
|
|
40
|
+
/** POST /v1/checkout/transaction/cancel. Cancels an incomplete checkout transaction. */
|
|
41
|
+
cancelTransaction(params: CancelChargeTransactionParams, options?: RequestOptions): Promise<CheckoutResult>;
|
|
42
|
+
/** POST /v1/checkout/user-card/saved-card/auth. Sends an OTP; use when getOrder says the user has saved cards. */
|
|
43
|
+
requestSavedCardsOtp(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
|
|
44
|
+
/** GET /v1/checkout/user-card/{orderReference}. Needs the OTP from requestSavedCardsOtp. */
|
|
45
|
+
getSavedCards(orderReference: string, otp: string): Promise<{
|
|
46
|
+
tokenizedCardData?: TokenizedCardData[];
|
|
47
|
+
}>;
|
|
48
|
+
/** POST /v1/checkout/user-card/auth. Sends an OTP before saving a card; call after a successful payment. */
|
|
49
|
+
requestSaveCardOtp(params: SaveCardOtpRequest, options?: RequestOptions): Promise<CheckoutResult>;
|
|
50
|
+
/** POST /v1/checkout/user-card. Submits the OTP, which saves the card for later use. */
|
|
51
|
+
submitSaveCardOtp(params: SubmitSaveCardOtpParams, options?: RequestOptions): Promise<CheckoutResult>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/charge
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @author Nomba Financial Services
|
|
5
|
+
* @description Charge resource
|
|
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/charge
|
|
14
|
+
*/
|
|
15
|
+
import { pathId } from "../../../lib/util.js";
|
|
16
|
+
/**
|
|
17
|
+
* The Charge API: build your own checkout on top of an order created with `nomba.checkout.createOrder`.
|
|
18
|
+
* Flow: getOrder, submitCardDetails, submitCardOtp, then fetchTransactionDetails.
|
|
19
|
+
* Sandbox variants of these endpoints are not documented, so they always use /v1/checkout.
|
|
20
|
+
*/
|
|
21
|
+
export class ChargeService {
|
|
22
|
+
http;
|
|
23
|
+
constructor(http) {
|
|
24
|
+
this.http = http;
|
|
25
|
+
}
|
|
26
|
+
/** GET /v1/checkout/order/{orderReference} */
|
|
27
|
+
async getOrder(orderReference) {
|
|
28
|
+
return this.http.request("GET", `/v1/checkout/order/${pathId(orderReference)}`);
|
|
29
|
+
}
|
|
30
|
+
/** POST /v1/checkout/checkout-card-detail */
|
|
31
|
+
async submitCardDetails(params, options = {}) {
|
|
32
|
+
const { cardDetails } = params;
|
|
33
|
+
return this.http.request("POST", "/v1/checkout/checkout-card-detail", {
|
|
34
|
+
body: {
|
|
35
|
+
...params,
|
|
36
|
+
...(typeof cardDetails === "object" && {
|
|
37
|
+
cardDetails: JSON.stringify(cardDetails),
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
...options,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** POST /v1/checkout/checkout-card-otp */
|
|
44
|
+
submitCardOtp(params, options = {}) {
|
|
45
|
+
return this.http.request("POST", "/v1/checkout/checkout-card-otp", {
|
|
46
|
+
body: params,
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** POST /v1/checkout/resend-otp. Resends the payment OTP to the customer's phone. */
|
|
51
|
+
resendOtp(orderReference, options = {}) {
|
|
52
|
+
return this.http.request("POST", "/v1/checkout/resend-otp", {
|
|
53
|
+
body: { orderReference },
|
|
54
|
+
...options,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** POST /v1/checkout/confirm-transaction-receipt. The status after the OTP is submitted or a transfer is made. */
|
|
58
|
+
fetchTransactionDetails(orderReference) {
|
|
59
|
+
return this.http.request("POST", "/v1/checkout/confirm-transaction-receipt", {
|
|
60
|
+
body: { orderReference },
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** GET /v1/checkout/get-checkout-kta/{orderReference}. A Flash account number the customer can pay by transfer. */
|
|
64
|
+
async fetchFlashAccount(orderReference) {
|
|
65
|
+
return this.http.request("GET", `/v1/checkout/get-checkout-kta/${pathId(orderReference)}`);
|
|
66
|
+
}
|
|
67
|
+
/** POST /v1/checkout/transaction/cancel. Cancels an incomplete checkout transaction. */
|
|
68
|
+
cancelTransaction(params, options = {}) {
|
|
69
|
+
return this.http.request("POST", "/v1/checkout/transaction/cancel", {
|
|
70
|
+
body: params,
|
|
71
|
+
...options,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** POST /v1/checkout/user-card/saved-card/auth. Sends an OTP; use when getOrder says the user has saved cards. */
|
|
75
|
+
requestSavedCardsOtp(orderReference, options = {}) {
|
|
76
|
+
return this.http.request("POST", "/v1/checkout/user-card/saved-card/auth", {
|
|
77
|
+
body: { orderReference },
|
|
78
|
+
...options,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** GET /v1/checkout/user-card/{orderReference}. Needs the OTP from requestSavedCardsOtp. */
|
|
82
|
+
async getSavedCards(orderReference, otp) {
|
|
83
|
+
return this.http.request("GET", `/v1/checkout/user-card/${pathId(orderReference)}`, { query: { otp } });
|
|
84
|
+
}
|
|
85
|
+
/** POST /v1/checkout/user-card/auth. Sends an OTP before saving a card; call after a successful payment. */
|
|
86
|
+
requestSaveCardOtp(params, options = {}) {
|
|
87
|
+
return this.http.request("POST", "/v1/checkout/user-card/auth", {
|
|
88
|
+
body: params,
|
|
89
|
+
...options,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** POST /v1/checkout/user-card. Submits the OTP, which saves the card for later use. */
|
|
93
|
+
submitSaveCardOtp(params, options = {}) {
|
|
94
|
+
return this.http.request("POST", "/v1/checkout/user-card", {
|
|
95
|
+
body: params,
|
|
96
|
+
...options,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/checkout
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @author Nomba Financial Services
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @description Checkout resource
|
|
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/checkout
|
|
14
|
+
*/
|
|
15
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
|
+
import type { ICheckoutService } from "../../../interfaces/v1/checkout/ICheckoutService.js";
|
|
17
|
+
import type { CallOptions, RequestOptions } 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";
|
|
19
|
+
export declare class CheckoutService implements ICheckoutService {
|
|
20
|
+
private readonly http;
|
|
21
|
+
constructor(http: IHttpClient);
|
|
22
|
+
/**
|
|
23
|
+
* POST /v1/checkout/order. Send the customer to `checkoutLink` to pay.
|
|
24
|
+
* Verified against a real sandbox call to use /v1/checkout/order, not /sandbox/checkout/order as the
|
|
25
|
+
* sandbox-testing guide claims (that path 404s); sandbox and production share this path.
|
|
26
|
+
*/
|
|
27
|
+
createOrder(params: CreateCheckoutOrderParams, options?: RequestOptions): Promise<CheckoutOrderCreated>;
|
|
28
|
+
/** GET /v1/checkout/transaction. Verified in sandbox; see the note on createOrder. */
|
|
29
|
+
fetchTransaction(params?: FetchCheckoutTransactionParams): Promise<CheckoutTransaction>;
|
|
30
|
+
/** POST /v1/checkout/order/cancel. Only for orders not yet paid; use `refund` after payment. */
|
|
31
|
+
cancelOrder(orderReference: string, options?: RequestOptions): Promise<CheckoutResult>;
|
|
32
|
+
/** POST /v1/checkout/refund. Verified in sandbox; see the note on createOrder. */
|
|
33
|
+
refund<R = CheckoutResult>(params: RefundCheckoutTransactionParams, options?: CallOptions<CheckoutResult, R>): Promise<CheckoutResult | R>;
|
|
34
|
+
/** POST /v1/checkout/tokenized-card-payment. Check `status` on the result: it says whether the charge went through. */
|
|
35
|
+
chargeTokenizedCard(params: ChargeTokenizedCardParams, options?: RequestOptions): Promise<TokenizedCardResult>;
|
|
36
|
+
/** GET /v1/checkout/tokenized-card-data */
|
|
37
|
+
listTokenizedCards(params?: ListTokenizedCardsParams): Promise<TokenizedCardList>;
|
|
38
|
+
/** Every tokenized card matching the filters, across all pages. Starts at `params.page` if given. */
|
|
39
|
+
iterateTokenizedCards(params?: ListTokenizedCardsParams): AsyncGenerator<TokenizedCardData>;
|
|
40
|
+
/** POST /v1/checkout/tokenized-card-data */
|
|
41
|
+
updateTokenizedCard(params: UpdateTokenizedCardParams, options?: RequestOptions): Promise<UpdatedTokenizedCard>;
|
|
42
|
+
/** DELETE /v1/checkout/tokenized-card-data */
|
|
43
|
+
deleteTokenizedCard(tokenKey: string, options?: RequestOptions): Promise<TokenizedCardResult>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/checkout
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @author Nomba Financial Services
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @description Checkout resource
|
|
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/checkout
|
|
14
|
+
*/
|
|
15
|
+
import { REJECTED, settle } from "../../../lib/outcome.js";
|
|
16
|
+
import { paginate } from "../../../lib/paginate.js";
|
|
17
|
+
// The refund endpoint documents code "00" and a `success` boolean in data. The docs don't say `false` is final, so
|
|
18
|
+
// it is pending (requery before refunding again), like Global Payout's FAILED.
|
|
19
|
+
const REFUND_OUTCOMES = {
|
|
20
|
+
codes: { "00": "success", ...REJECTED },
|
|
21
|
+
statuses: { true: "success", false: "pending" },
|
|
22
|
+
statusOf: (data) => {
|
|
23
|
+
const ok = data?.success;
|
|
24
|
+
return typeof ok === "boolean" ? String(ok) : undefined;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export class CheckoutService {
|
|
28
|
+
http;
|
|
29
|
+
constructor(http) {
|
|
30
|
+
this.http = http;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* POST /v1/checkout/order. Send the customer to `checkoutLink` to pay.
|
|
34
|
+
* Verified against a real sandbox call to use /v1/checkout/order, not /sandbox/checkout/order as the
|
|
35
|
+
* sandbox-testing guide claims (that path 404s); sandbox and production share this path.
|
|
36
|
+
*/
|
|
37
|
+
createOrder(params, options = {}) {
|
|
38
|
+
// Your own orderReference is the natural idempotency key for an order; if neither it nor an
|
|
39
|
+
// explicit option is set, the client falls back to a generated UUID.
|
|
40
|
+
const idempotencyKey = options.idempotencyKey ?? params.order.orderReference;
|
|
41
|
+
return this.http.request("POST", "/v1/checkout/order", {
|
|
42
|
+
body: params,
|
|
43
|
+
...options,
|
|
44
|
+
...(idempotencyKey !== undefined && { idempotencyKey }),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** GET /v1/checkout/transaction. Verified in sandbox; see the note on createOrder. */
|
|
48
|
+
fetchTransaction(params = {}) {
|
|
49
|
+
return this.http.request("GET", "/v1/checkout/transaction", {
|
|
50
|
+
query: params,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** POST /v1/checkout/order/cancel. Only for orders not yet paid; use `refund` after payment. */
|
|
54
|
+
cancelOrder(orderReference, options = {}) {
|
|
55
|
+
return this.http.request("POST", "/v1/checkout/order/cancel", {
|
|
56
|
+
body: { orderReference },
|
|
57
|
+
...options,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** POST /v1/checkout/refund. Verified in sandbox; see the note on createOrder. */
|
|
61
|
+
async refund(params, options = {}) {
|
|
62
|
+
return settle(this.http, "POST", "/v1/checkout/refund", { body: params }, REFUND_OUTCOMES, options);
|
|
63
|
+
}
|
|
64
|
+
/** POST /v1/checkout/tokenized-card-payment. Check `status` on the result: it says whether the charge went through. */
|
|
65
|
+
chargeTokenizedCard(params, options = {}) {
|
|
66
|
+
return this.http.request("POST", "/v1/checkout/tokenized-card-payment", {
|
|
67
|
+
body: params,
|
|
68
|
+
...options,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** GET /v1/checkout/tokenized-card-data */
|
|
72
|
+
listTokenizedCards(params = {}) {
|
|
73
|
+
return this.http.request("GET", "/v1/checkout/tokenized-card-data", {
|
|
74
|
+
query: params,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Every tokenized card matching the filters, across all pages. Starts at `params.page` if given. */
|
|
78
|
+
iterateTokenizedCards(params = {}) {
|
|
79
|
+
return paginate(async (cursor) => {
|
|
80
|
+
const r = await this.listTokenizedCards(cursor ? { ...params, page: Number(cursor) } : params);
|
|
81
|
+
// nextPage is "0" when there are no more pages.
|
|
82
|
+
const next = r.nextPage && r.nextPage !== "0" ? r.nextPage : "";
|
|
83
|
+
return { results: r.tokenizedCardDataList ?? [], cursor: next };
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** POST /v1/checkout/tokenized-card-data */
|
|
87
|
+
updateTokenizedCard(params, options = {}) {
|
|
88
|
+
return this.http.request("POST", "/v1/checkout/tokenized-card-data", {
|
|
89
|
+
body: params,
|
|
90
|
+
...options,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** DELETE /v1/checkout/tokenized-card-data */
|
|
94
|
+
deleteTokenizedCard(tokenKey, options = {}) {
|
|
95
|
+
return this.http.request("DELETE", "/v1/checkout/tokenized-card-data", {
|
|
96
|
+
body: { tokenKey },
|
|
97
|
+
...options,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/data
|
|
3
|
+
* @description Data plans (v1): GET /v1/bill/data-plan/{telco}
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
7
|
+
import type { IDataService } from "../../../interfaces/v1/data/index.js";
|
|
8
|
+
import type { DataPlansResult } from "../../../types/v1/data/data.types.js";
|
|
9
|
+
export declare class DataService implements IDataService {
|
|
10
|
+
private readonly http;
|
|
11
|
+
constructor(http: IHttpClient);
|
|
12
|
+
/** GET /v1/bill/data-plan/{telco} */
|
|
13
|
+
getDataPlans(telco: string): Promise<DataPlansResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/data
|
|
3
|
+
* @description Data plans (v1): GET /v1/bill/data-plan/{telco}
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
import { pathId } from "../../../lib/util.js";
|
|
7
|
+
export class DataService {
|
|
8
|
+
http;
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/** GET /v1/bill/data-plan/{telco} */
|
|
13
|
+
getDataPlans(telco) {
|
|
14
|
+
return this.http.request("GET", `/v1/bill/data-plan/${pathId(telco)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/direct-debits
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @description Direct Debits resource
|
|
5
|
+
* @author Nomba Financial Services
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @copyright 2026 Nomba
|
|
9
|
+
* @homepage https://nomba.com
|
|
10
|
+
* @support https://nomba.com/support
|
|
11
|
+
* @repository https://github.com/kudi-inc/nomba-sdk-node
|
|
12
|
+
* @docs https://developer.nomba.com
|
|
13
|
+
* @see https://developer.nomba.com/docs/api-reference/direct-debits
|
|
14
|
+
*/
|
|
15
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
|
+
import type { IDirectDebitsService } from "../../../interfaces/v1/direct-debits/IDirectDebitsService.js";
|
|
17
|
+
import type { RequestOptions } from "../../../types/common/common.types.js";
|
|
18
|
+
import type { CreatedMandate, CreateMandateParams, DebitMandateParams, ListMandatesParams, MandateDebitResult, MandatePage, MandateStatus, UpdatedMandateStatus, UpdateMandateStatusParams } from "../../../types/v1/direct-debits/direct-debits.types.js";
|
|
19
|
+
export declare class DirectDebitsService implements IDirectDebitsService {
|
|
20
|
+
private readonly http;
|
|
21
|
+
constructor(http: IHttpClient);
|
|
22
|
+
/**
|
|
23
|
+
* POST /v1/direct-debits.
|
|
24
|
+
* ponytail: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
|
|
25
|
+
* other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
|
|
26
|
+
*/
|
|
27
|
+
createMandate(params: CreateMandateParams, options?: RequestOptions): Promise<CreatedMandate>;
|
|
28
|
+
/** GET /v1/direct-debits/status?mandateId={mandateId} */
|
|
29
|
+
getMandateStatus(mandateId: string): Promise<MandateStatus>;
|
|
30
|
+
/**
|
|
31
|
+
* POST /v1/direct-debits/debit-mandate. Unlike createMandate, there is no per-transaction reference
|
|
32
|
+
* field to default the idempotency key to (mandateId is stable across every debit on that mandate, so
|
|
33
|
+
* defaulting to it would give every recurring debit the same key). Pass your own idempotencyKey if you
|
|
34
|
+
* need retries deduplicated; otherwise the client generates a fresh one per call.
|
|
35
|
+
*/
|
|
36
|
+
debitMandate(params: DebitMandateParams, options?: RequestOptions): Promise<MandateDebitResult>;
|
|
37
|
+
/** GET /v1/direct-debits/mandates */
|
|
38
|
+
listMandates(params: ListMandatesParams): Promise<MandatePage>;
|
|
39
|
+
/**
|
|
40
|
+
* PUT /v1/direct-debits/update-status. Same reasoning as debitMandate: mandateId is stable across every
|
|
41
|
+
* status change on that mandate (SUSPEND, then ACTIVE, then SUSPEND again), so it is not a safe default
|
|
42
|
+
* idempotency key. Pass your own if you need a retry deduplicated.
|
|
43
|
+
*/
|
|
44
|
+
updateMandateStatus(params: UpdateMandateStatusParams, options?: RequestOptions): Promise<UpdatedMandateStatus>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/direct-debits
|
|
3
|
+
* @description Nomba SDK for Node.js
|
|
4
|
+
* @description Direct Debits resource
|
|
5
|
+
* @author Nomba Financial Services
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @copyright 2026 Nomba
|
|
9
|
+
* @homepage https://nomba.com
|
|
10
|
+
* @support https://nomba.com/support
|
|
11
|
+
* @repository https://github.com/kudi-inc/nomba-sdk-node
|
|
12
|
+
* @docs https://developer.nomba.com
|
|
13
|
+
* @see https://developer.nomba.com/docs/api-reference/direct-debits
|
|
14
|
+
*/
|
|
15
|
+
export class DirectDebitsService {
|
|
16
|
+
http;
|
|
17
|
+
constructor(http) {
|
|
18
|
+
this.http = http;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* POST /v1/direct-debits.
|
|
22
|
+
* ponytail: this endpoint's response envelope is `{ responseCode, responseMessage, data }`, unlike every
|
|
23
|
+
* other endpoint's `{ code, description, data }` — confirmed from the spec's own example, not guessed.
|
|
24
|
+
*/
|
|
25
|
+
createMandate(params, options = {}) {
|
|
26
|
+
return this.http.request("POST", "/v1/direct-debits", {
|
|
27
|
+
body: params,
|
|
28
|
+
codeField: "responseCode",
|
|
29
|
+
descriptionField: "responseMessage",
|
|
30
|
+
...options,
|
|
31
|
+
idempotencyKey: options.idempotencyKey ?? params.merchantReference,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** GET /v1/direct-debits/status?mandateId={mandateId} */
|
|
35
|
+
getMandateStatus(mandateId) {
|
|
36
|
+
return this.http.request("GET", "/v1/direct-debits/status", {
|
|
37
|
+
query: { mandateId },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* POST /v1/direct-debits/debit-mandate. Unlike createMandate, there is no per-transaction reference
|
|
42
|
+
* field to default the idempotency key to (mandateId is stable across every debit on that mandate, so
|
|
43
|
+
* defaulting to it would give every recurring debit the same key). Pass your own idempotencyKey if you
|
|
44
|
+
* need retries deduplicated; otherwise the client generates a fresh one per call.
|
|
45
|
+
*/
|
|
46
|
+
debitMandate(params, options = {}) {
|
|
47
|
+
return this.http.request("POST", "/v1/direct-debits/debit-mandate", {
|
|
48
|
+
body: params,
|
|
49
|
+
...options,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** GET /v1/direct-debits/mandates */
|
|
53
|
+
listMandates(params) {
|
|
54
|
+
return this.http.request("GET", "/v1/direct-debits/mandates", {
|
|
55
|
+
query: params,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* PUT /v1/direct-debits/update-status. Same reasoning as debitMandate: mandateId is stable across every
|
|
60
|
+
* status change on that mandate (SUSPEND, then ACTIVE, then SUSPEND again), so it is not a safe default
|
|
61
|
+
* idempotency key. Pass your own if you need a retry deduplicated.
|
|
62
|
+
*/
|
|
63
|
+
updateMandateStatus(params, options = {}) {
|
|
64
|
+
return this.http.request("PUT", "/v1/direct-debits/update-status", {
|
|
65
|
+
body: params,
|
|
66
|
+
...options,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module nomba/services/v1/electricity
|
|
3
|
+
* @description Electricity (v1): GET /v1/bill/electricity/discos, GET /v1/bill/electricity/lookup
|
|
4
|
+
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
|
+
*/
|
|
6
|
+
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
7
|
+
import type { IElectricityService } from "../../../interfaces/v1/electricity/index.js";
|
|
8
|
+
import type { ElectricityProvidersResult, MeterLookupParams, MeterLookupResult } from "../../../types/v1/electricity/electricity.types.js";
|
|
9
|
+
export declare class ElectricityService implements IElectricityService {
|
|
10
|
+
private readonly http;
|
|
11
|
+
constructor(http: IHttpClient);
|
|
12
|
+
/** GET /v1/bill/electricity/discos */
|
|
13
|
+
getElectricityProviders(): Promise<ElectricityProvidersResult>;
|
|
14
|
+
/** GET /v1/bill/electricity/lookup */
|
|
15
|
+
lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
|
|
16
|
+
}
|