@nomba/node-sdk 0.4.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 +4 -4
- package/dist/interfaces/v1/checkout/ICheckoutService.d.ts +4 -3
- package/dist/interfaces/v1/electricity/IElectricityService.d.ts +1 -8
- package/dist/interfaces/v2/electricity/IElectricityV2Service.d.ts +9 -2
- package/dist/interfaces/v2/electricity/IElectricityV2Service.js +1 -1
- package/dist/lib/sdk-version.generated.d.ts +1 -1
- package/dist/lib/sdk-version.generated.js +1 -1
- package/dist/services/http/http-client.service.js +1 -0
- package/dist/services/v1/checkout/checkout.service.d.ts +4 -3
- package/dist/services/v1/checkout/checkout.service.js +2 -1
- package/dist/services/v1/electricity/electricity.service.d.ts +3 -10
- package/dist/services/v1/electricity/electricity.service.js +2 -13
- package/dist/services/v2/electricity/electricity.service.d.ts +10 -3
- package/dist/services/v2/electricity/electricity.service.js +13 -2
- package/dist/types/v1/checkout/checkout.types.d.ts +8 -0
- package/dist/types/v1/electricity/electricity.types.d.ts +0 -9
- package/dist/types/v1/virtual-accounts/virtual-accounts.types.d.ts +6 -0
- package/dist/types/v2/electricity/electricity.types.d.ts +9 -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` | |
|
|
@@ -231,8 +231,7 @@ Provider lists, meter/customer lookups and data plans — no money moves here. P
|
|
|
231
231
|
|
|
232
232
|
| Method | Endpoint | Notes |
|
|
233
233
|
|---|---|---|
|
|
234
|
-
| `getElectricityProviders()` | `GET /v1/bill/electricity/discos` | |
|
|
235
|
-
| `lookupMeter(params)` | `GET /v1/bill/electricity/lookup` | |
|
|
234
|
+
| `getElectricityProviders()` | `GET /v1/bill/electricity/discos` | Meter lookup moved to `nomba.electricity.lookupMeter` (v2) |
|
|
236
235
|
|
|
237
236
|
#### Cable TV: `nomba.billCable` (`CableService`)
|
|
238
237
|
|
|
@@ -256,12 +255,13 @@ Provider lists, meter/customer lookups and data plans — no money moves here. P
|
|
|
256
255
|
|
|
257
256
|
### Electricity, cable TV and betting
|
|
258
257
|
|
|
259
|
-
Each is its own product using **version 2** endpoints (
|
|
258
|
+
Each is its own product using **version 2** endpoints. Electricity also has a meter lookup; cable and betting lookups stay on version 1 (above).
|
|
260
259
|
|
|
261
260
|
#### Electricity: `nomba.electricity` (`ElectricityV2Service`)
|
|
262
261
|
|
|
263
262
|
| Method | Endpoint | Notes |
|
|
264
263
|
|---|---|---|
|
|
264
|
+
| `lookupMeter(params)` | `GET /v2/bill/electricity/lookup` | `address` is `"unknown"` if the provider supplies none |
|
|
265
265
|
| `payElectricity(params)` | `POST /v2/bill/electricity` | Prepaid meters get the token in `meta.phcnToken` |
|
|
266
266
|
| `payElectricityFromSubAccount(subAccountId, params)` | `POST /v2/bill/electricity/{subAccountId}` | |
|
|
267
267
|
|
|
@@ -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.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module nomba/interfaces/v1/electricity
|
|
3
3
|
* @description Electricity v1 service contract for validation endpoints
|
|
4
4
|
*/
|
|
5
|
-
import type { ElectricityProvidersResult
|
|
5
|
+
import type { ElectricityProvidersResult } from "../../../types/v1/electricity/electricity.types.js";
|
|
6
6
|
export interface IElectricityService {
|
|
7
7
|
/**
|
|
8
8
|
* `GET /v1/bill/electricity/discos`.
|
|
@@ -10,11 +10,4 @@ export interface IElectricityService {
|
|
|
10
10
|
* @throws {NombaError} The request failed.
|
|
11
11
|
*/
|
|
12
12
|
getElectricityProviders(): Promise<ElectricityProvidersResult>;
|
|
13
|
-
/**
|
|
14
|
-
* `GET /v1/bill/electricity/lookup`.
|
|
15
|
-
* @param params The disco and meter number to look up.
|
|
16
|
-
* @returns The meter's customer details.
|
|
17
|
-
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
18
|
-
*/
|
|
19
|
-
lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
|
|
20
13
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module nomba/interfaces/v2/electricity
|
|
3
|
-
* @description Electricity v2 service contract.
|
|
3
|
+
* @description Electricity v2 service contract.
|
|
4
4
|
*/
|
|
5
5
|
import type { CallOptions } from "../../../types/common/common.types.js";
|
|
6
|
-
import type { ElectricityPaymentParams, ElectricityPaymentV2Result } from "../../../types/v2/electricity/electricity.types.js";
|
|
6
|
+
import type { ElectricityPaymentParams, ElectricityPaymentV2Result, MeterLookupV2Params, MeterLookupV2Result } from "../../../types/v2/electricity/electricity.types.js";
|
|
7
7
|
export interface IElectricityV2Service {
|
|
8
|
+
/**
|
|
9
|
+
* `GET /v2/bill/electricity/lookup`.
|
|
10
|
+
* @param params The disco and meter/customer id to look up.
|
|
11
|
+
* @returns The customer's name and address.
|
|
12
|
+
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
13
|
+
*/
|
|
14
|
+
lookupMeter(params: MeterLookupV2Params): Promise<MeterLookupV2Result>;
|
|
8
15
|
/**
|
|
9
16
|
* `POST /v2/bill/electricity`. Pays an electricity bill from the parent account. Prepaid meters get the
|
|
10
17
|
* token in `meta.phcnToken`.
|
|
@@ -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";
|
|
@@ -288,6 +288,7 @@ export class HttpClient {
|
|
|
288
288
|
headers: {
|
|
289
289
|
accountId: this.#options.accountId,
|
|
290
290
|
"X-Nomba-Sdk-Version": SDK_VERSION,
|
|
291
|
+
"User-Agent": `nomba_node_sdk:v${SDK_VERSION}`,
|
|
291
292
|
...(payload === undefined
|
|
292
293
|
? {}
|
|
293
294
|
: { "Content-Type": "application/json" }),
|
|
@@ -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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module nomba/services/v1/electricity
|
|
3
|
-
* @description Electricity (v1): GET /v1/bill/electricity/discos
|
|
3
|
+
* @description Electricity (v1): GET /v1/bill/electricity/discos
|
|
4
4
|
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
5
|
*/
|
|
6
6
|
import type { IHttpClient } from "../../../interfaces/http/IHttpClient.js";
|
|
7
7
|
import type { IElectricityService } from "../../../interfaces/v1/electricity/index.js";
|
|
8
|
-
import type { ElectricityProvidersResult
|
|
9
|
-
/** Electricity bill
|
|
8
|
+
import type { ElectricityProvidersResult } from "../../../types/v1/electricity/electricity.types.js";
|
|
9
|
+
/** Electricity bill disco listing (v1). Meter lookup moved to v2, see ElectricityV2Service. */
|
|
10
10
|
export declare class ElectricityService implements IElectricityService {
|
|
11
11
|
private readonly http;
|
|
12
12
|
constructor(http: IHttpClient);
|
|
@@ -16,11 +16,4 @@ export declare class ElectricityService implements IElectricityService {
|
|
|
16
16
|
* @throws {NombaError} The request failed.
|
|
17
17
|
*/
|
|
18
18
|
getElectricityProviders(): Promise<ElectricityProvidersResult>;
|
|
19
|
-
/**
|
|
20
|
-
* `GET /v1/bill/electricity/lookup`.
|
|
21
|
-
* @param params The disco and meter number to look up.
|
|
22
|
-
* @returns The meter's customer details.
|
|
23
|
-
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
24
|
-
*/
|
|
25
|
-
lookupMeter(params: MeterLookupParams): Promise<MeterLookupResult>;
|
|
26
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module nomba/services/v1/electricity
|
|
3
|
-
* @description Electricity (v1): GET /v1/bill/electricity/discos
|
|
3
|
+
* @description Electricity (v1): GET /v1/bill/electricity/discos
|
|
4
4
|
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
5
|
*/
|
|
6
|
-
/** Electricity bill
|
|
6
|
+
/** Electricity bill disco listing (v1). Meter lookup moved to v2, see ElectricityV2Service. */
|
|
7
7
|
export class ElectricityService {
|
|
8
8
|
http;
|
|
9
9
|
constructor(http) {
|
|
@@ -17,15 +17,4 @@ export class ElectricityService {
|
|
|
17
17
|
getElectricityProviders() {
|
|
18
18
|
return this.http.request("GET", "/v1/bill/electricity/discos");
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* `GET /v1/bill/electricity/lookup`.
|
|
22
|
-
* @param params The disco and meter number to look up.
|
|
23
|
-
* @returns The meter's customer details.
|
|
24
|
-
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
25
|
-
*/
|
|
26
|
-
lookupMeter(params) {
|
|
27
|
-
return this.http.request("GET", "/v1/bill/electricity/lookup", {
|
|
28
|
-
query: params,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
20
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module nomba/services/v2/electricity
|
|
3
|
-
* @description ElectricityV2 (v2): POST /v2/bill/electricity[/{subAccountId}]
|
|
3
|
+
* @description ElectricityV2 (v2): GET /v2/bill/electricity/lookup, POST /v2/bill/electricity[/{subAccountId}]
|
|
4
4
|
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
5
|
*/
|
|
6
6
|
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
|
-
import type { ElectricityPaymentParams, ElectricityPaymentV2Result } from "../../../types/v2/electricity/electricity.types.js";
|
|
9
|
+
import type { ElectricityPaymentParams, ElectricityPaymentV2Result, MeterLookupV2Params, MeterLookupV2Result } from "../../../types/v2/electricity/electricity.types.js";
|
|
10
10
|
/**
|
|
11
|
-
* Electricity
|
|
11
|
+
* Electricity meter lookup and bill payments. A call that throws a NombaError with a 4xx
|
|
12
12
|
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
13
13
|
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
14
14
|
* reference.
|
|
@@ -17,6 +17,13 @@ export declare class ElectricityV2Service implements IElectricityV2Service {
|
|
|
17
17
|
#private;
|
|
18
18
|
private readonly http;
|
|
19
19
|
constructor(http: IHttpClient);
|
|
20
|
+
/**
|
|
21
|
+
* `GET /v2/bill/electricity/lookup`.
|
|
22
|
+
* @param params The disco and meter/customer id to look up.
|
|
23
|
+
* @returns The customer's name and address.
|
|
24
|
+
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
25
|
+
*/
|
|
26
|
+
lookupMeter(params: MeterLookupV2Params): Promise<MeterLookupV2Result>;
|
|
20
27
|
/**
|
|
21
28
|
* `POST /v2/bill/electricity`. Pays an electricity bill from the parent account. Prepaid meters get the
|
|
22
29
|
* token in `meta.phcnToken`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module nomba/services/v2/electricity
|
|
3
|
-
* @description ElectricityV2 (v2): POST /v2/bill/electricity[/{subAccountId}]
|
|
3
|
+
* @description ElectricityV2 (v2): GET /v2/bill/electricity/lookup, POST /v2/bill/electricity[/{subAccountId}]
|
|
4
4
|
* @see https://developer.nomba.com/docs/api-reference/bills
|
|
5
5
|
*/
|
|
6
6
|
import { REJECTED, settle } from "../../../lib/outcome.js";
|
|
@@ -13,7 +13,7 @@ const OUTCOMES = {
|
|
|
13
13
|
statuses: { SUCCESS: "success", PENDING_BILLING: "pending" },
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Electricity
|
|
16
|
+
* Electricity meter lookup and bill payments. A call that throws a NombaError with a 4xx
|
|
17
17
|
* status was rejected and did nothing. Any other failure (5xx, network error, timeout) leaves the outcome
|
|
18
18
|
* unknown: keep the same `merchantTxRef`, wait for the webhook or requery, and never retry under a new
|
|
19
19
|
* reference.
|
|
@@ -23,6 +23,17 @@ export class ElectricityV2Service {
|
|
|
23
23
|
constructor(http) {
|
|
24
24
|
this.http = http;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* `GET /v2/bill/electricity/lookup`.
|
|
28
|
+
* @param params The disco and meter/customer id to look up.
|
|
29
|
+
* @returns The customer's name and address.
|
|
30
|
+
* @throws {NombaError} The meter number is invalid or not found, or the request failed.
|
|
31
|
+
*/
|
|
32
|
+
lookupMeter(params) {
|
|
33
|
+
return this.http.request("GET", "/v2/bill/electricity/lookup", {
|
|
34
|
+
query: params,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
26
37
|
/**
|
|
27
38
|
* `POST /v2/bill/electricity`. Pays an electricity bill from the parent account. Prepaid meters get the
|
|
28
39
|
* token in `meta.phcnToken`.
|
|
@@ -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;
|
|
@@ -10,12 +10,3 @@ export type ElectricityProvidersResult = {
|
|
|
10
10
|
code: string;
|
|
11
11
|
data: ElectricityProvider[];
|
|
12
12
|
};
|
|
13
|
-
export type MeterLookupParams = {
|
|
14
|
-
disco: string;
|
|
15
|
-
customerId: string;
|
|
16
|
-
};
|
|
17
|
-
export type MeterLookupResult = {
|
|
18
|
-
code: string;
|
|
19
|
-
/** Customer name associated with the meter */
|
|
20
|
-
data: string;
|
|
21
|
-
};
|
|
@@ -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"> & {
|
|
@@ -13,6 +13,15 @@ export type ElectricityPaymentParams = {
|
|
|
13
13
|
/** Usually PREPAID or POSTPAID. */
|
|
14
14
|
meterType: string;
|
|
15
15
|
};
|
|
16
|
+
export type MeterLookupV2Params = {
|
|
17
|
+
disco: string;
|
|
18
|
+
customerId: string;
|
|
19
|
+
};
|
|
20
|
+
export type MeterLookupV2Result = {
|
|
21
|
+
name: string;
|
|
22
|
+
/** `"unknown"` if the provider supplies no address. */
|
|
23
|
+
address: string;
|
|
24
|
+
};
|
|
16
25
|
export type ElectricityPaymentV2Result = {
|
|
17
26
|
/** Pass to requery to confirm the final status. */
|
|
18
27
|
id: string;
|