@nomba/node-sdk 0.1.0 → 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.
- package/README.md +31 -4
- package/dist/interfaces/v1/accounts/IAccountsService.d.ts +46 -8
- package/dist/interfaces/v1/betting/IBettingService.d.ts +11 -2
- package/dist/interfaces/v1/cable/ICableService.d.ts +12 -2
- package/dist/interfaces/v1/charge/IChargeService.d.ts +80 -19
- package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +64 -15
- package/dist/interfaces/v1/data/IDataService.d.ts +6 -1
- package/dist/interfaces/v1/direct-debits/IDirectDebitsService.d.ts +37 -14
- package/dist/interfaces/v1/electricity/IElectricityService.d.ts +11 -2
- package/dist/interfaces/v1/globals/collections/IGlobalCollectionsService.d.ts +20 -5
- package/dist/interfaces/v1/globals/payouts/IGlobalPayoutService.d.ts +74 -13
- package/dist/interfaces/v1/requery/IRequeryService.d.ts +19 -5
- package/dist/interfaces/v1/terminals/ITerminalsService.d.ts +43 -10
- package/dist/interfaces/v1/transactions/ITransactionsService.d.ts +71 -12
- package/dist/interfaces/v1/virtual-accounts/IVirtualAccountsService.d.ts +50 -12
- package/dist/interfaces/v1/webhooks/IWebhooksService.d.ts +29 -10
- package/dist/interfaces/v2/airtime/IAirtimeV2Service.d.ts +21 -2
- package/dist/interfaces/v2/betting/IBettingV2Service.d.ts +21 -2
- package/dist/interfaces/v2/cable/ICableV2Service.d.ts +21 -2
- package/dist/interfaces/v2/data/IDataV2Service.d.ts +21 -2
- package/dist/interfaces/v2/electricity/IElectricityV2Service.d.ts +22 -2
- package/dist/interfaces/v2/transfers/ITransfersService.d.ts +57 -6
- package/dist/lib/outcome.d.ts +24 -5
- package/dist/lib/outcome.js +24 -5
- package/dist/lib/sdk-version.generated.d.ts +1 -1
- package/dist/lib/sdk-version.generated.js +1 -1
- package/dist/nomba.d.ts +38 -5
- package/dist/nomba.js +38 -5
- package/dist/services/http/http-client.service.d.ts +40 -6
- package/dist/services/http/http-client.service.js +40 -6
- package/dist/services/v1/accounts/accounts.service.d.ts +46 -8
- package/dist/services/v1/accounts/accounts.service.js +46 -8
- package/dist/services/v1/betting/betting.service.d.ts +11 -2
- package/dist/services/v1/betting/betting.service.js +11 -2
- package/dist/services/v1/cable/cable.service.d.ts +12 -2
- package/dist/services/v1/cable/cable.service.js +12 -2
- package/dist/services/v1/charge/charge.service.d.ts +80 -19
- package/dist/services/v1/charge/charge.service.js +88 -26
- package/dist/services/v1/checkout/checkout.service.d.ts +63 -15
- package/dist/services/v1/checkout/checkout.service.js +70 -24
- package/dist/services/v1/data/data.service.d.ts +7 -1
- package/dist/services/v1/data/data.service.js +7 -1
- package/dist/services/v1/direct-debits/direct-debits.service.d.ts +38 -14
- package/dist/services/v1/direct-debits/direct-debits.service.js +39 -17
- package/dist/services/v1/electricity/electricity.service.d.ts +12 -2
- package/dist/services/v1/electricity/electricity.service.js +12 -2
- package/dist/services/v1/globals/collections.service.d.ts +21 -5
- package/dist/services/v1/globals/collections.service.js +22 -5
- package/dist/services/v1/globals/payout.service.d.ts +73 -13
- package/dist/services/v1/globals/payout.service.js +74 -15
- package/dist/services/v1/terminals/terminals.service.d.ts +5 -5
- package/dist/services/v1/terminals/terminals.service.js +7 -18
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.d.ts +4 -5
- package/dist/services/v1/virtual-accounts/virtual-accounts.service.js +7 -8
- package/dist/services/v1/webhooks/webhooks.service.d.ts +3 -4
- package/dist/services/v1/webhooks/webhooks.service.js +7 -8
- package/dist/services/v2/airtime/airtime.service.d.ts +26 -2
- package/dist/services/v2/airtime/airtime.service.js +27 -7
- package/dist/services/v2/betting/betting.service.d.ts +27 -3
- package/dist/services/v2/betting/betting.service.js +28 -8
- package/dist/services/v2/cable/cable.service.d.ts +27 -3
- package/dist/services/v2/cable/cable.service.js +28 -8
- package/dist/services/v2/data/data.service.d.ts +26 -2
- package/dist/services/v2/data/data.service.js +27 -7
- package/dist/services/v2/electricity/electricity.service.d.ts +28 -3
- package/dist/services/v2/electricity/electricity.service.js +29 -8
- package/dist/services/v2/transfers/transfers.service.d.ts +51 -6
- package/dist/services/v2/transfers/transfers.service.js +55 -25
- package/dist/types/common/common.types.d.ts +9 -13
- package/package.json +1 -1
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
16
16
|
import type { IWebhooksService } from "../../../interfaces/v1/webhooks/IWebhooksService.js";
|
|
17
|
-
import type { RequestOptions } from "../../../types/common/common.types.js";
|
|
18
17
|
import type { EventLog, EventLogsParams, EventsParams, ReplayParams, WebhookList, WebhookSubscription } from "../../../types/v1/webhooks/webhooks.types.js";
|
|
19
18
|
export declare class WebhooksService implements IWebhooksService {
|
|
20
19
|
#private;
|
|
@@ -28,9 +27,9 @@ export declare class WebhooksService implements IWebhooksService {
|
|
|
28
27
|
* POST /v1/webhooks/re-push. Resends one event. Takes an event log's `hookRequestId`; the request field
|
|
29
28
|
* is spelled `hooksRequestId`, as the guide shows.
|
|
30
29
|
*/
|
|
31
|
-
repush(hookRequestId: string
|
|
30
|
+
repush(hookRequestId: string): Promise<void>;
|
|
32
31
|
/** POST /v1/webhooks/bulk-re-push */
|
|
33
|
-
bulkRepush(hookRequestIds: string[]
|
|
32
|
+
bulkRepush(hookRequestIds: string[]): Promise<void>;
|
|
34
33
|
/** POST /v1/webhooks/replay. Resends every matching event in the time window. */
|
|
35
|
-
replay(params: ReplayParams
|
|
34
|
+
replay(params: ReplayParams): Promise<void>;
|
|
36
35
|
}
|
|
@@ -38,23 +38,22 @@ export class WebhooksService {
|
|
|
38
38
|
* POST /v1/webhooks/re-push. Resends one event. Takes an event log's `hookRequestId`; the request field
|
|
39
39
|
* is spelled `hooksRequestId`, as the guide shows.
|
|
40
40
|
*/
|
|
41
|
-
repush(hookRequestId
|
|
42
|
-
return this.#post("re-push", { hooksRequestId: hookRequestId }
|
|
41
|
+
repush(hookRequestId) {
|
|
42
|
+
return this.#post("re-push", { hooksRequestId: hookRequestId });
|
|
43
43
|
}
|
|
44
44
|
/** POST /v1/webhooks/bulk-re-push */
|
|
45
|
-
bulkRepush(hookRequestIds
|
|
46
|
-
return this.#post("bulk-re-push", { hooksRequestIds: hookRequestIds }
|
|
45
|
+
bulkRepush(hookRequestIds) {
|
|
46
|
+
return this.#post("bulk-re-push", { hooksRequestIds: hookRequestIds });
|
|
47
47
|
}
|
|
48
48
|
/** POST /v1/webhooks/replay. Resends every matching event in the time window. */
|
|
49
|
-
replay(params
|
|
50
|
-
return this.#post("replay", params
|
|
49
|
+
replay(params) {
|
|
50
|
+
return this.#post("replay", params);
|
|
51
51
|
}
|
|
52
52
|
// These answer with no `data`, so the client resolves to undefined.
|
|
53
|
-
#post(path, body
|
|
53
|
+
#post(path, body) {
|
|
54
54
|
return this.http.request("POST", `/v1/webhooks/${path}`, {
|
|
55
55
|
body,
|
|
56
56
|
okCodes: OK_CODES,
|
|
57
|
-
...options,
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -7,12 +7,36 @@ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
|
7
7
|
import type { IAirtimeV2Service } from "../../../interfaces/v2/airtime/index.js";
|
|
8
8
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
9
9
|
import type { AirtimePurchaseParams, AirtimePurchaseV2Result } from "../../../types/v2/airtime/airtime.types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Airtime top-ups (v2). A call that throws a NombaError with a 4xx status was rejected and did nothing.
|
|
12
|
+
* Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
|
|
13
|
+
* `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
|
|
14
|
+
*/
|
|
10
15
|
export declare class AirtimeV2Service implements IAirtimeV2Service {
|
|
11
16
|
#private;
|
|
12
17
|
private readonly http;
|
|
13
18
|
constructor(http: IHttpClient);
|
|
14
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* `POST /v2/bill/topup`. Buys airtime from the parent account.
|
|
21
|
+
* @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
|
|
22
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
23
|
+
* a rejection or pending outcome throws.
|
|
24
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
25
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
26
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
27
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
28
|
+
*/
|
|
15
29
|
buyAirtime<R = AirtimePurchaseV2Result>(params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
|
|
16
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* `POST /v2/bill/topup/{subAccountId}`. Buys airtime from a sub account.
|
|
32
|
+
* @param subAccountId The sub account to buy from.
|
|
33
|
+
* @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
|
|
34
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
35
|
+
* a rejection or pending outcome throws.
|
|
36
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
37
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
38
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
39
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
40
|
+
*/
|
|
17
41
|
buyAirtimeFromSubAccount<R = AirtimePurchaseV2Result>(subAccountId: string, params: AirtimePurchaseParams, options?: CallOptions<AirtimePurchaseV2Result, R>): Promise<AirtimePurchaseV2Result | R>;
|
|
18
42
|
}
|
|
@@ -12,24 +12,44 @@ const OUTCOMES = {
|
|
|
12
12
|
codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Airtime top-ups (v2). A call that throws a NombaError with a 4xx status was rejected and did nothing.
|
|
17
|
+
* Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
|
|
18
|
+
* `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
|
|
19
|
+
*/
|
|
15
20
|
export class AirtimeV2Service {
|
|
16
21
|
http;
|
|
17
22
|
constructor(http) {
|
|
18
23
|
this.http = http;
|
|
19
24
|
}
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* `POST /v2/bill/topup`. Buys airtime from the parent account.
|
|
27
|
+
* @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
|
|
28
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
29
|
+
* a rejection or pending outcome throws.
|
|
30
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
31
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
32
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
33
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
34
|
+
*/
|
|
21
35
|
async buyAirtime(params, options = {}) {
|
|
22
36
|
return this.#buy("/v2/bill/topup", params, options);
|
|
23
37
|
}
|
|
24
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* `POST /v2/bill/topup/{subAccountId}`. Buys airtime from a sub account.
|
|
40
|
+
* @param subAccountId The sub account to buy from.
|
|
41
|
+
* @param params The phone number, network and amount, and the `merchantTxRef` used for idempotency.
|
|
42
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
43
|
+
* a rejection or pending outcome throws.
|
|
44
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
45
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
46
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
47
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
48
|
+
*/
|
|
25
49
|
async buyAirtimeFromSubAccount(subAccountId, params, options = {}) {
|
|
26
50
|
return this.#buy(`/v2/bill/topup/${pathId(subAccountId)}`, params, options);
|
|
27
51
|
}
|
|
28
|
-
// merchantTxRef is the default idempotency key, as for every bill payment.
|
|
29
52
|
#buy(path, params, options) {
|
|
30
|
-
return settle(this.http, "POST", path, { body: params }, OUTCOMES,
|
|
31
|
-
...options,
|
|
32
|
-
idempotencyKey: options.idempotencyKey ?? params.merchantTxRef,
|
|
33
|
-
});
|
|
53
|
+
return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
|
|
34
54
|
}
|
|
35
55
|
}
|
|
@@ -7,13 +7,37 @@ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
|
7
7
|
import type { IBettingV2Service } from "../../../interfaces/v2/betting/index.js";
|
|
8
8
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
9
9
|
import type { BettingPaymentParams, BettingPaymentV2Result } from "../../../types/v2/betting/betting.types.js";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Betting wallet funding (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
|
|
12
|
+
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
13
|
+
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
14
|
+
* reference.
|
|
15
|
+
*/
|
|
11
16
|
export declare class BettingV2Service implements IBettingV2Service {
|
|
12
17
|
#private;
|
|
13
18
|
private readonly http;
|
|
14
19
|
constructor(http: IHttpClient);
|
|
15
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* `POST /v2/bill/betting`. Funds a betting wallet from the parent account.
|
|
22
|
+
* @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
|
|
23
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
24
|
+
* a rejection or pending outcome throws.
|
|
25
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
26
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
27
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
28
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
29
|
+
*/
|
|
16
30
|
payBetting<R = BettingPaymentV2Result>(params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
|
|
17
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* `POST /v2/bill/betting/{subAccountId}`. Pays from a sub account.
|
|
33
|
+
* @param subAccountId The sub account to pay from.
|
|
34
|
+
* @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
|
|
35
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
36
|
+
* a rejection or pending outcome throws.
|
|
37
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
38
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
39
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
40
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
41
|
+
*/
|
|
18
42
|
payBettingFromSubAccount<R = BettingPaymentV2Result>(subAccountId: string, params: BettingPaymentParams, options?: CallOptions<BettingPaymentV2Result, R>): Promise<BettingPaymentV2Result | R>;
|
|
19
43
|
}
|
|
@@ -12,25 +12,45 @@ const OUTCOMES = {
|
|
|
12
12
|
codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Betting wallet funding (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
|
|
17
|
+
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
18
|
+
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
19
|
+
* reference.
|
|
20
|
+
*/
|
|
16
21
|
export class BettingV2Service {
|
|
17
22
|
http;
|
|
18
23
|
constructor(http) {
|
|
19
24
|
this.http = http;
|
|
20
25
|
}
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* `POST /v2/bill/betting`. Funds a betting wallet from the parent account.
|
|
28
|
+
* @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
|
|
29
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
30
|
+
* a rejection or pending outcome throws.
|
|
31
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
32
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
33
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
34
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
35
|
+
*/
|
|
22
36
|
async payBetting(params, options = {}) {
|
|
23
37
|
return this.#pay("/v2/bill/betting", params, options);
|
|
24
38
|
}
|
|
25
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* `POST /v2/bill/betting/{subAccountId}`. Pays from a sub account.
|
|
41
|
+
* @param subAccountId The sub account to pay from.
|
|
42
|
+
* @param params The betting provider, customer id and amount, and the `merchantTxRef` used for idempotency.
|
|
43
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
44
|
+
* a rejection or pending outcome throws.
|
|
45
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
46
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
47
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
48
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
49
|
+
*/
|
|
26
50
|
async payBettingFromSubAccount(subAccountId, params, options = {}) {
|
|
27
51
|
return this.#pay(`/v2/bill/betting/${pathId(subAccountId)}`, params, options);
|
|
28
52
|
}
|
|
29
|
-
// merchantTxRef is the default idempotency key, as for every bill payment.
|
|
30
53
|
#pay(path, params, options) {
|
|
31
|
-
return settle(this.http, "POST", path, { body: params }, OUTCOMES,
|
|
32
|
-
...options,
|
|
33
|
-
idempotencyKey: options.idempotencyKey ?? params.merchantTxRef,
|
|
34
|
-
});
|
|
54
|
+
return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
|
|
35
55
|
}
|
|
36
56
|
}
|
|
@@ -7,13 +7,37 @@ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
|
7
7
|
import type { ICableV2Service } from "../../../interfaces/v2/cable/index.js";
|
|
8
8
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
9
9
|
import type { CablePaymentV2Result, CableTvSubscriptionParams } from "../../../types/v2/cable/cable.types.js";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Cable TV subscription payments (v2 has purchase endpoints only). A call that throws a NombaError with a
|
|
12
|
+
* 4xx status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the
|
|
13
|
+
* outcome unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a
|
|
14
|
+
* new reference.
|
|
15
|
+
*/
|
|
11
16
|
export declare class CableV2Service implements ICableV2Service {
|
|
12
17
|
#private;
|
|
13
18
|
private readonly http;
|
|
14
19
|
constructor(http: IHttpClient);
|
|
15
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* `POST /v2/bill/cabletv`. Pays a cable TV subscription from the parent account.
|
|
22
|
+
* @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
|
|
23
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
24
|
+
* a rejection or pending outcome throws.
|
|
25
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
26
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
27
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
28
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
29
|
+
*/
|
|
16
30
|
subscribeCableTv<R = CablePaymentV2Result>(params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
|
|
17
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* `POST /v2/bill/cabletv/{subAccountId}`. Pays from a sub account.
|
|
33
|
+
* @param subAccountId The sub account to pay from.
|
|
34
|
+
* @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
|
|
35
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
36
|
+
* a rejection or pending outcome throws.
|
|
37
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
38
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
39
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
40
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
41
|
+
*/
|
|
18
42
|
subscribeCableTvFromSubAccount<R = CablePaymentV2Result>(subAccountId: string, params: CableTvSubscriptionParams, options?: CallOptions<CablePaymentV2Result, R>): Promise<CablePaymentV2Result | R>;
|
|
19
43
|
}
|
|
@@ -12,25 +12,45 @@ const OUTCOMES = {
|
|
|
12
12
|
codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Cable TV subscription payments (v2 has purchase endpoints only). A call that throws a NombaError with a
|
|
17
|
+
* 4xx status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the
|
|
18
|
+
* outcome unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a
|
|
19
|
+
* new reference.
|
|
20
|
+
*/
|
|
16
21
|
export class CableV2Service {
|
|
17
22
|
http;
|
|
18
23
|
constructor(http) {
|
|
19
24
|
this.http = http;
|
|
20
25
|
}
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* `POST /v2/bill/cabletv`. Pays a cable TV subscription from the parent account.
|
|
28
|
+
* @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
|
|
29
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
30
|
+
* a rejection or pending outcome throws.
|
|
31
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
32
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
33
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
34
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
35
|
+
*/
|
|
22
36
|
async subscribeCableTv(params, options = {}) {
|
|
23
37
|
return this.#pay("/v2/bill/cabletv", params, options);
|
|
24
38
|
}
|
|
25
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* `POST /v2/bill/cabletv/{subAccountId}`. Pays from a sub account.
|
|
41
|
+
* @param subAccountId The sub account to pay from.
|
|
42
|
+
* @param params The provider, smartcard/customer id and plan, and the `merchantTxRef` used for idempotency.
|
|
43
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
44
|
+
* a rejection or pending outcome throws.
|
|
45
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
46
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
47
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
48
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
49
|
+
*/
|
|
26
50
|
async subscribeCableTvFromSubAccount(subAccountId, params, options = {}) {
|
|
27
51
|
return this.#pay(`/v2/bill/cabletv/${pathId(subAccountId)}`, params, options);
|
|
28
52
|
}
|
|
29
|
-
// merchantTxRef is the default idempotency key, as for every bill payment.
|
|
30
53
|
#pay(path, params, options) {
|
|
31
|
-
return settle(this.http, "POST", path, { body: params }, OUTCOMES,
|
|
32
|
-
...options,
|
|
33
|
-
idempotencyKey: options.idempotencyKey ?? params.merchantTxRef,
|
|
34
|
-
});
|
|
54
|
+
return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
|
|
35
55
|
}
|
|
36
56
|
}
|
|
@@ -7,12 +7,36 @@ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
|
7
7
|
import type { IDataV2Service } from "../../../interfaces/v2/data/index.js";
|
|
8
8
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
9
9
|
import type { DataPurchaseParams, DataPurchaseV2Result } from "../../../types/v2/data/data.types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Data bundle purchases (v2). A call that throws a NombaError with a 4xx status was rejected and did
|
|
12
|
+
* nothing. Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
|
|
13
|
+
* `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
|
|
14
|
+
*/
|
|
10
15
|
export declare class DataV2Service implements IDataV2Service {
|
|
11
16
|
#private;
|
|
12
17
|
private readonly http;
|
|
13
18
|
constructor(http: IHttpClient);
|
|
14
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* `POST /v2/bill/data`. Buys a data bundle from the parent account.
|
|
21
|
+
* @param params The phone number, network and data plan, and the `merchantTxRef` used for idempotency.
|
|
22
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
23
|
+
* a rejection or pending outcome throws.
|
|
24
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
25
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
26
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
27
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
28
|
+
*/
|
|
15
29
|
buyData<R = DataPurchaseV2Result>(params: DataPurchaseParams, options?: CallOptions<DataPurchaseV2Result, R>): Promise<DataPurchaseV2Result | R>;
|
|
16
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* `POST /v2/bill/data/{subAccountId}`. Buys a data bundle from a sub account.
|
|
32
|
+
* @param subAccountId The sub account to buy from.
|
|
33
|
+
* @param params The phone number, network and data plan, and the `merchantTxRef` used for idempotency.
|
|
34
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
35
|
+
* a rejection or pending outcome throws.
|
|
36
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
37
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
38
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
39
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
40
|
+
*/
|
|
17
41
|
buyDataFromSubAccount<R = DataPurchaseV2Result>(subAccountId: string, params: DataPurchaseParams, options?: CallOptions<DataPurchaseV2Result, R>): Promise<DataPurchaseV2Result | R>;
|
|
18
42
|
}
|
|
@@ -12,24 +12,44 @@ const OUTCOMES = {
|
|
|
12
12
|
codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Data bundle purchases (v2). A call that throws a NombaError with a 4xx status was rejected and did
|
|
17
|
+
* nothing. Any other failure (5xx, network error, timeout) leaves the outcome unknown: keep the same
|
|
18
|
+
* `merchantTxRef`, wait for the webhook or requery, and never retry under a new reference.
|
|
19
|
+
*/
|
|
15
20
|
export class DataV2Service {
|
|
16
21
|
http;
|
|
17
22
|
constructor(http) {
|
|
18
23
|
this.http = http;
|
|
19
24
|
}
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* `POST /v2/bill/data`. Buys a data bundle from the parent account.
|
|
27
|
+
* @param params The phone number, network and data plan, and the `merchantTxRef` used for idempotency.
|
|
28
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
29
|
+
* a rejection or pending outcome throws.
|
|
30
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
31
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
32
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
33
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
34
|
+
*/
|
|
21
35
|
async buyData(params, options = {}) {
|
|
22
36
|
return this.#buy("/v2/bill/data", params, options);
|
|
23
37
|
}
|
|
24
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* `POST /v2/bill/data/{subAccountId}`. Buys a data bundle from a sub account.
|
|
40
|
+
* @param subAccountId The sub account to buy from.
|
|
41
|
+
* @param params The phone number, network and data plan, and the `merchantTxRef` used for idempotency.
|
|
42
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
43
|
+
* a rejection or pending outcome throws.
|
|
44
|
+
* @returns The purchase result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
45
|
+
* @throws {NombaError} The purchase was rejected (4xx).
|
|
46
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
47
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
48
|
+
*/
|
|
25
49
|
async buyDataFromSubAccount(subAccountId, params, options = {}) {
|
|
26
50
|
return this.#buy(`/v2/bill/data/${pathId(subAccountId)}`, params, options);
|
|
27
51
|
}
|
|
28
|
-
// merchantTxRef is the default idempotency key, as for every bill payment.
|
|
29
52
|
#buy(path, params, options) {
|
|
30
|
-
return settle(this.http, "POST", path, { body: params }, OUTCOMES,
|
|
31
|
-
...options,
|
|
32
|
-
idempotencyKey: options.idempotencyKey ?? params.merchantTxRef,
|
|
33
|
-
});
|
|
53
|
+
return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
|
|
34
54
|
}
|
|
35
55
|
}
|
|
@@ -7,13 +7,38 @@ import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
|
7
7
|
import type { IElectricityV2Service } from "../../../interfaces/v2/electricity/index.js";
|
|
8
8
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
9
9
|
import type { ElectricityPaymentParams, ElectricityPaymentV2Result } from "../../../types/v2/electricity/electricity.types.js";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Electricity bill payments (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
|
|
12
|
+
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
13
|
+
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
14
|
+
* reference.
|
|
15
|
+
*/
|
|
11
16
|
export declare class ElectricityV2Service implements IElectricityV2Service {
|
|
12
17
|
#private;
|
|
13
18
|
private readonly http;
|
|
14
19
|
constructor(http: IHttpClient);
|
|
15
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* `POST /v2/bill/electricity`. Pays an electricity bill from the parent account. Prepaid meters get the
|
|
22
|
+
* token in `meta.phcnToken`.
|
|
23
|
+
* @param params The disco, meter number and amount, and the `merchantTxRef` used for idempotency.
|
|
24
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
25
|
+
* a rejection or pending outcome throws.
|
|
26
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
27
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
28
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
29
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
30
|
+
*/
|
|
16
31
|
payElectricity<R = ElectricityPaymentV2Result>(params: ElectricityPaymentParams, options?: CallOptions<ElectricityPaymentV2Result, R>): Promise<ElectricityPaymentV2Result | R>;
|
|
17
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* `POST /v2/bill/electricity/{subAccountId}`. Pays from a sub account.
|
|
34
|
+
* @param subAccountId The sub account to pay from.
|
|
35
|
+
* @param params The disco, meter number and amount, and the `merchantTxRef` used for idempotency.
|
|
36
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
37
|
+
* a rejection or pending outcome throws.
|
|
38
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
39
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
40
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
41
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
42
|
+
*/
|
|
18
43
|
payElectricityFromSubAccount<R = ElectricityPaymentV2Result>(subAccountId: string, params: ElectricityPaymentParams, options?: CallOptions<ElectricityPaymentV2Result, R>): Promise<ElectricityPaymentV2Result | R>;
|
|
19
44
|
}
|
|
@@ -12,25 +12,46 @@ const OUTCOMES = {
|
|
|
12
12
|
codes: { "00": "success", "200": "success", "201": "pending", ...REJECTED },
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Electricity bill payments (v2 has purchase endpoints only). A call that throws a NombaError with a 4xx
|
|
17
|
+
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
18
|
+
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
19
|
+
* reference.
|
|
20
|
+
*/
|
|
16
21
|
export class ElectricityV2Service {
|
|
17
22
|
http;
|
|
18
23
|
constructor(http) {
|
|
19
24
|
this.http = http;
|
|
20
25
|
}
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* `POST /v2/bill/electricity`. Pays an electricity bill from the parent account. Prepaid meters get the
|
|
28
|
+
* token in `meta.phcnToken`.
|
|
29
|
+
* @param params The disco, meter number and amount, and the `merchantTxRef` used for idempotency.
|
|
30
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
31
|
+
* a rejection or pending outcome throws.
|
|
32
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
33
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
34
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
35
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
36
|
+
*/
|
|
22
37
|
async payElectricity(params, options = {}) {
|
|
23
38
|
return this.#pay("/v2/bill/electricity", params, options);
|
|
24
39
|
}
|
|
25
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* `POST /v2/bill/electricity/{subAccountId}`. Pays from a sub account.
|
|
42
|
+
* @param subAccountId The sub account to pay from.
|
|
43
|
+
* @param params The disco, meter number and amount, and the `merchantTxRef` used for idempotency.
|
|
44
|
+
* @param options Outcome closures and per-call overrides; without them, success resolves the result and
|
|
45
|
+
* a rejection or pending outcome throws.
|
|
46
|
+
* @returns The payment result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
47
|
+
* @throws {NombaError} The payment was rejected (4xx).
|
|
48
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
49
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
50
|
+
*/
|
|
26
51
|
async payElectricityFromSubAccount(subAccountId, params, options = {}) {
|
|
27
52
|
return this.#pay(`/v2/bill/electricity/${pathId(subAccountId)}`, params, options);
|
|
28
53
|
}
|
|
29
|
-
// merchantTxRef is the default idempotency key, as for every bill payment.
|
|
30
54
|
#pay(path, params, options) {
|
|
31
|
-
return settle(this.http, "POST", path, { body: params }, OUTCOMES,
|
|
32
|
-
...options,
|
|
33
|
-
idempotencyKey: options.idempotencyKey ?? params.merchantTxRef,
|
|
34
|
-
});
|
|
55
|
+
return settle(this.http, "POST", path, { body: params }, OUTCOMES, params.merchantTxRef, options);
|
|
35
56
|
}
|
|
36
57
|
}
|
|
@@ -15,16 +15,61 @@ import type { Bank, BankAccountLookupParams, BankAccountLookupResult, BankTransf
|
|
|
15
15
|
export declare class TransfersService implements ITransfersService {
|
|
16
16
|
private readonly http;
|
|
17
17
|
constructor(http: IHttpClient);
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* `GET /v1/transfers/banks`. Lists the banks usable as a transfer destination.
|
|
20
|
+
* @returns The supported banks, each with its name and code.
|
|
21
|
+
* @throws {NombaError} A non-2xx response.
|
|
22
|
+
*/
|
|
19
23
|
listBanks(): Promise<Bank[]>;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* `POST /v1/transfers/bank/lookup`. Resolves a bank account number to its account name.
|
|
26
|
+
* @param params The bank code and account number to look up.
|
|
27
|
+
* @returns The resolved account name.
|
|
28
|
+
* @throws {NombaError} The lookup was rejected, e.g. an invalid account number.
|
|
29
|
+
*/
|
|
21
30
|
lookupBankAccount(params: BankAccountLookupParams): Promise<BankAccountLookupResult>;
|
|
22
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* `POST /v2/transfers/bank`. Sends a bank transfer from the parent account.
|
|
33
|
+
* @param params The destination bank, account number and amount; `merchantTxRef` is the idempotency key.
|
|
34
|
+
* @param options Outcome closures; without them, success resolves the result and pending/failure throws.
|
|
35
|
+
* @returns The transfer result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
36
|
+
* @throws {NombaError} The transfer was rejected (4xx) and never happened.
|
|
37
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
38
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
39
|
+
*/
|
|
23
40
|
bankTransfer<R = BankTransferResult>(params: BankTransferParams, options?: CallOptions<BankTransferResult, R>): Promise<BankTransferResult | R>;
|
|
24
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* `POST /v2/transfers/bank/{subAccountId}`. Sends a bank transfer from a sub account. You must ask
|
|
43
|
+
* Nomba to profile you for sub account transfers.
|
|
44
|
+
* @param subAccountId The sub account to transfer from.
|
|
45
|
+
* @param params The destination bank, account number and amount; `merchantTxRef` is the idempotency key.
|
|
46
|
+
* @param options Outcome closures; without them, success resolves the result and pending/failure throws.
|
|
47
|
+
* @returns The transfer result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
48
|
+
* @throws {NombaError} The transfer was rejected (4xx) and never happened.
|
|
49
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
50
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
51
|
+
*/
|
|
25
52
|
bankTransferFromSubAccount<R = BankTransferResult>(subAccountId: string, params: BankTransferParams, options?: CallOptions<BankTransferResult, R>): Promise<BankTransferResult | R>;
|
|
26
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* `POST /v2/transfers/wallet`. Sends a wallet-to-wallet transfer from the parent account to another
|
|
55
|
+
* Nomba account.
|
|
56
|
+
* @param params The destination wallet and amount; `merchantTxRef` is the idempotency key.
|
|
57
|
+
* @param options Outcome closures; without them, success resolves the result and pending/failure throws.
|
|
58
|
+
* @returns The transfer result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
59
|
+
* @throws {NombaError} The transfer was rejected (4xx) and never happened.
|
|
60
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
61
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
62
|
+
*/
|
|
27
63
|
walletTransfer<R = WalletTransferResult>(params: WalletTransferParams, options?: CallOptions<WalletTransferResult, R>): Promise<WalletTransferResult | R>;
|
|
28
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* `POST /v2/transfers/wallet/{subAccountId}`. Sends a wallet-to-wallet transfer from a sub account.
|
|
66
|
+
* @param subAccountId The sub account to transfer from.
|
|
67
|
+
* @param params The destination wallet and amount; `merchantTxRef` is the idempotency key.
|
|
68
|
+
* @param options Outcome closures; without them, success resolves the result and pending/failure throws.
|
|
69
|
+
* @returns The transfer result, or whatever `options.onSuccess`/`onPending`/`onFailed` returns.
|
|
70
|
+
* @throws {NombaError} The transfer was rejected (4xx) and never happened.
|
|
71
|
+
* @throws {OutcomeUnknownError} The outcome could not be confirmed as success or failure.
|
|
72
|
+
* @throws {UnconfirmedOutcomeError} The result is pending and no `onPending` handler was given.
|
|
73
|
+
*/
|
|
29
74
|
walletTransferFromSubAccount<R = WalletTransferResult>(subAccountId: string, params: WalletTransferParams, options?: CallOptions<WalletTransferResult, R>): Promise<WalletTransferResult | R>;
|
|
30
75
|
}
|