@afriex/sdk 5.1.0 → 6.0.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/CHANGELOG.md +39 -0
- package/README.md +155 -148
- package/dist/cjs/client.d.ts +110 -0
- package/dist/cjs/client.js +231 -0
- package/dist/cjs/core/api-promise.d.ts +25 -0
- package/dist/cjs/core/api-promise.js +49 -0
- package/dist/cjs/core/errors.d.ts +78 -0
- package/dist/cjs/core/errors.js +143 -0
- package/dist/cjs/core/pagination.d.ts +47 -0
- package/dist/cjs/core/pagination.js +70 -0
- package/dist/cjs/core/resource.d.ts +18 -0
- package/dist/cjs/core/resource.js +36 -0
- package/dist/cjs/core/types.d.ts +43 -0
- package/dist/cjs/core/types.js +2 -0
- package/dist/cjs/generated/openapi.d.ts +5750 -0
- package/dist/cjs/generated/openapi.js +6 -0
- package/dist/cjs/index.d.ts +21 -0
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/balance.d.ts +16 -0
- package/dist/cjs/resources/balance.js +19 -0
- package/dist/cjs/resources/checkout.d.ts +12 -0
- package/dist/cjs/resources/checkout.js +16 -0
- package/dist/cjs/resources/customers.d.ts +27 -0
- package/dist/cjs/resources/customers.js +56 -0
- package/dist/cjs/resources/media.d.ts +24 -0
- package/dist/cjs/resources/media.js +39 -0
- package/dist/cjs/resources/payment-batches.d.ts +41 -0
- package/dist/cjs/resources/payment-batches.js +76 -0
- package/dist/cjs/resources/payment-methods.d.ts +49 -0
- package/dist/cjs/resources/payment-methods.js +95 -0
- package/dist/cjs/resources/rates.d.ts +9 -0
- package/dist/cjs/resources/rates.js +13 -0
- package/dist/cjs/resources/sme-registration.d.ts +24 -0
- package/dist/cjs/resources/sme-registration.js +31 -0
- package/dist/cjs/resources/transactions.d.ts +39 -0
- package/dist/cjs/resources/transactions.js +67 -0
- package/dist/cjs/resources/webhooks.d.ts +43 -0
- package/dist/cjs/resources/webhooks.js +53 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/esm/client.d.ts +110 -0
- package/dist/esm/client.js +227 -0
- package/dist/esm/core/api-promise.d.ts +25 -0
- package/dist/esm/core/api-promise.js +45 -0
- package/dist/esm/core/errors.d.ts +78 -0
- package/dist/esm/core/errors.js +126 -0
- package/dist/esm/core/pagination.d.ts +47 -0
- package/dist/esm/core/pagination.js +65 -0
- package/dist/esm/core/resource.d.ts +18 -0
- package/dist/esm/core/resource.js +30 -0
- package/dist/esm/core/types.d.ts +43 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/generated/openapi.d.ts +5750 -0
- package/dist/esm/generated/openapi.js +5 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/resources/balance.d.ts +16 -0
- package/dist/esm/resources/balance.js +15 -0
- package/dist/esm/resources/checkout.d.ts +12 -0
- package/dist/esm/resources/checkout.js +12 -0
- package/dist/esm/resources/customers.d.ts +27 -0
- package/dist/esm/resources/customers.js +52 -0
- package/dist/esm/resources/media.d.ts +24 -0
- package/dist/esm/resources/media.js +35 -0
- package/dist/esm/resources/payment-batches.d.ts +41 -0
- package/dist/esm/resources/payment-batches.js +72 -0
- package/dist/esm/resources/payment-methods.d.ts +49 -0
- package/dist/esm/resources/payment-methods.js +91 -0
- package/dist/esm/resources/rates.d.ts +9 -0
- package/dist/esm/resources/rates.js +9 -0
- package/dist/esm/resources/sme-registration.d.ts +24 -0
- package/dist/esm/resources/sme-registration.js +27 -0
- package/dist/esm/resources/transactions.d.ts +39 -0
- package/dist/esm/resources/transactions.js +63 -0
- package/dist/esm/resources/webhooks.d.ts +43 -0
- package/dist/esm/resources/webhooks.js +49 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/package.json +52 -68
- package/dist/index.d.ts +0 -54
- package/dist/index.js +0 -54
- package/dist/version.d.ts +0 -8
- package/dist/version.js +0 -8
- package/skills/afriex-go-live/SKILL.md +0 -386
- package/skills/afriex-sdk/SKILL.md +0 -275
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { Afriex, Afriex as AfriexSDK, API_VERSION, ENVIRONMENTS } from './client.js';
|
|
2
|
+
export type { APIRequestInit, ClientOptions, Environment, SignableRequest } from './client.js';
|
|
3
|
+
export { APIPromise } from './core/api-promise.js';
|
|
4
|
+
export { AfriexError, APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, WebhookVerificationError, } from './core/errors.js';
|
|
5
|
+
export { Page, PagePromise } from './core/pagination.js';
|
|
6
|
+
export type { RequestOptions } from './core/types.js';
|
|
7
|
+
export type * from './resources/balance.js';
|
|
8
|
+
export type * from './resources/checkout.js';
|
|
9
|
+
export type * from './resources/customers.js';
|
|
10
|
+
export type * from './resources/media.js';
|
|
11
|
+
export type * from './resources/payment-batches.js';
|
|
12
|
+
export type * from './resources/payment-methods.js';
|
|
13
|
+
export type * from './resources/rates.js';
|
|
14
|
+
export type * from './resources/sme-registration.js';
|
|
15
|
+
export type * from './resources/transactions.js';
|
|
16
|
+
export type * from './resources/webhooks.js';
|
|
17
|
+
export { WEBHOOK_SIGNATURE_HEADER } from './resources/webhooks.js';
|
|
18
|
+
export { VERSION } from './version.js';
|
|
19
|
+
/** Every type the spec defines, as generated from `api-reference/openapi.json`. */
|
|
20
|
+
export type * as OpenAPI from './generated/openapi.js';
|
|
21
|
+
export { Afriex as default } from './client.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.VERSION = exports.WEBHOOK_SIGNATURE_HEADER = exports.PagePromise = exports.Page = exports.WebhookVerificationError = exports.UnprocessableEntityError = exports.RateLimitError = exports.PermissionDeniedError = exports.NotFoundError = exports.InternalServerError = exports.ConflictError = exports.BadRequestError = exports.AuthenticationError = exports.APIUserAbortError = exports.APIError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.AfriexError = exports.APIPromise = exports.ENVIRONMENTS = exports.API_VERSION = exports.AfriexSDK = exports.Afriex = void 0;
|
|
4
|
+
var client_js_1 = require("./client.js");
|
|
5
|
+
Object.defineProperty(exports, "Afriex", { enumerable: true, get: function () { return client_js_1.Afriex; } });
|
|
6
|
+
Object.defineProperty(exports, "AfriexSDK", { enumerable: true, get: function () { return client_js_1.Afriex; } });
|
|
7
|
+
Object.defineProperty(exports, "API_VERSION", { enumerable: true, get: function () { return client_js_1.API_VERSION; } });
|
|
8
|
+
Object.defineProperty(exports, "ENVIRONMENTS", { enumerable: true, get: function () { return client_js_1.ENVIRONMENTS; } });
|
|
9
|
+
var api_promise_js_1 = require("./core/api-promise.js");
|
|
10
|
+
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_js_1.APIPromise; } });
|
|
11
|
+
var errors_js_1 = require("./core/errors.js");
|
|
12
|
+
Object.defineProperty(exports, "AfriexError", { enumerable: true, get: function () { return errors_js_1.AfriexError; } });
|
|
13
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return errors_js_1.APIConnectionError; } });
|
|
14
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return errors_js_1.APIConnectionTimeoutError; } });
|
|
15
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return errors_js_1.APIError; } });
|
|
16
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return errors_js_1.APIUserAbortError; } });
|
|
17
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_js_1.AuthenticationError; } });
|
|
18
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return errors_js_1.BadRequestError; } });
|
|
19
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_js_1.ConflictError; } });
|
|
20
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return errors_js_1.InternalServerError; } });
|
|
21
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_js_1.NotFoundError; } });
|
|
22
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return errors_js_1.PermissionDeniedError; } });
|
|
23
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_js_1.RateLimitError; } });
|
|
24
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return errors_js_1.UnprocessableEntityError; } });
|
|
25
|
+
Object.defineProperty(exports, "WebhookVerificationError", { enumerable: true, get: function () { return errors_js_1.WebhookVerificationError; } });
|
|
26
|
+
var pagination_js_1 = require("./core/pagination.js");
|
|
27
|
+
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return pagination_js_1.Page; } });
|
|
28
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_js_1.PagePromise; } });
|
|
29
|
+
var webhooks_js_1 = require("./resources/webhooks.js");
|
|
30
|
+
Object.defineProperty(exports, "WEBHOOK_SIGNATURE_HEADER", { enumerable: true, get: function () { return webhooks_js_1.WEBHOOK_SIGNATURE_HEADER; } });
|
|
31
|
+
var version_js_1 = require("./version.js");
|
|
32
|
+
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_js_1.VERSION; } });
|
|
33
|
+
var client_js_2 = require("./client.js");
|
|
34
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_js_2.Afriex; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import { APIResource } from '../core/resource.js';
|
|
3
|
+
import type { Body, Data, Query, RequestOptions } from '../core/types.js';
|
|
4
|
+
export type BalanceParams = Omit<Query<'getBalance'>, 'currencies'> & {
|
|
5
|
+
/** The currencies to return, as a list or a comma-separated string. Omit for all of them. */
|
|
6
|
+
currencies?: string | string[];
|
|
7
|
+
};
|
|
8
|
+
/** Each currency's balance, keyed by currency code. */
|
|
9
|
+
export type Balances = Data<'getBalance'>;
|
|
10
|
+
export type TopUpParams = Body<'topupBalance'>;
|
|
11
|
+
export declare class Balance extends APIResource {
|
|
12
|
+
/** Retrieves your wallet balances, keyed by currency code. */
|
|
13
|
+
getBalance(params?: BalanceParams, options?: RequestOptions): APIPromise<Balances>;
|
|
14
|
+
/** Sandbox only: adds test funds to a wallet. */
|
|
15
|
+
topUpSandbox(params: TopUpParams, options?: RequestOptions): APIPromise<Data<'topupBalance'>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Balance = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class Balance extends resource_js_1.APIResource {
|
|
6
|
+
/** Retrieves your wallet balances, keyed by currency code. */
|
|
7
|
+
getBalance(params = {}, options) {
|
|
8
|
+
return this._client
|
|
9
|
+
.request('get', '/api/v1/org/balance', { query: params, options })
|
|
10
|
+
._thenUnwrap((r) => r.data ?? {});
|
|
11
|
+
}
|
|
12
|
+
/** Sandbox only: adds test funds to a wallet. */
|
|
13
|
+
topUpSandbox(params, options) {
|
|
14
|
+
return this._client
|
|
15
|
+
.request('post', '/api/v1/org/balance/topup', { body: params, options })
|
|
16
|
+
._thenUnwrap(resource_js_1.data);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Balance = Balance;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import { APIResource } from '../core/resource.js';
|
|
3
|
+
import type { Body, Data, RequestOptions } from '../core/types.js';
|
|
4
|
+
export type CheckoutSessionCreateParams = Body<'createCheckoutSession'>;
|
|
5
|
+
export type CheckoutSession = Data<'createCheckoutSession'>;
|
|
6
|
+
export declare class Checkout extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a hosted checkout session. Redirect the payer to its
|
|
9
|
+
* `checkoutUrl`. Amounts are in minor units, such as kobo or cents.
|
|
10
|
+
*/
|
|
11
|
+
createSession(params: CheckoutSessionCreateParams, options?: RequestOptions): APIPromise<CheckoutSession>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Checkout = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class Checkout extends resource_js_1.APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a hosted checkout session. Redirect the payer to its
|
|
8
|
+
* `checkoutUrl`. Amounts are in minor units, such as kobo or cents.
|
|
9
|
+
*/
|
|
10
|
+
createSession(params, options) {
|
|
11
|
+
return this._client
|
|
12
|
+
.request('post', '/api/v1/checkout-session', { body: params, options })
|
|
13
|
+
._thenUnwrap(resource_js_1.data);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.Checkout = Checkout;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import type { PagePromise } from '../core/pagination.js';
|
|
3
|
+
import { APIResource } from '../core/resource.js';
|
|
4
|
+
import type { Body, Data, Item, Query, RequestOptions } from '../core/types.js';
|
|
5
|
+
import type { Customer } from '../generated/openapi.js';
|
|
6
|
+
export type { Customer };
|
|
7
|
+
export type CustomerCreateParams = Body<'createCustomer'>;
|
|
8
|
+
export type CustomerListParams = Query<'listCustomers'>;
|
|
9
|
+
export type CustomerUpdateParams = Body<'updateCustomer'>;
|
|
10
|
+
export type CustomerUpdateKycParams = Body<'updateCustomerKyc'>;
|
|
11
|
+
export type CustomerVerifyParams = Body<'verifyCustomer'>;
|
|
12
|
+
export declare class Customers extends APIResource {
|
|
13
|
+
/** Creates a customer. */
|
|
14
|
+
create(params: CustomerCreateParams, options?: RequestOptions): APIPromise<Data<'createCustomer'>>;
|
|
15
|
+
/** Lists customers, alphabetically by full name. Iterate the result with `for await` to walk every page. */
|
|
16
|
+
list(params?: CustomerListParams, options?: RequestOptions): PagePromise<Item<'listCustomers'>>;
|
|
17
|
+
/** Retrieves a customer. */
|
|
18
|
+
get(customerId: string, options?: RequestOptions): APIPromise<Data<'getCustomer'>>;
|
|
19
|
+
/** Updates a customer's details. */
|
|
20
|
+
update(customerId: string, params: CustomerUpdateParams, options?: RequestOptions): APIPromise<Data<'updateCustomer'>>;
|
|
21
|
+
/** Deletes a customer. */
|
|
22
|
+
delete(customerId: string, options?: RequestOptions): APIPromise<Data<'deleteCustomer'>>;
|
|
23
|
+
/** Adds or replaces a customer's KYC documents. */
|
|
24
|
+
updateKyc(customerId: string, params: CustomerUpdateKycParams, options?: RequestOptions): APIPromise<Data<'updateCustomerKyc'>>;
|
|
25
|
+
/** Verifies a customer's identity document. */
|
|
26
|
+
verify(customerId: string, params: CustomerVerifyParams, options?: RequestOptions): APIPromise<Data<'verifyCustomer'>>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Customers = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class Customers extends resource_js_1.APIResource {
|
|
6
|
+
/** Creates a customer. */
|
|
7
|
+
create(params, options) {
|
|
8
|
+
return this._client
|
|
9
|
+
.request('post', '/api/v1/customer', { body: params, options })
|
|
10
|
+
._thenUnwrap(resource_js_1.data);
|
|
11
|
+
}
|
|
12
|
+
/** Lists customers, alphabetically by full name. Iterate the result with `for await` to walk every page. */
|
|
13
|
+
list(params = {}, options) {
|
|
14
|
+
return this._client.getPage('/api/v1/customer', params, options);
|
|
15
|
+
}
|
|
16
|
+
/** Retrieves a customer. */
|
|
17
|
+
get(customerId, options) {
|
|
18
|
+
return this._client
|
|
19
|
+
.request('get', (0, resource_js_1.path) `/api/v1/customer/${customerId}`, { options })
|
|
20
|
+
._thenUnwrap(resource_js_1.data);
|
|
21
|
+
}
|
|
22
|
+
/** Updates a customer's details. */
|
|
23
|
+
update(customerId, params, options) {
|
|
24
|
+
return this._client
|
|
25
|
+
.request('patch', (0, resource_js_1.path) `/api/v1/customer/${customerId}`, {
|
|
26
|
+
body: params,
|
|
27
|
+
options,
|
|
28
|
+
})
|
|
29
|
+
._thenUnwrap(resource_js_1.data);
|
|
30
|
+
}
|
|
31
|
+
/** Deletes a customer. */
|
|
32
|
+
delete(customerId, options) {
|
|
33
|
+
return this._client
|
|
34
|
+
.request('delete', (0, resource_js_1.path) `/api/v1/customer/${customerId}`, { options })
|
|
35
|
+
._thenUnwrap(resource_js_1.data);
|
|
36
|
+
}
|
|
37
|
+
/** Adds or replaces a customer's KYC documents. */
|
|
38
|
+
updateKyc(customerId, params, options) {
|
|
39
|
+
return this._client
|
|
40
|
+
.request('patch', (0, resource_js_1.path) `/api/v1/customer/${customerId}/kyc`, {
|
|
41
|
+
body: params,
|
|
42
|
+
options,
|
|
43
|
+
})
|
|
44
|
+
._thenUnwrap(resource_js_1.data);
|
|
45
|
+
}
|
|
46
|
+
/** Verifies a customer's identity document. */
|
|
47
|
+
verify(customerId, params, options) {
|
|
48
|
+
return this._client
|
|
49
|
+
.request('post', (0, resource_js_1.path) `/api/v1/customer/${customerId}/verify`, {
|
|
50
|
+
body: params,
|
|
51
|
+
options,
|
|
52
|
+
})
|
|
53
|
+
._thenUnwrap(resource_js_1.data);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Customers = Customers;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import { APIResource } from '../core/resource.js';
|
|
3
|
+
import type { Data, RequestOptions } from '../core/types.js';
|
|
4
|
+
import type { MediaUrlRequest } from '../generated/openapi.js';
|
|
5
|
+
export type UploadUrlParams = MediaUrlRequest;
|
|
6
|
+
export type UploadUrl = Data<'generatePresignedURL'>;
|
|
7
|
+
export interface UploadParams extends UploadUrlParams {
|
|
8
|
+
/** The file's contents. */
|
|
9
|
+
file: Blob | ArrayBuffer | Uint8Array;
|
|
10
|
+
/** Sent as the upload's `Content-Type`. */
|
|
11
|
+
contentType?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class Media extends APIResource {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a presigned URL for a file upload. PUT the file to `url`, then
|
|
16
|
+
* attach `key` to the request that needs the file. `upload()` does both.
|
|
17
|
+
*/
|
|
18
|
+
createUploadUrl(params: UploadUrlParams, options?: RequestOptions): APIPromise<UploadUrl>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets an upload URL and uploads the file to it. Returns the upload URL's
|
|
21
|
+
* details: attach its `key` to the request that needs the file.
|
|
22
|
+
*/
|
|
23
|
+
upload(params: UploadParams, options?: RequestOptions): Promise<UploadUrl>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Media = void 0;
|
|
4
|
+
const errors_js_1 = require("../core/errors.js");
|
|
5
|
+
const resource_js_1 = require("../core/resource.js");
|
|
6
|
+
class Media extends resource_js_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a presigned URL for a file upload. PUT the file to `url`, then
|
|
9
|
+
* attach `key` to the request that needs the file. `upload()` does both.
|
|
10
|
+
*/
|
|
11
|
+
createUploadUrl(params, options) {
|
|
12
|
+
return this._client
|
|
13
|
+
.request('post', '/api/v1/media/url', { body: params, options })
|
|
14
|
+
._thenUnwrap(resource_js_1.data);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets an upload URL and uploads the file to it. Returns the upload URL's
|
|
18
|
+
* details: attach its `key` to the request that needs the file.
|
|
19
|
+
*/
|
|
20
|
+
async upload(params, options) {
|
|
21
|
+
const { file, contentType, ...urlParams } = params;
|
|
22
|
+
const upload = await this.createUploadUrl(urlParams, options);
|
|
23
|
+
if (!upload.url) {
|
|
24
|
+
throw new errors_js_1.AfriexError('The API returned no upload URL.');
|
|
25
|
+
}
|
|
26
|
+
// The presigned URL carries its own authorization, and goes to the storage
|
|
27
|
+
// host, so it must not carry the API key.
|
|
28
|
+
const response = await this._client.fetchUnauthenticated(upload.url, {
|
|
29
|
+
method: 'PUT',
|
|
30
|
+
body: file,
|
|
31
|
+
headers: contentType ? { 'Content-Type': contentType } : {},
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new errors_js_1.AfriexError(`Uploading the file failed with status ${response.status}.`);
|
|
35
|
+
}
|
|
36
|
+
return upload;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Media = Media;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import type { PagePromise } from '../core/pagination.js';
|
|
3
|
+
import { APIResource } from '../core/resource.js';
|
|
4
|
+
import type { Body, Data, Item, Query, RequestOptions } from '../core/types.js';
|
|
5
|
+
import type { PaymentBatch } from '../generated/openapi.js';
|
|
6
|
+
export type { PaymentBatch };
|
|
7
|
+
export type PaymentBatchListParams = Query<'listPaymentBatches'>;
|
|
8
|
+
export type PaymentBatchCreateParams = Body<'createPaymentBatch'>;
|
|
9
|
+
export type PaymentBatchUpdateParams = Body<'updatePaymentBatch'>;
|
|
10
|
+
export type PaymentBatchRecipientListParams = Query<'listPaymentBatchRecipients'>;
|
|
11
|
+
export type PaymentBatchRecipientAddParams = Body<'addPaymentBatchRecipient'>;
|
|
12
|
+
export type PaymentBatchRecipientsAddParams = Body<'addPaymentBatchRecipients'>;
|
|
13
|
+
export type PaymentBatchRecipientUpdateParams = Body<'updatePaymentBatchRecipient'>;
|
|
14
|
+
export type PaymentBatchWithdrawParams = Query<'withdrawPaymentBatch'>;
|
|
15
|
+
export type PaymentBatchSessionListParams = Query<'listPaymentBatchSessions'>;
|
|
16
|
+
export declare class PaymentBatches extends APIResource {
|
|
17
|
+
/** Lists payment batches, newest first. Iterate the result with `for await` to walk every page. */
|
|
18
|
+
list(params?: PaymentBatchListParams, options?: RequestOptions): PagePromise<Item<'listPaymentBatches'>>;
|
|
19
|
+
/** Creates a payment batch. */
|
|
20
|
+
create(params: PaymentBatchCreateParams, options?: RequestOptions): APIPromise<Data<'createPaymentBatch'>>;
|
|
21
|
+
/** Retrieves a payment batch. */
|
|
22
|
+
get(batchId: string, options?: RequestOptions): APIPromise<Data<'getPaymentBatch'>>;
|
|
23
|
+
/** Updates a payment batch. */
|
|
24
|
+
update(batchId: string, params: PaymentBatchUpdateParams, options?: RequestOptions): APIPromise<Data<'updatePaymentBatch'>>;
|
|
25
|
+
/** Deletes a payment batch. */
|
|
26
|
+
delete(batchId: string, options?: RequestOptions): APIPromise<Data<'deletePaymentBatch'>>;
|
|
27
|
+
/** Lists a batch's recipients. Iterate the result with `for await` to walk every page. */
|
|
28
|
+
listRecipients(batchId: string, params?: PaymentBatchRecipientListParams, options?: RequestOptions): PagePromise<Item<'listPaymentBatchRecipients'>>;
|
|
29
|
+
/** Adds one recipient to a batch. */
|
|
30
|
+
addRecipient(batchId: string, params: PaymentBatchRecipientAddParams, options?: RequestOptions): APIPromise<Data<'addPaymentBatchRecipient'>>;
|
|
31
|
+
/** Adds several recipients to a batch in one request. */
|
|
32
|
+
addRecipients(batchId: string, params: PaymentBatchRecipientsAddParams, options?: RequestOptions): APIPromise<Data<'addPaymentBatchRecipients'>>;
|
|
33
|
+
/** Updates a recipient in a batch. */
|
|
34
|
+
updateRecipient(batchId: string, recipientId: string, params: PaymentBatchRecipientUpdateParams, options?: RequestOptions): APIPromise<Data<'updatePaymentBatchRecipient'>>;
|
|
35
|
+
/** Removes a recipient from a batch. */
|
|
36
|
+
removeRecipient(batchId: string, recipientId: string, options?: RequestOptions): APIPromise<Data<'removePaymentBatchRecipient'>>;
|
|
37
|
+
/** Pays out every recipient in a batch. */
|
|
38
|
+
withdraw(batchId: string, params?: PaymentBatchWithdrawParams, options?: RequestOptions): APIPromise<Data<'withdrawPaymentBatch'>>;
|
|
39
|
+
/** Lists a batch's payout sessions. Iterate the result with `for await` to walk every page. */
|
|
40
|
+
listSessions(batchId: string, params?: PaymentBatchSessionListParams, options?: RequestOptions): PagePromise<Item<'listPaymentBatchSessions'>>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentBatches = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class PaymentBatches extends resource_js_1.APIResource {
|
|
6
|
+
/** Lists payment batches, newest first. Iterate the result with `for await` to walk every page. */
|
|
7
|
+
list(params = {}, options) {
|
|
8
|
+
return this._client.getPage('/api/v1/payment-batch', params, options);
|
|
9
|
+
}
|
|
10
|
+
/** Creates a payment batch. */
|
|
11
|
+
create(params, options) {
|
|
12
|
+
return this._client
|
|
13
|
+
.request('post', '/api/v1/payment-batch', { body: params, options })
|
|
14
|
+
._thenUnwrap(resource_js_1.data);
|
|
15
|
+
}
|
|
16
|
+
/** Retrieves a payment batch. */
|
|
17
|
+
get(batchId, options) {
|
|
18
|
+
return this._client
|
|
19
|
+
.request('get', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}`, { options })
|
|
20
|
+
._thenUnwrap(resource_js_1.data);
|
|
21
|
+
}
|
|
22
|
+
/** Updates a payment batch. */
|
|
23
|
+
update(batchId, params, options) {
|
|
24
|
+
return this._client
|
|
25
|
+
.request('patch', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}`, {
|
|
26
|
+
body: params,
|
|
27
|
+
options,
|
|
28
|
+
})
|
|
29
|
+
._thenUnwrap(resource_js_1.data);
|
|
30
|
+
}
|
|
31
|
+
/** Deletes a payment batch. */
|
|
32
|
+
delete(batchId, options) {
|
|
33
|
+
return this._client
|
|
34
|
+
.request('delete', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}`, { options })
|
|
35
|
+
._thenUnwrap(resource_js_1.data);
|
|
36
|
+
}
|
|
37
|
+
/** Lists a batch's recipients. Iterate the result with `for await` to walk every page. */
|
|
38
|
+
listRecipients(batchId, params = {}, options) {
|
|
39
|
+
return this._client.getPage((0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/recipients`, params, options);
|
|
40
|
+
}
|
|
41
|
+
/** Adds one recipient to a batch. */
|
|
42
|
+
addRecipient(batchId, params, options) {
|
|
43
|
+
return this._client
|
|
44
|
+
.request('post', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/recipients`, { body: params, options })
|
|
45
|
+
._thenUnwrap(resource_js_1.data);
|
|
46
|
+
}
|
|
47
|
+
/** Adds several recipients to a batch in one request. */
|
|
48
|
+
addRecipients(batchId, params, options) {
|
|
49
|
+
return this._client
|
|
50
|
+
.request('post', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/recipients/bulk`, { body: params, options })
|
|
51
|
+
._thenUnwrap(resource_js_1.data);
|
|
52
|
+
}
|
|
53
|
+
/** Updates a recipient in a batch. */
|
|
54
|
+
updateRecipient(batchId, recipientId, params, options) {
|
|
55
|
+
return this._client
|
|
56
|
+
.request('patch', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/recipients/${recipientId}`, { body: params, options })
|
|
57
|
+
._thenUnwrap(resource_js_1.data);
|
|
58
|
+
}
|
|
59
|
+
/** Removes a recipient from a batch. */
|
|
60
|
+
removeRecipient(batchId, recipientId, options) {
|
|
61
|
+
return this._client
|
|
62
|
+
.request('delete', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/recipients/${recipientId}`, { options })
|
|
63
|
+
._thenUnwrap(resource_js_1.data);
|
|
64
|
+
}
|
|
65
|
+
/** Pays out every recipient in a batch. */
|
|
66
|
+
withdraw(batchId, params = {}, options) {
|
|
67
|
+
return this._client
|
|
68
|
+
.request('post', (0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/withdraw`, { query: params, options })
|
|
69
|
+
._thenUnwrap(resource_js_1.data);
|
|
70
|
+
}
|
|
71
|
+
/** Lists a batch's payout sessions. Iterate the result with `for await` to walk every page. */
|
|
72
|
+
listSessions(batchId, params = {}, options) {
|
|
73
|
+
return this._client.getPage((0, resource_js_1.path) `/api/v1/payment-batch/${batchId}/sessions`, params, options);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PaymentBatches = PaymentBatches;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import type { PagePromise } from '../core/pagination.js';
|
|
3
|
+
import { APIResource } from '../core/resource.js';
|
|
4
|
+
import type { Body, Data, Item, Query, RequestOptions, Response } from '../core/types.js';
|
|
5
|
+
import type { PaymentMethod } from '../generated/openapi.js';
|
|
6
|
+
export type { PaymentMethod };
|
|
7
|
+
export type PaymentMethodCreateParams = Body<'createPaymentMethod'>;
|
|
8
|
+
export type PaymentMethodListParams = Query<'listPaymentMethods'>;
|
|
9
|
+
export type InstitutionListParams = Query<'listInstitutions'>;
|
|
10
|
+
export type InstitutionList = Response<'listInstitutions'>;
|
|
11
|
+
export type InstitutionCodeParams = Query<'resolveInstitutionCode'>;
|
|
12
|
+
export type InstitutionCodes = Data<'resolveInstitutionCode'>;
|
|
13
|
+
export type ResolveAccountParams = Query<'resolveRecipient'>;
|
|
14
|
+
export type ResolvedAccount = Data<'resolveRecipient'>;
|
|
15
|
+
export type CryptoWalletParams = Query<'getCryptoWallet'>;
|
|
16
|
+
export type CryptoWallet = Data<'getCryptoWallet'>;
|
|
17
|
+
export type VirtualAccountListParams = Query<'listVirtualAccounts'>;
|
|
18
|
+
export type VirtualAccountList = Response<'listVirtualAccounts'>;
|
|
19
|
+
export type VirtualAccountCreateParams = Body<'createVirtualAccount'>;
|
|
20
|
+
export type SimulateTransferParams = Body<'simulateVirtualAccountTransfer'>;
|
|
21
|
+
export type PoolAccountParams = Query<'getPoolAccount'>;
|
|
22
|
+
export declare class PaymentMethods extends APIResource {
|
|
23
|
+
/** Saves a payout destination, such as a bank account or mobile money wallet. */
|
|
24
|
+
create(params: PaymentMethodCreateParams, options?: RequestOptions): APIPromise<Data<'createPaymentMethod'>>;
|
|
25
|
+
/** Lists payment methods, most recently updated first. Iterate the result with `for await` to walk every page. */
|
|
26
|
+
list(params?: PaymentMethodListParams, options?: RequestOptions): PagePromise<Item<'listPaymentMethods'>>;
|
|
27
|
+
/** Retrieves a payment method. */
|
|
28
|
+
get(paymentMethodId: string, options?: RequestOptions): APIPromise<Data<'getPaymentMethod'>>;
|
|
29
|
+
/** Deletes a payment method. */
|
|
30
|
+
delete(paymentMethodId: string, options?: RequestOptions): APIPromise<Response<'deletePaymentMethod'>>;
|
|
31
|
+
/** Lists the banks or mobile money providers for a channel and country. The list is on `data`. */
|
|
32
|
+
getInstitutions(params: InstitutionListParams, options?: RequestOptions): APIPromise<InstitutionList>;
|
|
33
|
+
/** Looks up a SWIFT code or routing number. */
|
|
34
|
+
resolveInstitutionCode(params: InstitutionCodeParams, options?: RequestOptions): APIPromise<InstitutionCodes>;
|
|
35
|
+
/** Looks up the name on an account before you pay it. */
|
|
36
|
+
resolveAccount(params: ResolveAccountParams, options?: RequestOptions): APIPromise<ResolvedAccount>;
|
|
37
|
+
/** Retrieves the crypto deposit addresses for an asset. */
|
|
38
|
+
getCryptoWallet(params: CryptoWalletParams, options?: RequestOptions): APIPromise<CryptoWallet>;
|
|
39
|
+
/** Lists virtual bank accounts. The list is on `data`. */
|
|
40
|
+
listVirtualAccounts(params: VirtualAccountListParams, options?: RequestOptions): APIPromise<VirtualAccountList>;
|
|
41
|
+
/** Opens a virtual bank account. */
|
|
42
|
+
createVirtualAccount(params: VirtualAccountCreateParams, options?: RequestOptions): APIPromise<Data<'createVirtualAccount'>>;
|
|
43
|
+
/** Sandbox only: simulates a transfer into a virtual account. */
|
|
44
|
+
simulateTransfer(params: SimulateTransferParams, options?: RequestOptions): APIPromise<Data<'simulateVirtualAccountTransfer'>>;
|
|
45
|
+
/** Retrieves the pool account to pay into for a country. */
|
|
46
|
+
getPoolAccount(params: PoolAccountParams, options?: RequestOptions): APIPromise<Data<'getPoolAccount'>>;
|
|
47
|
+
/** @deprecated Use `getPoolAccount()`. Despite the name, it returns one account. */
|
|
48
|
+
listPoolAccounts(params: PoolAccountParams, options?: RequestOptions): APIPromise<Data<'getPoolAccount'>>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentMethods = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class PaymentMethods extends resource_js_1.APIResource {
|
|
6
|
+
/** Saves a payout destination, such as a bank account or mobile money wallet. */
|
|
7
|
+
create(params, options) {
|
|
8
|
+
return this._client
|
|
9
|
+
.request('post', '/api/v1/payment-method', { body: params, options })
|
|
10
|
+
._thenUnwrap(resource_js_1.data);
|
|
11
|
+
}
|
|
12
|
+
/** Lists payment methods, most recently updated first. Iterate the result with `for await` to walk every page. */
|
|
13
|
+
list(params = {}, options) {
|
|
14
|
+
return this._client.getPage('/api/v1/payment-method', params, options);
|
|
15
|
+
}
|
|
16
|
+
/** Retrieves a payment method. */
|
|
17
|
+
get(paymentMethodId, options) {
|
|
18
|
+
return this._client
|
|
19
|
+
.request('get', (0, resource_js_1.path) `/api/v1/payment-method/${paymentMethodId}`, {
|
|
20
|
+
options,
|
|
21
|
+
})
|
|
22
|
+
._thenUnwrap(resource_js_1.data);
|
|
23
|
+
}
|
|
24
|
+
/** Deletes a payment method. */
|
|
25
|
+
delete(paymentMethodId, options) {
|
|
26
|
+
return this._client.request('delete', (0, resource_js_1.path) `/api/v1/payment-method/${paymentMethodId}`, { options });
|
|
27
|
+
}
|
|
28
|
+
/** Lists the banks or mobile money providers for a channel and country. The list is on `data`. */
|
|
29
|
+
getInstitutions(params, options) {
|
|
30
|
+
return this._client.request('get', '/api/v1/payment-method/institution', {
|
|
31
|
+
query: params,
|
|
32
|
+
options,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Looks up a SWIFT code or routing number. */
|
|
36
|
+
resolveInstitutionCode(params, options) {
|
|
37
|
+
return this._client
|
|
38
|
+
.request('get', '/api/v1/payment-method/institution/codes', {
|
|
39
|
+
query: params,
|
|
40
|
+
options,
|
|
41
|
+
})
|
|
42
|
+
._thenUnwrap(resource_js_1.data);
|
|
43
|
+
}
|
|
44
|
+
/** Looks up the name on an account before you pay it. */
|
|
45
|
+
resolveAccount(params, options) {
|
|
46
|
+
return this._client
|
|
47
|
+
.request('get', '/api/v1/payment-method/resolve', { query: params, options })
|
|
48
|
+
._thenUnwrap(resource_js_1.data);
|
|
49
|
+
}
|
|
50
|
+
/** Retrieves the crypto deposit addresses for an asset. */
|
|
51
|
+
getCryptoWallet(params, options) {
|
|
52
|
+
return this._client
|
|
53
|
+
.request('get', '/api/v1/payment-method/crypto-wallet', {
|
|
54
|
+
query: params,
|
|
55
|
+
options,
|
|
56
|
+
})
|
|
57
|
+
._thenUnwrap(resource_js_1.data);
|
|
58
|
+
}
|
|
59
|
+
/** Lists virtual bank accounts. The list is on `data`. */
|
|
60
|
+
listVirtualAccounts(params, options) {
|
|
61
|
+
return this._client.request('get', '/api/v1/payment-method/virtual-account', {
|
|
62
|
+
query: params,
|
|
63
|
+
options,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Opens a virtual bank account. */
|
|
67
|
+
createVirtualAccount(params, options) {
|
|
68
|
+
return this._client
|
|
69
|
+
.request('post', '/api/v1/payment-method/virtual-account', {
|
|
70
|
+
body: params,
|
|
71
|
+
options,
|
|
72
|
+
})
|
|
73
|
+
._thenUnwrap(resource_js_1.data);
|
|
74
|
+
}
|
|
75
|
+
/** Sandbox only: simulates a transfer into a virtual account. */
|
|
76
|
+
simulateTransfer(params, options) {
|
|
77
|
+
return this._client
|
|
78
|
+
.request('post', '/api/v1/payment-method/virtual-account/simulate-transfer', { body: params, options })
|
|
79
|
+
._thenUnwrap(resource_js_1.data);
|
|
80
|
+
}
|
|
81
|
+
/** Retrieves the pool account to pay into for a country. */
|
|
82
|
+
getPoolAccount(params, options) {
|
|
83
|
+
return this._client
|
|
84
|
+
.request('get', '/api/v1/payment-method/pool-account', {
|
|
85
|
+
query: params,
|
|
86
|
+
options,
|
|
87
|
+
})
|
|
88
|
+
._thenUnwrap(resource_js_1.data);
|
|
89
|
+
}
|
|
90
|
+
/** @deprecated Use `getPoolAccount()`. Despite the name, it returns one account. */
|
|
91
|
+
listPoolAccounts(params, options) {
|
|
92
|
+
return this.getPoolAccount(params, options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.PaymentMethods = PaymentMethods;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import { APIResource } from '../core/resource.js';
|
|
3
|
+
import type { Data, Query, RequestOptions } from '../core/types.js';
|
|
4
|
+
export type RatesParams = Query<'getRates'>;
|
|
5
|
+
export type ExchangeRates = Data<'getRates'>;
|
|
6
|
+
export declare class Rates extends APIResource {
|
|
7
|
+
/** Retrieves exchange rates between the currencies you name. */
|
|
8
|
+
getRates(params?: RatesParams, options?: RequestOptions): APIPromise<ExchangeRates>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rates = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
class Rates extends resource_js_1.APIResource {
|
|
6
|
+
/** Retrieves exchange rates between the currencies you name. */
|
|
7
|
+
getRates(params = {}, options) {
|
|
8
|
+
return this._client
|
|
9
|
+
.request('get', '/api/v1/org/rates', { query: params, options })
|
|
10
|
+
._thenUnwrap(resource_js_1.data);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Rates = Rates;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
2
|
+
import { APIResource } from '../core/resource.js';
|
|
3
|
+
import type { Body, Data, RequestOptions } from '../core/types.js';
|
|
4
|
+
type Step<S> = Extract<Body<'smeRegistration'>, {
|
|
5
|
+
step: S;
|
|
6
|
+
}>['data'];
|
|
7
|
+
export type SmeRegistrationInitiateParams = Step<'INITIATE'>;
|
|
8
|
+
export type SmeRegistrationConfirmOtpParams = Step<'CONFIRM_OTP'>;
|
|
9
|
+
export type SmeRegistrationSubmitParams = Step<'SUBMIT'>;
|
|
10
|
+
export type SmeRegistrationResult = Data<'smeRegistration'>;
|
|
11
|
+
export type SmeRegistrationStatus = Data<'smeRegistrationStatus'>;
|
|
12
|
+
/** Registers your business for its own dedicated KES virtual accounts, in three steps. */
|
|
13
|
+
export declare class SmeRegistration extends APIResource {
|
|
14
|
+
#private;
|
|
15
|
+
/** Step 1: starts a registration and sends an OTP to the mobile number. */
|
|
16
|
+
initiate(data: SmeRegistrationInitiateParams, options?: RequestOptions): APIPromise<SmeRegistrationResult>;
|
|
17
|
+
/** Step 2: confirms the OTP. */
|
|
18
|
+
confirmOtp(data: SmeRegistrationConfirmOtpParams, options?: RequestOptions): APIPromise<SmeRegistrationResult>;
|
|
19
|
+
/** Step 3: submits the business details for review. */
|
|
20
|
+
submit(data: SmeRegistrationSubmitParams, options?: RequestOptions): APIPromise<SmeRegistrationResult>;
|
|
21
|
+
/** Retrieves where your registration stands. */
|
|
22
|
+
getStatus(options?: RequestOptions): APIPromise<SmeRegistrationStatus>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmeRegistration = void 0;
|
|
4
|
+
const resource_js_1 = require("../core/resource.js");
|
|
5
|
+
/** Registers your business for its own dedicated KES virtual accounts, in three steps. */
|
|
6
|
+
class SmeRegistration extends resource_js_1.APIResource {
|
|
7
|
+
/** Step 1: starts a registration and sends an OTP to the mobile number. */
|
|
8
|
+
initiate(data, options) {
|
|
9
|
+
return this.#send({ step: 'INITIATE', data }, options);
|
|
10
|
+
}
|
|
11
|
+
/** Step 2: confirms the OTP. */
|
|
12
|
+
confirmOtp(data, options) {
|
|
13
|
+
return this.#send({ step: 'CONFIRM_OTP', data }, options);
|
|
14
|
+
}
|
|
15
|
+
/** Step 3: submits the business details for review. */
|
|
16
|
+
submit(data, options) {
|
|
17
|
+
return this.#send({ step: 'SUBMIT', data }, options);
|
|
18
|
+
}
|
|
19
|
+
/** Retrieves where your registration stands. */
|
|
20
|
+
getStatus(options) {
|
|
21
|
+
return this._client
|
|
22
|
+
.request('get', '/api/v1/sme-registration/status', { options })
|
|
23
|
+
._thenUnwrap(resource_js_1.data);
|
|
24
|
+
}
|
|
25
|
+
#send(body, options) {
|
|
26
|
+
return this._client
|
|
27
|
+
.request('post', '/api/v1/sme-registration', { body, options })
|
|
28
|
+
._thenUnwrap(resource_js_1.data);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.SmeRegistration = SmeRegistration;
|