@afriex/sdk 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,109 @@
1
+ # @afriex/sdk
2
+
3
+ Official TypeScript SDK for the Afriex Business API. A unified interface for all Afriex services.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @afriex/sdk
9
+ # or
10
+ pnpm add @afriex/sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { AfriexSDK } from '@afriex/sdk';
17
+ // or use the alias
18
+ import { Afriex } from '@afriex/sdk';
19
+
20
+ const afriex = new AfriexSDK({
21
+ apiKey: 'your-api-key',
22
+ environment: 'production', // or 'staging' (default: 'production')
23
+ webhookPublicKey: '-----BEGIN PUBLIC KEY-----...' // optional
24
+ });
25
+
26
+ // Customers
27
+ const customer = await afriex.customers.create({
28
+ fullName: 'John Doe',
29
+ email: 'john@example.com',
30
+ phone: '+1234567890',
31
+ countryCode: 'US'
32
+ });
33
+
34
+ // Payment Methods
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
+ }
45
+ });
46
+
47
+ // Transactions
48
+ const transaction = await afriex.transactions.create({
49
+ customerId: customer.customerId,
50
+ destinationAmount: 50000,
51
+ sourceCurrency: 'USD',
52
+ destinationCurrency: 'NGN',
53
+ destinationId: paymentMethod.paymentMethodId
54
+ });
55
+
56
+ // Rates
57
+ const rate = await afriex.rates.getRate('USD', 'NGN');
58
+
59
+ // Balance
60
+ const balances = await afriex.balance.getBalance({ currencies: ['USD', 'NGN'] });
61
+
62
+ // Webhook Verification (only if webhookPublicKey provided)
63
+ if (afriex.webhooks) {
64
+ const isValid = afriex.webhooks.verify(payload, signature);
65
+ }
66
+ ```
67
+
68
+ ## Available Services
69
+
70
+ | Service | Description |
71
+ | ----------------------- | -------------------------------------------- |
72
+ | `afriex.customers` | Customer CRUD and KYC management |
73
+ | `afriex.transactions` | Create and track transactions |
74
+ | `afriex.paymentMethods` | Bank, mobile money, crypto, virtual accounts |
75
+ | `afriex.balance` | Organization wallet balances |
76
+ | `afriex.rates` | Exchange rates and conversions |
77
+ | `afriex.webhooks` | Webhook signature verification (optional) |
78
+
79
+ ## Configuration
80
+
81
+ ```typescript
82
+ 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
86
+ }
87
+ ```
88
+
89
+ ## Individual Packages
90
+
91
+ For smaller bundle sizes, install packages individually:
92
+
93
+ | Package | Description |
94
+ | ------------------------- | ----------------------------- |
95
+ | `@afriex/core` | Base client and configuration |
96
+ | `@afriex/customers` | Customer management |
97
+ | `@afriex/transactions` | Transaction handling |
98
+ | `@afriex/payment-methods` | Payment methods |
99
+ | `@afriex/balance` | Balance queries |
100
+ | `@afriex/rates` | Exchange rates |
101
+ | `@afriex/webhooks` | Webhook verification |
102
+
103
+ ## Documentation
104
+
105
+ Full documentation available at [afriex-sdk-docs.vercel.app](https://afriex-sdk-docs.vercel.app)
106
+
107
+ ## License
108
+
109
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afriex/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Official TypeScript SDK for the Afriex Business API",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,13 +18,13 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@afriex/customers": "1.0.0",
22
- "@afriex/transactions": "1.0.0",
23
- "@afriex/core": "1.0.0",
24
- "@afriex/payment-methods": "1.0.0",
25
- "@afriex/balance": "1.0.0",
26
- "@afriex/rates": "1.0.0",
27
- "@afriex/webhooks": "1.0.0"
21
+ "@afriex/core": "1.0.2",
22
+ "@afriex/customers": "1.0.2",
23
+ "@afriex/transactions": "1.0.2",
24
+ "@afriex/payment-methods": "1.0.2",
25
+ "@afriex/balance": "1.0.2",
26
+ "@afriex/rates": "1.0.2",
27
+ "@afriex/webhooks": "1.0.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "rimraf": "^5.0.5",
@@ -35,7 +35,8 @@
35
35
  },
36
36
  "files": [
37
37
  "dist",
38
- "README.md"
38
+ "README.md",
39
+ "!dist/**/*.map"
39
40
  ],
40
41
  "publishConfig": {
41
42
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qBAAa,SAAU,SAAQ,YAAY;IACvC,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,YAAY,EAAE,kBAAkB,CAAC;IACjD,SAAgB,cAAc,EAAE,oBAAoB,CAAC;IACrD,SAAgB,OAAO,EAAE,cAAc,CAAC;IACxC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,QAAQ,CAAC,EAAE,eAAe,CAAC;gBAE/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