@afriex/sdk 1.2.0 → 2.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/README.md CHANGED
@@ -13,55 +13,62 @@ pnpm add @afriex/sdk
13
13
  ## Quick Start
14
14
 
15
15
  ```typescript
16
- import { AfriexSDK } from '@afriex/sdk';
16
+ import { AfriexSDK } from "@afriex/sdk";
17
17
  // or use the alias
18
- import { Afriex } from '@afriex/sdk';
18
+ import { Afriex } from "@afriex/sdk";
19
19
 
20
20
  const afriex = new AfriexSDK({
21
- apiKey: 'your-api-key',
22
- environment: 'production', // or 'staging' (default: 'production')
23
- webhookPublicKey: '-----BEGIN PUBLIC KEY-----...' // optional
21
+ apiKey: "your-api-key",
22
+ environment: "production", // or 'staging' (default: 'production')
23
+ webhookPublicKey: "-----BEGIN PUBLIC KEY-----...", // optional
24
24
  });
25
25
 
26
26
  // Customers
27
27
  const customer = await afriex.customers.create({
28
- fullName: 'John Doe',
29
- email: 'john@example.com',
30
- phone: '+1234567890',
31
- countryCode: 'US'
28
+ fullName: "John Doe",
29
+ email: "john@example.com",
30
+ phone: "+1234567890",
31
+ countryCode: "US",
32
32
  });
33
33
 
34
34
  // Payment Methods
35
35
  const paymentMethod = await afriex.paymentMethods.create({
36
- customerId: customer.customerId,
37
- channel: 'BANK_ACCOUNT',
38
- accountName: 'John Doe',
39
- accountNumber: '1234567890',
40
- countryCode: 'NG',
41
- institution: {
42
- institutionCode: '058',
43
- institutionName: 'GTBank'
44
- }
36
+ customerId: customer.customerId,
37
+ channel: "BANK_ACCOUNT",
38
+ accountName: "John Doe",
39
+ accountNumber: "1234567890",
40
+ countryCode: "NG",
41
+ institution: {
42
+ institutionCode: "058",
43
+ institutionName: "GTBank",
44
+ },
45
45
  });
46
46
 
47
47
  // Transactions
48
48
  const transaction = await afriex.transactions.create({
49
- customerId: customer.customerId,
50
- destinationAmount: 50000,
51
- sourceCurrency: 'USD',
52
- destinationCurrency: 'NGN',
53
- destinationId: paymentMethod.paymentMethodId
49
+ customerId: customer.customerId,
50
+ sourceAmount: "100",
51
+ destinationAmount: "50000",
52
+ sourceCurrency: "USD",
53
+ destinationCurrency: "NGN",
54
+ destinationId: paymentMethod.paymentMethodId,
55
+ meta: {
56
+ idempotencyKey: "quick-start-transaction-1",
57
+ reference: "order-123",
58
+ },
54
59
  });
55
60
 
56
61
  // Rates
57
- const rate = await afriex.rates.getRate('USD', 'NGN');
62
+ const rate = await afriex.rates.getRate("USD", "NGN");
58
63
 
59
64
  // Balance
60
- const balances = await afriex.balance.getBalance({ currencies: ['USD', 'NGN'] });
65
+ const balances = await afriex.balance.getBalance({
66
+ currencies: ["USD", "NGN"],
67
+ });
61
68
 
62
69
  // Webhook Verification (only if webhookPublicKey provided)
63
70
  if (afriex.webhooks) {
64
- const isValid = afriex.webhooks.verify(payload, signature);
71
+ const isValid = afriex.webhooks.verify(payload, signature);
65
72
  }
66
73
  ```
67
74
 
