pawapay-sdk 0.1.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 +273 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1257 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# PawaPay SDK for Node.js
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://camo.githubusercontent.com/d0a69e9f739056676aa125e5d8cf86d739719451e104bc215e4f38cc12ae4919/68747470733a2f2f676c6f62616c2d75706c6f6164732e776562666c6f772e636f6d2f3632383234353931303135616133313466643330386466312f3634313162323635393665336465336635323535316330305f4c6f676f706177617061792d702d3530302e706e67" alt="pawaPay Logo" width="220"/>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>This SDK is a one-to-one mapping with the official <a href="https://docs.pawapay.io/v1/api-reference/">pawaPay API documentation</a>.</b><br/>
|
|
9
|
+
Please always refer to the official docs for the most up-to-date API details.<br/>
|
|
10
|
+
<a href="https://docs.pawapay.io/v1/api-reference/">https://docs.pawapay.io/v1/api-reference/</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
[](https://www.npmjs.com/package/pawapay-sdk)
|
|
14
|
+
[](https://www.npmjs.com/package/pawapay-sdk)
|
|
15
|
+
[](https://github.com/jonace-mpelule/pawapay-sdk)
|
|
16
|
+
[](https://github.com/jonace-mpelule/pawapay-sdk/issues)
|
|
17
|
+
[](https://github.com/jonace-mpelule/pawapay-sdk/commits/main)
|
|
18
|
+
|
|
19
|
+
A comprehensive TypeScript/JavaScript SDK for integrating with the pawaPay API, enabling seamless mobile money operations such as deposits, payouts, refunds, wallet balance checks, and more.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
- **Deposits**: Initiate, check status, and manage deposit transactions.
|
|
23
|
+
- **Payouts**: Send single or bulk payouts, check payout status, resend callbacks, and cancel enqueued payouts.
|
|
24
|
+
- **Refunds**: Request refunds, check refund status, and resend refund callbacks.
|
|
25
|
+
- **Wallets**: Retrieve wallet balances by country or overall.
|
|
26
|
+
- **Payment Pages**: Generate hosted payment pages for customer payments.
|
|
27
|
+
- **Toolkit**: Access configuration, available correspondents, correspondent prediction, and public keys.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
```bash
|
|
31
|
+
npm install pawapay-sdk
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Generating UUIDs for Transaction IDs
|
|
35
|
+
You can generate UUIDs for `depositId`, `payoutId`, and `refundId` using the [uuid](https://www.npmjs.com/package/uuid) package (version 4):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install uuid
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
43
|
+
|
|
44
|
+
const depositId = uuidv4();
|
|
45
|
+
const payoutId = uuidv4();
|
|
46
|
+
const refundId = uuidv4();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
```typescript
|
|
51
|
+
import { PawaPayClient } from 'pawapay-sdk';
|
|
52
|
+
|
|
53
|
+
const client = new PawaPayClient('YOUR_API_KEY', { environment: 'sandbox' });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API Reference & Examples
|
|
57
|
+
|
|
58
|
+
### Deposits
|
|
59
|
+
- **requestDeposit(data, options?)**: Initiate a deposit.
|
|
60
|
+
```typescript
|
|
61
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
62
|
+
const depositConfig = {
|
|
63
|
+
depositId: uuidv4(),
|
|
64
|
+
amount: '100.00',
|
|
65
|
+
currency: 'MWK',
|
|
66
|
+
country: 'MWI',
|
|
67
|
+
correspondent: 'AIRTEL_MWI',
|
|
68
|
+
payer: { type: 'MSISDN', address: { value: '265991234567' } },
|
|
69
|
+
customerTimestamp: new Date().toISOString(),
|
|
70
|
+
statementDescription: 'Payment for order 1234',
|
|
71
|
+
metadata: [{ fieldName: 'orderId', fieldValue: '1234' }]
|
|
72
|
+
};
|
|
73
|
+
const depositResponse = await client.requestDeposit(depositConfig);
|
|
74
|
+
```
|
|
75
|
+
- **checkDepositStatus(depositId, options?)**: Get status of a deposit.
|
|
76
|
+
```typescript
|
|
77
|
+
const statusResponse = await client.checkDepositStatus(depositConfig.depositId);
|
|
78
|
+
```
|
|
79
|
+
- **resendDepositCallback(depositId, options?)**: Resend deposit callback.
|
|
80
|
+
```typescript
|
|
81
|
+
const resendResponse = await client.resendDepositCallback(depositConfig.depositId);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Payouts
|
|
85
|
+
- **requestPayout(data, options?)**: Initiate a payout.
|
|
86
|
+
```typescript
|
|
87
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
88
|
+
const payoutConfig = {
|
|
89
|
+
payoutId: uuidv4(),
|
|
90
|
+
amount: '50.00',
|
|
91
|
+
currency: 'MWK',
|
|
92
|
+
correspondent: 'AIRTEL_MWI',
|
|
93
|
+
receipient: '265991234567',
|
|
94
|
+
customerTimestamp: new Date().toISOString(),
|
|
95
|
+
statementDescription: 'Payout for service',
|
|
96
|
+
country: 'MWI',
|
|
97
|
+
metadata: []
|
|
98
|
+
};
|
|
99
|
+
const payoutResponse = await client.requestPayout(payoutConfig);
|
|
100
|
+
```
|
|
101
|
+
- **checkPayoutStatus(payoutId, options?)**: Get payout status.
|
|
102
|
+
```typescript
|
|
103
|
+
const payoutStatus = await client.checkPayoutStatus(payoutConfig.payoutId);
|
|
104
|
+
```
|
|
105
|
+
- **resendPayoutCallback(payoutId, options?)**: Resend payout callback.
|
|
106
|
+
```typescript
|
|
107
|
+
const resendPayout = await client.resendPayoutCallback(payoutConfig.payoutId);
|
|
108
|
+
```
|
|
109
|
+
- **cancelEnqueuedPayout(payoutId, options?)**: Cancel an enqueued payout.
|
|
110
|
+
```typescript
|
|
111
|
+
const cancelResponse = await client.cancelEnqueuedPayout(payoutConfig.payoutId);
|
|
112
|
+
```
|
|
113
|
+
- **requestBulkPayout(data[], options?)**: Send multiple payouts in bulk.
|
|
114
|
+
```typescript
|
|
115
|
+
const bulkPayouts = [payoutConfig, { ...payoutConfig, payoutId: uuidv4() }];
|
|
116
|
+
const bulkResponse = await client.requestBulkPayout(bulkPayouts);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Refunds
|
|
120
|
+
- **requestRefund(refundConfig, options?)**: Request a refund.
|
|
121
|
+
```typescript
|
|
122
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
123
|
+
const refundConfig = {
|
|
124
|
+
refundId: uuidv4(),
|
|
125
|
+
depositId: depositConfig.depositId,
|
|
126
|
+
amount: '100.00',
|
|
127
|
+
metadata: [{ fieldName: 'reason', fieldValue: 'Customer request' }]
|
|
128
|
+
};
|
|
129
|
+
const refundResponse = await client.requestRefund(refundConfig);
|
|
130
|
+
```
|
|
131
|
+
- **checkRefundStatus(refundId, options?)**: Get refund status.
|
|
132
|
+
```typescript
|
|
133
|
+
const refundStatus = await client.checkRefundStatus(refundConfig.refundId);
|
|
134
|
+
```
|
|
135
|
+
- **resendRefundCallback(refundId, options?)**: Resend refund callback.
|
|
136
|
+
```typescript
|
|
137
|
+
const resendRefund = await client.resendRefundCallback(refundConfig.refundId);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Payment Pages
|
|
141
|
+
- **requestPaymentPage(payload, options?)**: Create a hosted payment page session.
|
|
142
|
+
```typescript
|
|
143
|
+
const payPageConfig = {
|
|
144
|
+
depositId: uuidv4(),
|
|
145
|
+
returnUrl: 'https://merchant.com/paymentProcessed',
|
|
146
|
+
statementDescription: 'Ticket purchase',
|
|
147
|
+
amount: '20.00',
|
|
148
|
+
msisdn: '265991234567',
|
|
149
|
+
language: 'EN',
|
|
150
|
+
country: 'MWI',
|
|
151
|
+
reason: 'Event ticket',
|
|
152
|
+
metadata: [{ fieldName: 'eventId', fieldValue: 'E123' }]
|
|
153
|
+
};
|
|
154
|
+
const payPageResponse = await client.requestPaymentPage(payPageConfig);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Wallets
|
|
158
|
+
- **checkWalletBalances(options?)**: Get all wallet balances.
|
|
159
|
+
```typescript
|
|
160
|
+
const walletBalances = await client.checkWalletBalances({});
|
|
161
|
+
```
|
|
162
|
+
- **checkWalletBalancesByCountry(country, options?)**: Get wallet balances for a specific country.
|
|
163
|
+
```typescript
|
|
164
|
+
const mwBalances = await client.checkWalletBalancesByCountry('MWI', {});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Toolkit
|
|
168
|
+
- **getActiveConfiguration(options?)**: Get merchant configuration and supported correspondents.
|
|
169
|
+
```typescript
|
|
170
|
+
const config = await client.getActiveConfiguration({});
|
|
171
|
+
```
|
|
172
|
+
- **getAvailableCorrespondent(options?)**: List available correspondents and their operational status.
|
|
173
|
+
```typescript
|
|
174
|
+
const correspondents = await client.getAvailableCorrespondent({});
|
|
175
|
+
```
|
|
176
|
+
- **predictCorrespondent(msisdn, options?)**: Predict the correct correspondent for a phone number.
|
|
177
|
+
```typescript
|
|
178
|
+
const prediction = await client.predictCorrespondent('265991234567', {});
|
|
179
|
+
```
|
|
180
|
+
- **getPublicKey(options?)**: Retrieve public keys for callback signature verification.
|
|
181
|
+
```typescript
|
|
182
|
+
const publicKeys = await client.getPublicKey({});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Error Handling
|
|
186
|
+
All methods return a `PawaPayResponse<T, E>` object:
|
|
187
|
+
```typescript
|
|
188
|
+
const response = await client.requestDeposit(depositConfig);
|
|
189
|
+
if (response.success) {
|
|
190
|
+
// Access response.data
|
|
191
|
+
console.log('Success:', response.data);
|
|
192
|
+
} else {
|
|
193
|
+
// Access response.error and response.status
|
|
194
|
+
console.error('Error:', response.error, 'Status:', response.status);
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Types
|
|
199
|
+
|
|
200
|
+
The following TypeScript types are exported by the `pawapay-sdk` package and can be imported for use in your own code:
|
|
201
|
+
|
|
202
|
+
- `PawaPayError`
|
|
203
|
+
- `DepositConfig`
|
|
204
|
+
- `DepositResponse`
|
|
205
|
+
- `RequestPayoutConfig`
|
|
206
|
+
- `RequestBulkPayoutConfig`
|
|
207
|
+
- `RequestPayPageConfig`
|
|
208
|
+
- `RequestRefundConfig`
|
|
209
|
+
- `WalletBalance`
|
|
210
|
+
- `PawaPayResponse<T, E>`
|
|
211
|
+
- `BaseRequestPayoutResponse`
|
|
212
|
+
- `RequestBulkPayoutResponse`
|
|
213
|
+
- `RequestPayPageResponse`
|
|
214
|
+
- `RequestRefundResponse`
|
|
215
|
+
- `WalletBalanceResponse`
|
|
216
|
+
- `DepositCallback`
|
|
217
|
+
- `PayoutCallback`
|
|
218
|
+
- `RefundCallback`
|
|
219
|
+
- `PayPageCallback`
|
|
220
|
+
|
|
221
|
+
**Example:**
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import { DepositConfig, PawaPayResponse, PawaPayError } from "pawapay-sdk";
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
- **checkWalletBalancesByCountry(country, options?)**: Get wallet balances for a specific country.
|
|
228
|
+
```typescript
|
|
229
|
+
const mwBalances = await client.checkWalletBalancesByCountry('MWI', {});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Toolkit
|
|
233
|
+
- **getActiveConfiguration(options?)**: Get merchant configuration and supported correspondents.
|
|
234
|
+
```typescript
|
|
235
|
+
const config = await client.getActiveConfiguration({});
|
|
236
|
+
```
|
|
237
|
+
- **getAvailableCorrespondent(options?)**: List available correspondents and their operational status.
|
|
238
|
+
```typescript
|
|
239
|
+
const correspondents = await client.getAvailableCorrespondent({});
|
|
240
|
+
```
|
|
241
|
+
- **predictCorrespondent(msisdn, options?)**: Predict the correct correspondent for a phone number.
|
|
242
|
+
```typescript
|
|
243
|
+
const prediction = await client.predictCorrespondent('265991234567', {});
|
|
244
|
+
```
|
|
245
|
+
- **getPublicKey(options?)**: Retrieve public keys for callback signature verification.
|
|
246
|
+
```typescript
|
|
247
|
+
const publicKeys = await client.getPublicKey({});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Error Handling
|
|
251
|
+
All methods return a `PawaPayResponse<T, E>` object:
|
|
252
|
+
```typescript
|
|
253
|
+
const response = await client.requestDeposit(depositConfig);
|
|
254
|
+
if (response.success) {
|
|
255
|
+
// Access response.data
|
|
256
|
+
console.log('Success:', response.data);
|
|
257
|
+
} else {
|
|
258
|
+
// Access response.error and response.status
|
|
259
|
+
console.error('Error:', response.error, 'Status:', response.status);
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Environments
|
|
264
|
+
- `sandbox`: For testing and development
|
|
265
|
+
- `live`: For production use
|
|
266
|
+
|
|
267
|
+
## Connect
|
|
268
|
+
- [Twitter](https://x.com/jonacempelule_)
|
|
269
|
+
- [LinkedIn](https://linkedin.com/in/jonacempelule)
|
|
270
|
+
- [GitHub](https://github.com/jonace-mpelule)
|
|
271
|
+
|
|
272
|
+
## License
|
|
273
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var l=Object.create;var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var i=(s,e)=>u(s,"name",{value:e,configurable:!0});var q=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},c=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of h(e))!y.call(s,a)&&a!==t&&u(s,a,{get:()=>e[a],enumerable:!(r=d(e,a))||r.enumerable});return s};var m=(s,e,t)=>(t=s!=null?l(p(s)):{},c(e||!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),T=s=>c(u({},"__esModule",{value:!0}),s);var b={};q(b,{PawaPayClient:()=>o});module.exports=T(b);var n=m(require("axios"),1);var o=class{static{i(this,"PawaPayClient")}apiClient;apiKey;config;constructor(e,t){this.apiKey=e,this.config=t,this.apiClient=n.default.create({baseURL:t?.overrideUrl??t?.environment=="live"?"https://api.pawapay.io":"https://api.sandbox.pawapay.io",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}})}async request(e,t){try{let r=await this.apiClient.request(e);return{success:!0,data:r.data,status:r.status,headers:r.headers}}catch(r){return n.default.isAxiosError(r)?{success:!1,error:r.response?.data||r.message,status:r.response?.status||500}:{success:!1,error:{errorMessage:"Unknown error occurred"},status:500}}}async requestDeposit(e,{options:t}={}){return this.request({method:"POST",url:"/deposits",data:e},t)}async checkDepositStatus(e,{options:t}={}){return this.request({method:"GET",url:`/deposits/${e}`},t)}async resendDepositCallback(e,{options:t}={}){var r={depositId:e};return this.request({method:"POST",url:"/deposits/resend-callback",data:r},t)}async requestPayout(e,{options:t}={}){return this.request({method:"POST",url:"/payouts",data:e},t)}async checkPayoutStatus(e,{options:t}={}){return this.request({method:"GET",url:`/payouts/${e}`},t)}async resendPayoutCallback(e,{options:t}={}){let r={payoutId:e};return this.request({method:"POST",url:"/payouts/resend-callback",data:r},t)}async cancelEnqueuedPayout(e,{options:t}={}){return this.request({method:"POST",url:`/payouts/fail-enqueued/${e}`},t)}async requestBulkPayout(e,{options:t}={}){return this.request({method:"POST",url:"/payouts/bulk",data:e},t)}async requestRefund(e,{options:t}={}){return this.request({method:"POST",url:"/refunds",data:e},t)}async checkRefundStatus(e,{options:t}={}){return this.request({method:"GET",url:`/refunds/${e}`},t)}async resendRefundCallback(e,{options:t}={}){return this.request({method:"POST",url:"/refund/resend-callback",data:{refundId:e}},t)}async requestPaymentPage(e,{options:t}={}){return this.request({method:"POST",url:"/v1/widget/sessions",data:e})}async checkWalletBalances({options:e}={}){return this.request({method:"GET",url:"/v1/wallet-balances"},e)}async checkWalletBalancesByCountry(e,{options:t}={}){return this.request({method:"GET",url:`/v1/wallet-balances/${e}`})}async getActiveConfiguration({options:e}={}){return this.request({method:"GET",url:"/active-conf"},e)}async getAvailableCorrespondent({options:e}={}){return this.request({method:"GET",url:"/availability"},e)}redictCorrespondent(e,{options:t}={}){let r={msisdn:e};return this.request({method:"GET",url:"/v1/predict-correspondent",data:r},t)}getPublicKey({options:e}={}){return this.request({method:"GET",url:"/public-key/https"},e)}};0&&(module.exports={PawaPayClient});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts"],"sourcesContent":["export * from \"./client.ts\"\nexport type {\n PawaPayError,\n DepositConfig,\n DepositResponse,\n RequestPayPageConfig,\n RequestPayPageResponse,\n RequestRefundConfig,\n RequestRefundResponse,\n WalletBalance,\n ActiveConfigurationResponse,\n AvailableCorrespondentResponse,\n PredictCorrespondentResponse,\n PublicKeysResponse,\n ResendDepositResponse,\n PayoutCallback,\n PawaPayResponse,\n RequestOptions,\n DepositStatus,\n ResendRefundCallbackResponse,\n RequestPayoutConfig,\n RequestPayoutRespose,\n CheckPayoutStatusResponse,\n CancelEnqueuedPayoutResponse,\n RequestBulkPayoutConfig,\n RequestBuildPayoutResponse,\n ResendPayoutCallbackResponse,\n RefundCallback,\n CheckRefundStatusResponse\n} from \"./types/index.t.ts\"","import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\nimport {\n DepositConfig,\n PawaPayError,\n DepositResponse,\n PawaPayResponse,\n RequestOptions,\n DepositStatus,\n ResendDepositResponse,\n WalletBalance,\n PublicKeysResponse,\n ActiveConfigurationResponse,\n AvailableCorrespondentResponse,\n PredictCorrespondentResponse,\n RequestPayPageConfig,\n RequestPayPageResponse,\n RequestRefundConfig,\n RequestRefundResponse,\n ResendRefundCallbackResponse,\n RequestPayoutConfig,\n RequestPayoutRespose,\n CheckPayoutStatusResponse,\n CancelEnqueuedPayoutResponse,\n RequestBulkPayoutConfig,\n RequestBuildPayoutResponse,\n ResendPayoutCallbackResponse,\n CheckRefundStatusResponse\n} from './types/index.t.ts';\n\ntype Args = {\n options?: RequestOptions;\n};\n\ntype ClientConfig = {\n environment?: \"live\" | \"sandbox\",\n overrideUrl?: string\n}\n\nexport class PawaPayClient {\n private apiClient: AxiosInstance;\n protected apiKey: string;\n private config?: ClientConfig;\n\n constructor(apiKey: string, config?: ClientConfig,) {\n this.apiKey = apiKey;\n this.config = config\n this.apiClient = axios.create({\n baseURL: config?.overrideUrl ?? config?.environment == \"live\" ? 'https://api.pawapay.io' : 'https://api.sandbox.pawapay.io',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.apiKey}`\n }\n });\n }\n\n private async request<T, E>(config: AxiosRequestConfig, options?: RequestOptions)\n : Promise<PawaPayResponse<T, E>> {\n try {\n const response = await this.apiClient.request<T>(config);\n return {\n success: true,\n data: response.data,\n status: response.status,\n headers: response.headers\n }\n } catch (error) {\n if (axios.isAxiosError(error)) {\n return {\n success: false,\n error: error.response?.data || error.message,\n status: error.response?.status || 500\n }\n }\n return {\n success: false,\n error: {\n errorMessage: 'Unknown error occurred'\n } as E,\n status: 500\n };\n }\n }\n\n // --- Deposits\n\n async requestDeposit(data: DepositConfig, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<DepositResponse, PawaPayError>> {\n\n return this.request({\n method: 'POST',\n url: '/deposits',\n data,\n }, options)\n }\n\n\n async checkDepositStatus(depositId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<DepositStatus[], PawaPayError>> {\n return this.request({\n method: 'GET',\n url: `/deposits/${depositId}`\n }, options)\n }\n\n async resendDepositCallback(depositId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<ResendDepositResponse, PawaPayError>> {\n var data = { depositId }\n return this.request({\n method: 'POST',\n url: '/deposits/resend-callback',\n data,\n }, options)\n }\n\n // --- PAYOUTS\n\n async requestPayout(data: RequestPayoutConfig, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<RequestPayoutRespose, PawaPayError>> {\n return this.request({\n method: 'POST',\n url: '/payouts',\n data\n }, options)\n }\n\n async checkPayoutStatus(payoutId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<CheckPayoutStatusResponse[], PawaPayError>> {\n return this.request({\n method: 'GET',\n url: `/payouts/${payoutId}`\n }, options)\n }\n\n async resendPayoutCallback(payoutId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<ResendPayoutCallbackResponse, PawaPayError>> {\n const data = { payoutId }\n return this.request({\n method: 'POST',\n url: '/payouts/resend-callback',\n data\n }, options)\n }\n\n async cancelEnqueuedPayout(payoutId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<CancelEnqueuedPayoutResponse, PawaPayError>> {\n return this.request({\n method: 'POST',\n url: `/payouts/fail-enqueued/${payoutId}`,\n }, options)\n }\n\n async requestBulkPayout(data: RequestBulkPayoutConfig[], { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<RequestBuildPayoutResponse[], PawaPayError>> {\n return this.request({\n method: 'POST',\n url: '/payouts/bulk',\n data,\n }, options)\n }\n\n // --- REFUND\n async requestRefund(refundConfig: RequestRefundConfig, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<RequestRefundResponse, PawaPayError>> {\n return this.request({\n method: \"POST\",\n url: '/refunds',\n data: refundConfig\n }, options)\n }\n\n async checkRefundStatus(refundId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<CheckRefundStatusResponse[], PawaPayError>> {\n return this.request({\n method: 'GET',\n url: `/refunds/${refundId}`\n }, options)\n }\n\n async resendRefundCallback(refundId: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<ResendRefundCallbackResponse, PawaPayError>> {\n return this.request({\n method: 'POST',\n url: '/refund/resend-callback',\n data: { refundId }\n }, options)\n }\n\n // --- PAYMENT PAGE\n\n async requestPaymentPage(payload: RequestPayPageConfig, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<RequestPayPageResponse, PawaPayError>> {\n return this.request({\n method: 'POST',\n url: '/v1/widget/sessions',\n data: payload\n })\n }\n\n // --- WALLETS\n\n async checkWalletBalances({ options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<WalletBalance, PawaPayError>> {\n return this.request({\n method: 'GET',\n url: '/v1/wallet-balances'\n }, options)\n }\n\n async checkWalletBalancesByCountry(country: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<WalletBalance, PawaPayError>> {\n return this.request({\n method: 'GET',\n url: `/v1/wallet-balances/${country}`\n })\n }\n\n // --- TOOLKIT\n\n async getActiveConfiguration({ options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<ActiveConfigurationResponse, PawaPayError>> {\n return this.request({\n method: `GET`,\n url: `/active-conf`\n }, options)\n }\n\n async getAvailableCorrespondent({ options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<AvailableCorrespondentResponse[], PawaPayError>> {\n return this.request({\n method: 'GET',\n url: '/availability'\n }, options)\n }\n\n redictCorrespondent(msisdn: string, { options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<PredictCorrespondentResponse, PawaPayError>> {\n const data = { msisdn }\n return this.request({\n method: 'GET',\n url: '/v1/predict-correspondent',\n data\n }, options)\n }\n\n getPublicKey({ options }: { options?: RequestOptions } = {})\n : Promise<PawaPayResponse<PublicKeysResponse[], PawaPayError>> {\n return this.request({\n method: 'GET',\n url: '/public-key/https'\n }, options)\n }\n}"],"mappings":"gmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAyD,sBAsClD,IAAMC,EAAN,KAAMA,CAtCb,MAsCaA,CAAAA,EAAAA,sBACDC,UACEC,OACFC,OAERC,YAAYF,EAAgBC,EAAwB,CAChD,KAAKD,OAASA,EACd,K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IAAK,0BACLR,KAAM,CAAEqB,SAAAA,CAAS,CACrB,EAAGxB,CAAAA,CACP,CAIA,MAAM0B,mBAAmBC,EAA+B,CAAE3B,QAAAA,CAAO,EAAmC,CAAC,EAChC,CACjE,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,OACRC,IAAK,sBACLR,KAAMwB,CACV,CAAA,CACJ,CAIA,MAAMC,oBAAoB,CAAE5B,QAAAA,CAAO,EAAmC,CAAC,EACX,CACxD,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,MACRC,IAAK,qBACT,EAAGX,CAAAA,CACP,CAEA,MAAM6B,6BAA6BC,EAAiB,CAAE9B,QAAAA,CAAO,EAAmC,CAAC,EACrC,CACxD,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,MACRC,IAAK,uBAAuBmB,CAAAA,EAChC,CAAA,CACJ,CAIA,MAAMC,uBAAuB,CAAE/B,QAAAA,CAAO,EAAmC,CAAC,EACA,CACtE,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,MACRC,IAAK,cACT,EAAGX,CAAAA,CACP,CAEA,MAAMgC,0BAA0B,CAAEhC,QAAAA,CAAO,EAAmC,CAAC,EACE,CAC3E,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,MACRC,IAAK,eACT,EAAGX,CAAAA,CACP,CAEAiC,oBAAoBC,EAAgB,CAAElC,QAAAA,CAAO,EAAmC,CAAC,EACN,CACvE,IAAMG,EAAO,CAAE+B,OAAAA,CAAO,EACtB,OAAO,KAAKnC,QAAQ,CAChBW,OAAQ,MACRC,IAAK,4BACLR,KAAAA,CACJ,EAAGH,CAAAA,CACP,CAEAmC,aAAa,CAAEnC,QAAAA,CAAO,EAAmC,CAAC,EACS,CAC/D,OAAO,KAAKD,QAAQ,CAChBW,OAAQ,MACRC,IAAK,mBACT,EAAGX,CAAAA,CACP,CACJ","names":["index_exports","__export","PawaPayClient","__toCommonJS","import_axios","PawaPayClient","apiClient","apiKey","config","constructor","axios","create","baseURL","overrideUrl","environment","headers","request","options","response","success","data","status","error","isAxiosError","message","errorMessage","requestDeposit","method","url","checkDepositStatus","depositId","resendDepositCallback","requestPayout","checkPayoutStatus","payoutId","resendPayoutCallback","cancelEnqueuedPayout","requestBulkPayout","requestRefund","refundConfig","checkRefundStatus","refundId","resendRefundCallback","requestPaymentPage","payload","checkWalletBalances","checkWalletBalancesByCountry","country","getActiveConfiguration","getAvailableCorrespondent","redictCorrespondent","msisdn","getPublicKey"]}
|