@afriex/sdk 5.0.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,63 @@
|
|
|
1
|
+
import { APIResource, data, path } from '../core/resource.js';
|
|
2
|
+
export class Transactions extends APIResource {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a deposit, withdrawal or swap.
|
|
5
|
+
*
|
|
6
|
+
* `meta.idempotencyKey` makes this safe to send again, so the SDK retries it
|
|
7
|
+
* on timeouts and server errors with the same body. If a retry gets
|
|
8
|
+
* `409 DUPLICATE_REQUEST` (a `ConflictError`), the first attempt went
|
|
9
|
+
* through: look the transaction up by `meta.reference`.
|
|
10
|
+
*/
|
|
11
|
+
create(params, options) {
|
|
12
|
+
return this._client
|
|
13
|
+
.request('post', '/api/v1/transaction', {
|
|
14
|
+
body: params,
|
|
15
|
+
idempotent: true,
|
|
16
|
+
options,
|
|
17
|
+
})
|
|
18
|
+
._thenUnwrap(data);
|
|
19
|
+
}
|
|
20
|
+
/** Lists transactions, newest first. Iterate the result with `for await` to walk every page. */
|
|
21
|
+
list(params = {}, options) {
|
|
22
|
+
return this._client.getPage('/api/v1/transaction', params, options);
|
|
23
|
+
}
|
|
24
|
+
/** Quotes a withdrawal: the rate, fee and amounts, without creating anything. */
|
|
25
|
+
quote(params, options) {
|
|
26
|
+
return this._client
|
|
27
|
+
.request('get', '/api/v1/transaction/quote', { query: params, options })
|
|
28
|
+
._thenUnwrap(data);
|
|
29
|
+
}
|
|
30
|
+
/** Retrieves a transaction. */
|
|
31
|
+
get(transactionId, options) {
|
|
32
|
+
return this._client
|
|
33
|
+
.request('get', path `/api/v1/transaction/${transactionId}`, { options })
|
|
34
|
+
._thenUnwrap(data);
|
|
35
|
+
}
|
|
36
|
+
/** Authorizes a transaction that is waiting for it, for example with an OTP. */
|
|
37
|
+
authorize(transactionId, params, options) {
|
|
38
|
+
return this._client
|
|
39
|
+
.request('post', path `/api/v1/transaction/${transactionId}/authorize`, { body: params, options })
|
|
40
|
+
._thenUnwrap(data);
|
|
41
|
+
}
|
|
42
|
+
/** Sandbox only: moves a transaction to the outcome you choose. */
|
|
43
|
+
simulate(transactionId, params, options) {
|
|
44
|
+
return this._client
|
|
45
|
+
.request('post', path `/api/v1/transaction/${transactionId}/simulate`, { body: params, options })
|
|
46
|
+
._thenUnwrap(data);
|
|
47
|
+
}
|
|
48
|
+
/** Retrieves the settlement advice for a completed transaction. */
|
|
49
|
+
getAdvice(transactionId, options) {
|
|
50
|
+
return this._client
|
|
51
|
+
.request('get', path `/api/v1/transaction/${transactionId}/advice`, { options })
|
|
52
|
+
._thenUnwrap(data);
|
|
53
|
+
}
|
|
54
|
+
/** Submits proof of a payment into a pool account. */
|
|
55
|
+
submitPoolAccountProof(params, options) {
|
|
56
|
+
return this._client
|
|
57
|
+
.request('post', '/api/v1/transaction/pool-account', {
|
|
58
|
+
body: params,
|
|
59
|
+
options,
|
|
60
|
+
})
|
|
61
|
+
._thenUnwrap(data);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Afriex } from '../client.js';
|
|
2
|
+
import type { APIPromise } from '../core/api-promise.js';
|
|
3
|
+
import { APIResource } from '../core/resource.js';
|
|
4
|
+
import type { Body, Data, RequestOptions } from '../core/types.js';
|
|
5
|
+
import type { webhooks } from '../generated/openapi.js';
|
|
6
|
+
/** The header that carries a webhook's signature. */
|
|
7
|
+
export declare const WEBHOOK_SIGNATURE_HEADER = "x-webhook-signature";
|
|
8
|
+
type WebhookBody<K extends keyof webhooks> = NonNullable<webhooks[K]['post']> extends {
|
|
9
|
+
requestBody: {
|
|
10
|
+
content: {
|
|
11
|
+
'application/json': infer B;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
} ? B : never;
|
|
15
|
+
/** Any event Afriex delivers. Switch on `event` to narrow it. */
|
|
16
|
+
export type WebhookEvent = {
|
|
17
|
+
[K in keyof webhooks]: WebhookBody<K>;
|
|
18
|
+
}[keyof webhooks];
|
|
19
|
+
export type WebhookEventType = WebhookEvent['event'];
|
|
20
|
+
export type CustomerWebhookEvent = WebhookBody<'customer.events'>;
|
|
21
|
+
export type PaymentMethodWebhookEvent = WebhookBody<'payment_method.events'>;
|
|
22
|
+
export type TransactionWebhookEvent = WebhookBody<'transaction.events'>;
|
|
23
|
+
export type PoolDepositRequestWebhookEvent = WebhookBody<'pool_deposit_request.events'>;
|
|
24
|
+
export type TriggerWebhookParams = Body<'triggerWebhook'>;
|
|
25
|
+
export type TriggerWebhookResult = Data<'triggerWebhook'>;
|
|
26
|
+
export declare class Webhooks extends APIResource {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(client: Afriex, publicKey?: string);
|
|
29
|
+
/**
|
|
30
|
+
* Whether `signature` is Afriex's signature of `payload`. Pass the raw body
|
|
31
|
+
* exactly as received: a re-serialized object never matches.
|
|
32
|
+
*/
|
|
33
|
+
verify(payload: string | Uint8Array, signature: string | string[] | null | undefined): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Verifies a webhook and returns its parsed event.
|
|
36
|
+
*
|
|
37
|
+
* @throws WebhookVerificationError when no public key is configured or the signature does not match.
|
|
38
|
+
*/
|
|
39
|
+
verifyAndParse(payload: string | Uint8Array, signature: string | string[] | null | undefined): WebhookEvent;
|
|
40
|
+
/** Sandbox only: sends a test webhook for an event and entity to your configured URL. */
|
|
41
|
+
triggerTestWebhook(params: TriggerWebhookParams, options?: RequestOptions): APIPromise<TriggerWebhookResult>;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createVerify } from 'node:crypto';
|
|
2
|
+
import { WebhookVerificationError } from '../core/errors.js';
|
|
3
|
+
import { APIResource, data } from '../core/resource.js';
|
|
4
|
+
/** The header that carries a webhook's signature. */
|
|
5
|
+
export const WEBHOOK_SIGNATURE_HEADER = 'x-webhook-signature';
|
|
6
|
+
export class Webhooks extends APIResource {
|
|
7
|
+
#publicKey;
|
|
8
|
+
constructor(client, publicKey) {
|
|
9
|
+
super(client);
|
|
10
|
+
this.#publicKey = publicKey;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether `signature` is Afriex's signature of `payload`. Pass the raw body
|
|
14
|
+
* exactly as received: a re-serialized object never matches.
|
|
15
|
+
*/
|
|
16
|
+
verify(payload, signature) {
|
|
17
|
+
const header = Array.isArray(signature) ? signature[0] : signature;
|
|
18
|
+
if (!this.#publicKey || !header || payload.length === 0)
|
|
19
|
+
return false;
|
|
20
|
+
try {
|
|
21
|
+
// ECDSA P-384 over SHA-256, DER-encoded then base64-encoded.
|
|
22
|
+
return createVerify('SHA256').update(payload).verify(this.#publicKey, header, 'base64');
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Verifies a webhook and returns its parsed event.
|
|
30
|
+
*
|
|
31
|
+
* @throws WebhookVerificationError when no public key is configured or the signature does not match.
|
|
32
|
+
*/
|
|
33
|
+
verifyAndParse(payload, signature) {
|
|
34
|
+
if (!this.#publicKey) {
|
|
35
|
+
throw new WebhookVerificationError('No webhook public key. Pass `webhookPublicKey` when you create the client.');
|
|
36
|
+
}
|
|
37
|
+
if (!this.verify(payload, signature)) {
|
|
38
|
+
throw new WebhookVerificationError('The webhook signature does not match its body.');
|
|
39
|
+
}
|
|
40
|
+
const text = typeof payload === 'string' ? payload : new TextDecoder().decode(payload);
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
}
|
|
43
|
+
/** Sandbox only: sends a test webhook for an event and entity to your configured URL. */
|
|
44
|
+
triggerTestWebhook(params, options) {
|
|
45
|
+
return this._client
|
|
46
|
+
.request('post', '/api/v1/webhooks/trigger', { body: params, options })
|
|
47
|
+
._thenUnwrap(data);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "6.0.0";
|
package/package.json
CHANGED
|
@@ -1,81 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afriex/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Official TypeScript SDK for the Afriex Business API
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"description": "Official TypeScript SDK for the Afriex Business API, generated from the API reference's OpenAPI spec",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"afriex",
|
|
7
|
+
"payments",
|
|
8
|
+
"payouts",
|
|
9
|
+
"remittance",
|
|
10
|
+
"africa",
|
|
11
|
+
"sdk",
|
|
12
|
+
"api"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://docs.afriex.com/sdk/introduction",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://docs.afriex.com/sdk/introduction#support",
|
|
18
|
+
"email": "support@afriex.com"
|
|
13
19
|
},
|
|
14
|
-
"
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./dist/cjs/index.js",
|
|
22
|
+
"module": "./dist/esm/index.js",
|
|
23
|
+
"types": "./dist/cjs/index.d.ts",
|
|
15
24
|
"exports": {
|
|
16
25
|
".": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"@afriex/balance": "2.1.0",
|
|
28
|
-
"@afriex/rates": "2.0.2",
|
|
29
|
-
"@afriex/checkout": "3.1.0",
|
|
30
|
-
"@afriex/webhooks": "3.0.0",
|
|
31
|
-
"@afriex/media": "1.0.0",
|
|
32
|
-
"@afriex/payment-batches": "1.0.0",
|
|
33
|
-
"@afriex/sme-registration": "1.0.0"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@tanstack/intent": "^0.3.6",
|
|
37
|
-
"rimraf": "^6.1.3",
|
|
38
|
-
"typescript": "^7.0.2"
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"typescript": ">=5.0.0"
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/esm/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/index.js"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/cjs/index.d.ts",
|
|
32
|
+
"default": "./dist/cjs/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
42
36
|
},
|
|
43
37
|
"files": [
|
|
44
38
|
"dist",
|
|
45
39
|
"README.md",
|
|
46
|
-
"
|
|
47
|
-
"skills"
|
|
40
|
+
"CHANGELOG.md"
|
|
48
41
|
],
|
|
49
|
-
"
|
|
50
|
-
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20"
|
|
51
45
|
},
|
|
52
|
-
"keywords": [
|
|
53
|
-
"afriex",
|
|
54
|
-
"payments",
|
|
55
|
-
"fintech",
|
|
56
|
-
"africa",
|
|
57
|
-
"cross-border-payments",
|
|
58
|
-
"typescript",
|
|
59
|
-
"afriex-sdk",
|
|
60
|
-
"sdk",
|
|
61
|
-
"api",
|
|
62
|
-
"payments-api",
|
|
63
|
-
"api-client",
|
|
64
|
-
"money-transfer",
|
|
65
|
-
"remittance",
|
|
66
|
-
"payouts",
|
|
67
|
-
"mobile-money",
|
|
68
|
-
"bank-transfer",
|
|
69
|
-
"nigeria",
|
|
70
|
-
"kenya",
|
|
71
|
-
"ghana",
|
|
72
|
-
"nodejs",
|
|
73
|
-
"tanstack-intent"
|
|
74
|
-
],
|
|
75
|
-
"license": "MIT",
|
|
76
46
|
"scripts": {
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
47
|
+
"generate": "openapi-typescript ../../api-reference/openapi.json --root-types --root-types-no-schema-prefix -o src/generated/openapi.ts",
|
|
48
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"check:samples": "node scripts/check-samples.mjs",
|
|
52
|
+
"check:package": "npm run build && node scripts/check-package.mjs",
|
|
53
|
+
"smoke": "npm run build && node scripts/smoke-test.mjs"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "20.19.25",
|
|
57
|
+
"openapi-typescript": "7.13.0",
|
|
58
|
+
"typescript": "5.9.3",
|
|
59
|
+
"vitest": "4.0.18"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"provenance": false
|
|
80
64
|
}
|
|
81
|
-
}
|
|
65
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AfriexClient, AfriexConfig } from "@afriex/core";
|
|
2
|
-
import { CustomerService } from "@afriex/customers";
|
|
3
|
-
import { TransactionService } from "@afriex/transactions";
|
|
4
|
-
import { PaymentMethodService } from "@afriex/payment-methods";
|
|
5
|
-
import { BalanceService } from "@afriex/balance";
|
|
6
|
-
import { RateService } from "@afriex/rates";
|
|
7
|
-
import { CheckoutService } from "@afriex/checkout";
|
|
8
|
-
import { WebhookService } from "@afriex/webhooks";
|
|
9
|
-
import { MediaService } from "@afriex/media";
|
|
10
|
-
import { PaymentBatchService } from "@afriex/payment-batches";
|
|
11
|
-
import { SmeRegistrationService } from "@afriex/sme-registration";
|
|
12
|
-
export interface AfriexSDKConfig extends AfriexConfig {
|
|
13
|
-
webhookPublicKey?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class AfriexSDK extends AfriexClient {
|
|
16
|
-
readonly customers: CustomerService;
|
|
17
|
-
readonly transactions: TransactionService;
|
|
18
|
-
readonly paymentMethods: PaymentMethodService;
|
|
19
|
-
readonly paymentBatches: PaymentBatchService;
|
|
20
|
-
readonly balance: BalanceService;
|
|
21
|
-
readonly rates: RateService;
|
|
22
|
-
readonly checkout: CheckoutService;
|
|
23
|
-
readonly media: MediaService;
|
|
24
|
-
readonly smeRegistration: SmeRegistrationService;
|
|
25
|
-
readonly webhooks: WebhookService;
|
|
26
|
-
readonly webhookVerifier?: WebhookService;
|
|
27
|
-
constructor(config: AfriexSDKConfig);
|
|
28
|
-
}
|
|
29
|
-
export { AfriexSDK as Afriex };
|
|
30
|
-
export { SDK_VERSION } from "./version.js";
|
|
31
|
-
export * from "@afriex/core";
|
|
32
|
-
export { CustomerService } from "@afriex/customers";
|
|
33
|
-
export { TransactionService } from "@afriex/transactions";
|
|
34
|
-
export { PaymentMethodService } from "@afriex/payment-methods";
|
|
35
|
-
export { BalanceService } from "@afriex/balance";
|
|
36
|
-
export { RateService } from "@afriex/rates";
|
|
37
|
-
export { CheckoutService } from "@afriex/checkout";
|
|
38
|
-
export { WebhookVerifier, WebhookService } from "@afriex/webhooks";
|
|
39
|
-
export { MediaService } from "@afriex/media";
|
|
40
|
-
export { PaymentBatchService } from "@afriex/payment-batches";
|
|
41
|
-
export { SmeRegistrationService } from "@afriex/sme-registration";
|
|
42
|
-
export type { Customer, CustomerKyc, CustomerMeta, KycDocumentType, UpdatableKycDocumentType, ReadOnlyKycDocumentType, CreateCustomerRequest, UpdateCustomerRequest, UpdateCustomerKycRequest, VerifyCustomerRequest, ListCustomersParams, CustomerListResponse, } from "@afriex/customers";
|
|
43
|
-
export type { Transaction, CreateTransactionRequest, CreateWithdrawTransaction, CreateDepositTransaction, CreateSwapTransaction, TransactionAmount, TransactionAmounts, SwapAmount, AuthorizeTransactionRequest, SimulateTransactionRequest, SimulateTransactionOutcome, SettlementAdvice, SubmitPoolAccountProofRequest, PoolAccountProofSender, ListTransactionsParams, TransactionListResponse, TransactionListType, TransactionListStatus, TransactionSettlement, TransactionChannel, TransactionType, TransactionMeta, TransactionMetaResponse, TransactionFailureCode, TransactionFailureReason, } from "@afriex/transactions";
|
|
44
|
-
export type { PaymentMethod, PaymentMethodBankAddress, PaymentMethodInstitution, PaymentMethodRecipient, PaymentMethodTransaction, CreatePaymentMethodRequest, CreateInstitutionPaymentMethodRequest, CreateAliasPaymentMethodRequest, CreateVirtualBankAccountPaymentMethodRequest, AliasPaymentChannel, InstitutionPaymentChannel, ListPaymentMethodsParams, PaymentMethodListResponse, PaymentMethodListChannel, PaymentMethodListStatus, PaymentMethodListCapability, VirtualAccountLabel, PaymentChannel, CreatablePaymentChannel, PaymentMethodStatus, CardBrand, CardExpiration, Institution, InstitutionListResponse, InstitutionListChannel, InstitutionCode, InstitutionCodesParams, InstitutionCodesResponse, ResolveAccountParams, ResolvedAccount, ResolveAccountResponse, GetInstitutionsParams, CryptoWallet, CryptoWalletData, CryptoWalletResponse, GetCryptoWalletParams, ListVirtualAccountsParams, CreateVirtualAccountParams, ListPoolAccountsParams, VirtualAccountListResponse, PoolAccountResponse, SimulateTransferRequest, SimulateTransferResult, } from "@afriex/payment-methods";
|
|
45
|
-
export type { BalanceResponse, GetBalanceParams, TopUpParams, TopUpResponse, TopUpTransaction, TopUpTransactionType, TopUpTransactionStatus, } from "@afriex/balance";
|
|
46
|
-
export type { RatesResponse, GetRatesParams } from "@afriex/rates";
|
|
47
|
-
export type { CheckoutSession, CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, CheckoutCustomer, CheckoutChannel, } from "@afriex/checkout";
|
|
48
|
-
export type { MediaUploadType, CreateUploadUrlRequest, UploadUrl, UploadableFile, UploadFileRequest, UploadedFile, } from "@afriex/media";
|
|
49
|
-
export type { PaymentBatch, PaymentBatchRequest, PaymentBatchSource, PaymentBatchFundingMethod, PaymentBatchListItem, PaymentBatchListParams, PaymentBatchListResponse, PaymentBatchInstitution, PaymentBatchAmount, PaymentBatchRecipientRequest, UpdatePaymentBatchRecipientRequest, SavedPaymentBatchRecipient, PaymentBatchRecipient, PaymentBatchRecipientListResponse, PaymentBatchOutcomes, WithdrawPaymentBatchParams, PaymentBatchSession, PaymentBatchSessionResult, PaymentBatchSessionListResponse, } from "@afriex/payment-batches";
|
|
50
|
-
export type { SmeRegistration, SmeRegistrationRequest, SmeRegistrationStep, SmeRegistrationStatus, SmeRegistrationStatusResult, SmeReviewStatus, SmeBusinessType, InitiateSmeRegistrationData, ConfirmSmeRegistrationOtpData, SubmitSmeRegistrationData, } from "@afriex/sme-registration";
|
|
51
|
-
export type { WebhookPayload, CustomerWebhookPayload, CustomerEventType, CustomerWebhookData, PaymentMethodWebhookPayload, PaymentMethodEventType, PaymentMethodWebhookData, TransactionWebhookPayload, TransactionEventType, TransactionWebhookData, TransactionWebhookMeta, TransactionWebhookFailureReason, TransactionWebhookStatus, CheckoutSessionWebhookPayload, CheckoutSessionEventType, CheckoutSessionWebhookData, CheckoutSessionWebhookCustomer, PoolDepositRequestWebhookPayload, PoolDepositRequestEventType, PoolDepositRejectedWebhookData, TriggerWebhookRequest, TriggerWebhookResult, TriggerWebhookResponse, WebhookEventType, TriggerableWebhookEventType, } from "@afriex/webhooks";
|
|
52
|
-
export { WEBHOOK_SIGNATURE_HEADER } from "@afriex/webhooks";
|
|
53
|
-
export { TransactionStatus, DEFAULT_TRANSACTION_TYPE, } from "@afriex/transactions";
|
|
54
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AfriexClient, DEFAULT_USER_AGENT, } from "@afriex/core";
|
|
2
|
-
import { SDK_VERSION } from "./version.js";
|
|
3
|
-
import { CustomerService } from "@afriex/customers";
|
|
4
|
-
import { TransactionService } from "@afriex/transactions";
|
|
5
|
-
import { PaymentMethodService } from "@afriex/payment-methods";
|
|
6
|
-
import { BalanceService } from "@afriex/balance";
|
|
7
|
-
import { RateService } from "@afriex/rates";
|
|
8
|
-
import { CheckoutService } from "@afriex/checkout";
|
|
9
|
-
import { WebhookService } from "@afriex/webhooks";
|
|
10
|
-
import { MediaService } from "@afriex/media";
|
|
11
|
-
import { PaymentBatchService } from "@afriex/payment-batches";
|
|
12
|
-
import { SmeRegistrationService } from "@afriex/sme-registration";
|
|
13
|
-
export class AfriexSDK extends AfriexClient {
|
|
14
|
-
constructor(config) {
|
|
15
|
-
super({
|
|
16
|
-
...config,
|
|
17
|
-
userAgent: config.userAgent || `${DEFAULT_USER_AGENT}/${SDK_VERSION}`,
|
|
18
|
-
});
|
|
19
|
-
const httpClient = this.getHttpClient();
|
|
20
|
-
this.customers = new CustomerService(httpClient);
|
|
21
|
-
this.transactions = new TransactionService(httpClient);
|
|
22
|
-
this.paymentMethods = new PaymentMethodService(httpClient);
|
|
23
|
-
this.paymentBatches = new PaymentBatchService(httpClient);
|
|
24
|
-
this.balance = new BalanceService(httpClient);
|
|
25
|
-
this.rates = new RateService(httpClient);
|
|
26
|
-
this.checkout = new CheckoutService(httpClient);
|
|
27
|
-
this.media = new MediaService(httpClient);
|
|
28
|
-
this.smeRegistration = new SmeRegistrationService(httpClient);
|
|
29
|
-
this.webhooks = new WebhookService(httpClient, config.webhookPublicKey);
|
|
30
|
-
if (config.webhookPublicKey) {
|
|
31
|
-
this.webhookVerifier = this.webhooks;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Short alias
|
|
36
|
-
export { AfriexSDK as Afriex };
|
|
37
|
-
export { SDK_VERSION } from "./version.js";
|
|
38
|
-
// Re-export core types
|
|
39
|
-
export * from "@afriex/core";
|
|
40
|
-
// Re-export service classes explicitly to avoid conflicts
|
|
41
|
-
export { CustomerService } from "@afriex/customers";
|
|
42
|
-
export { TransactionService } from "@afriex/transactions";
|
|
43
|
-
export { PaymentMethodService } from "@afriex/payment-methods";
|
|
44
|
-
export { BalanceService } from "@afriex/balance";
|
|
45
|
-
export { RateService } from "@afriex/rates";
|
|
46
|
-
export { CheckoutService } from "@afriex/checkout";
|
|
47
|
-
export { WebhookVerifier, WebhookService } from "@afriex/webhooks";
|
|
48
|
-
export { MediaService } from "@afriex/media";
|
|
49
|
-
export { PaymentBatchService } from "@afriex/payment-batches";
|
|
50
|
-
export { SmeRegistrationService } from "@afriex/sme-registration";
|
|
51
|
-
export { WEBHOOK_SIGNATURE_HEADER } from "@afriex/webhooks";
|
|
52
|
-
// `TransactionStatus` is a value as well as a type, so it is exported as both.
|
|
53
|
-
export { TransactionStatus, DEFAULT_TRANSACTION_TYPE, } from "@afriex/transactions";
|
|
54
|
-
//# sourceMappingURL=index.js.map
|
package/dist/version.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The version of `@afriex/sdk`, sent in the `User-Agent` header.
|
|
3
|
-
*
|
|
4
|
-
* Kept equal to the version in package.json by `scripts/sync-sdk-version.mjs`,
|
|
5
|
-
* which runs as part of `pnpm run version`. Do not edit it by hand.
|
|
6
|
-
*/
|
|
7
|
-
export declare const SDK_VERSION = "5.0.0";
|
|
8
|
-
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The version of `@afriex/sdk`, sent in the `User-Agent` header.
|
|
3
|
-
*
|
|
4
|
-
* Kept equal to the version in package.json by `scripts/sync-sdk-version.mjs`,
|
|
5
|
-
* which runs as part of `pnpm run version`. Do not edit it by hand.
|
|
6
|
-
*/
|
|
7
|
-
export const SDK_VERSION = "5.0.0";
|
|
8
|
-
//# sourceMappingURL=version.js.map
|