@@ -80,9 +87,9 @@ if (afriex.webhooks) {
80
87
 
81
88
  ```typescript
82
89
  interface AfriexSDKConfig {
83
- apiKey: string; // Required - Your Afriex API key
84
- environment?: 'staging' | 'production'; // Default: 'production'
85
- webhookPublicKey?: string; // Optional - Afriex's public key for webhooks
90
+ apiKey: string; // Required - Your Afriex API key
91
+ environment?: "staging" | "production"; // Default: 'production'
92
+ webhookPublicKey?: string; // Optional - Afriex's public key for webhooks
86
93
  }
87
94
  ```
88
95
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
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 { WebhookVerifier } from '@afriex/webhooks';
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";
8
9
  export interface AfriexSDKConfig extends AfriexConfig {
9
10
  webhookPublicKey?: string;
10
11
  }
@@ -14,22 +15,26 @@ export declare class AfriexSDK extends AfriexClient {
14
15
  readonly paymentMethods: PaymentMethodService;
15
16
  readonly balance: BalanceService;
16
17
  readonly rates: RateService;
17
- readonly webhooks?: WebhookVerifier;
18
+ readonly checkout: CheckoutService;
19
+ readonly webhooks: WebhookService;
20
+ readonly webhookVerifier?: WebhookService;
18
21
  constructor(config: AfriexSDKConfig);
19
22
  }
20
23
  export { AfriexSDK as Afriex };
21
- export * from '@afriex/core';
22
- export { CustomerService } from '@afriex/customers';
23
- export { TransactionService } from '@afriex/transactions';
24
- export { PaymentMethodService } from '@afriex/payment-methods';
25
- export { BalanceService } from '@afriex/balance';
26
- export { RateService } from '@afriex/rates';
27
- export { WebhookVerifier } from '@afriex/webhooks';
28
- export type { Customer, CreateCustomerRequest, UpdateCustomerKycRequest, ListCustomersParams, CustomerListResponse, } from '@afriex/customers';
29
- export type { Transaction, CreateTransactionRequest, ListTransactionsParams, TransactionListResponse, TransactionType, TransactionStatus, TransactionMeta, } from '@afriex/transactions';
30
- export type { PaymentMethod, CreatePaymentMethodRequest, ListPaymentMethodsParams, PaymentMethodListResponse, PaymentChannel, Institution, ResolveAccountParams, ResolveAccountResponse, GetInstitutionsParams, CryptoWalletResponse, GetCryptoWalletParams, GetVirtualAccountParams, } from '@afriex/payment-methods';
31
- export type { BalanceResponse, GetBalanceParams, } from '@afriex/balance';
32
- export type { RatesResponse, GetRatesParams, } from '@afriex/rates';
33
- export type { WebhookPayload, CustomerWebhookPayload, CustomerEventType, CustomerWebhookData, PaymentMethodWebhookPayload, PaymentMethodEventType, PaymentMethodWebhookData, TransactionWebhookPayload, TransactionEventType, TransactionWebhookData, TransactionWebhookStatus, } from '@afriex/webhooks';
34
- export { WEBHOOK_SIGNATURE_HEADER } from '@afriex/webhooks';
24
+ export * from "@afriex/core";
25
+ export { CustomerService } from "@afriex/customers";
26
+ export { TransactionService } from "@afriex/transactions";
27
+ export { PaymentMethodService } from "@afriex/payment-methods";
28
+ export { BalanceService } from "@afriex/balance";
29
+ export { RateService } from "@afriex/rates";
30
+ export { CheckoutService } from "@afriex/checkout";
31
+ export { WebhookVerifier, WebhookService } from "@afriex/webhooks";
32
+ export type { Customer, CreateCustomerRequest, UpdateCustomerKycRequest, ListCustomersParams, CustomerListResponse, } from "@afriex/customers";
33
+ export type { Transaction, CreateTransactionRequest, ListTransactionsParams, TransactionListResponse, TransactionListType, TransactionChannel, TransactionType, TransactionStatus, TransactionMeta, } from "@afriex/transactions";
34
+ export type { PaymentMethod, CreatePaymentMethodRequest, ListPaymentMethodsParams, PaymentMethodListResponse, PaymentChannel, Institution, ResolveAccountParams, ResolveAccountResponse, GetInstitutionsParams, CryptoWalletResponse, GetCryptoWalletParams, ListVirtualAccountsParams, CreateVirtualAccountParams, ListPoolAccountsParams, VirtualAccountListResponse, PoolAccountResponse, } from "@afriex/payment-methods";
35
+ export type { BalanceResponse, GetBalanceParams } from "@afriex/balance";
36
+ export type { RatesResponse, GetRatesParams } from "@afriex/rates";
37
+ export type { CheckoutSession, CreateCheckoutSessionRequest, CheckoutCustomer, CheckoutChannel, } from "@afriex/checkout";
38
+ export type { WebhookPayload, CustomerWebhookPayload, CustomerEventType, CustomerWebhookData, PaymentMethodWebhookPayload, PaymentMethodEventType, PaymentMethodWebhookData, TransactionWebhookPayload, TransactionEventType, TransactionWebhookData, TransactionWebhookStatus, CheckoutSessionWebhookPayload, CheckoutSessionEventType, CheckoutSessionWebhookData, TriggerWebhookRequest, WebhookEventType, } from "@afriex/webhooks";
39
+ export { WEBHOOK_SIGNATURE_HEADER } from "@afriex/webhooks";
35
40
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
- import { AfriexClient } 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 { WebhookVerifier } from '@afriex/webhooks';
1
+ import { AfriexClient } 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";
8
9
  export class AfriexSDK extends AfriexClient {
9
10
  constructor(config) {
10
11
  super(config);
@@ -14,21 +15,24 @@ export class AfriexSDK extends AfriexClient {
14
15
  this.paymentMethods = new PaymentMethodService(httpClient);
15
16
  this.balance = new BalanceService(httpClient);
16
17
  this.rates = new RateService(httpClient);
18
+ this.checkout = new CheckoutService(httpClient);
19
+ this.webhooks = new WebhookService(httpClient, config.webhookPublicKey);
17
20
  if (config.webhookPublicKey) {
18
- this.webhooks = new WebhookVerifier(config.webhookPublicKey);
21
+ this.webhookVerifier = this.webhooks;
19
22
  }
20
23
  }
21
24
  }
22
25
  // Short alias
23
26
  export { AfriexSDK as Afriex };
24
27
  // Re-export core types
25
- export * from '@afriex/core';
28
+ export * from "@afriex/core";
26
29
  // Re-export service classes explicitly to avoid conflicts
27
- export { CustomerService } from '@afriex/customers';
28
- export { TransactionService } from '@afriex/transactions';
29
- export { PaymentMethodService } from '@afriex/payment-methods';
30
- export { BalanceService } from '@afriex/balance';
31
- export { RateService } from '@afriex/rates';
32
- export { WebhookVerifier } from '@afriex/webhooks';
33
- export { WEBHOOK_SIGNATURE_HEADER } from '@afriex/webhooks';
30
+ export { CustomerService } from "@afriex/customers";
31
+ export { TransactionService } from "@afriex/transactions";
32
+ export { PaymentMethodService } from "@afriex/payment-methods";
33
+ export { BalanceService } from "@afriex/balance";
34
+ export { RateService } from "@afriex/rates";
35
+ export { CheckoutService } from "@afriex/checkout";
36
+ export { WebhookVerifier, WebhookService } from "@afriex/webhooks";
37
+ export { WEBHOOK_SIGNATURE_HEADER } from "@afriex/webhooks";
34
38
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afriex/sdk",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Official TypeScript SDK for the Afriex Business API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://afriex-sdk-docs.vercel.app",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/codewithveek/afriex_sdk.git",
11
+ "url": "https://github.com/Afri-exchange/afriex-sdk",
12
12
  "directory": "packages/sdk"
13
13
  },
14
14
  "author": "Victory Lucky <luckyvictory54@gmail.com>",
@@ -20,13 +20,14 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@afriex/core": "1.2.0",
24
- "@afriex/customers": "1.2.0",
25
- "@afriex/transactions": "1.2.0",
26
- "@afriex/payment-methods": "1.2.0",
27
- "@afriex/balance": "1.2.0",
28
- "@afriex/rates": "1.2.0",
29
- "@afriex/webhooks": "1.2.0"
23
+ "@afriex/core": "1.3.0",
24
+ "@afriex/customers": "1.4.0",
25
+ "@afriex/transactions": "1.4.0",
26
+ "@afriex/payment-methods": "2.0.0",
27
+ "@afriex/balance": "1.3.0",
28
+ "@afriex/rates": "1.4.0",
29
+ "@afriex/checkout": "2.0.0",
30
+ "@afriex/webhooks": "1.4.0"
30
31
  },
31
32
  "devDependencies": {
32
33
  "rimraf": "^5.0.5",