pawapay-sdk 0.1.5 → 1.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/dist/index.d.cts CHANGED
@@ -1,437 +1,1182 @@
1
+ //#region src/types/v2/deposits.t.d.ts
2
+ type BaseDepositStatusReponse = {
3
+ status: "FOUND";
4
+ data: {
5
+ status: string;
6
+ };
7
+ };
8
+ type DepositStatusNotFoundResponse = BaseDepositStatusReponse & {
9
+ status: "NOT_FOUND";
10
+ data: null;
11
+ };
12
+ type DepositStatusAcceptedReponse = BaseDepositStatusReponse & {
13
+ status: "FOUND";
14
+ data: {
15
+ depositId: string;
16
+ status: "ACCEPTED";
17
+ amount: string;
18
+ currency: string;
19
+ country: string;
20
+ payer: {
21
+ type: string;
22
+ accountDetails: {
23
+ phoneNUmber: string;
24
+ provider: string;
25
+ };
26
+ };
27
+ customerMessage: string;
28
+ clientReferenceId: string;
29
+ created: string;
30
+ metadata: object;
31
+ };
32
+ };
33
+ type DepositStatusProcessingReponse = BaseDepositStatusReponse & {
34
+ status: "FOUND";
35
+ data: {
36
+ depositId: string;
37
+ status: "PROCESSING";
38
+ amount: string;
39
+ currency: string;
40
+ country: string;
41
+ payer: {
42
+ type: string;
43
+ accountDetails: {
44
+ phoneNUmber: string;
45
+ provider: string;
46
+ };
47
+ };
48
+ customerMessage: string;
49
+ clientReferenceId: string;
50
+ created: string;
51
+ metadata: object;
52
+ };
53
+ };
54
+ type DepositStatusInReconciliationReponse = BaseDepositStatusReponse & {
55
+ status: "FOUND";
56
+ data: {
57
+ depositId: string;
58
+ status: "IN_RECONCILIATION";
59
+ amount: string;
60
+ currency: string;
61
+ country: string;
62
+ payer: {
63
+ type: string;
64
+ accountDetails: {
65
+ phoneNUmber: string;
66
+ provider: string;
67
+ };
68
+ };
69
+ customerMessage: string;
70
+ clientReferenceId: string;
71
+ created: string;
72
+ metadata: object;
73
+ };
74
+ };
75
+ type DepositStatusFailedReponse = BaseDepositStatusReponse & {
76
+ status: "FOUND";
77
+ data: {
78
+ depositId: string;
79
+ status: "FAILED";
80
+ amount: string;
81
+ currency: string;
82
+ country: string;
83
+ payer: {
84
+ type: string;
85
+ accountDetails: {
86
+ phoneNUmber: string;
87
+ provider: string;
88
+ };
89
+ };
90
+ customerMessage: string;
91
+ clientReferenceId: string;
92
+ created: string;
93
+ failureReason: {
94
+ failureCode: string;
95
+ failureMessage: string;
96
+ };
97
+ metadata: object;
98
+ };
99
+ };
100
+ type DepositStatusResponse_v2 = DepositStatusNotFoundResponse | DepositStatusAcceptedReponse | DepositStatusProcessingReponse | DepositStatusInReconciliationReponse | DepositStatusFailedReponse;
101
+ type DepositCallBack_v2 = {
102
+ /**
103
+ * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
104
+ * Required string length: 36
105
+ * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
106
+ */
107
+ depositId: string;
108
+ /**
109
+ * @description The final status of the payment.
110
+ * COMPLETED - The payment has been successfully processed.
111
+ * PROCESSING - Only sent for providers with authorisation type REDIRECT_AUTH. See auhtorizationUrl.
112
+ * FAILED - The payment request has been proceessed, but failed.
113
+ * Available options: `COMPLETED`, `FAILED`, `PROCESSING`
114
+ */
115
+ status: "COMPLETED" | "PROCESSING" | "FAILED";
116
+ amount: string;
117
+ /**
118
+ * @description The currency in which the amount is specified.
119
+ *
120
+ * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
121
+ *
122
+ * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
123
+ *
124
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
125
+ *
126
+ * @example Example: "MWK"
127
+ */
128
+ currency: string;
129
+ /**
130
+ * The country in which the payment was initiated.
131
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes | Wikipedia}.
132
+ *
133
+ * Required string length: 3
134
+ *
135
+ * @example "MWK"
136
+ */
137
+ country: string;
138
+ payer: {
139
+ type: "MMO";
140
+ accountDetails: {
141
+ phoneNumber: "260763456789";
142
+ provider: "MTN_MOMO_ZMB";
143
+ };
144
+ };
145
+ created: "2020-02-21T17:32:29Z";
146
+ customerMessage: "Note of 4 to 22 chars";
147
+ providerTransactionId: "ABC123";
148
+ failureReason: {
149
+ failureCode: "INSUFFICIENT_BALANCE";
150
+ failureMessage: "The customer does not have enough funds to complete this payment.";
151
+ };
152
+ metadata: {
153
+ orderId: "ORD-123456789";
154
+ customerId: "customer@email.com";
155
+ };
156
+ };
157
+ type DepositConfig_v2 = {
158
+ depositId: string;
159
+ payer: {
160
+ type: "MMO";
161
+ accountDetails: {
162
+ phoneNumber: string;
163
+ provider: string;
164
+ };
165
+ };
166
+ amount: string;
167
+ currency: string;
168
+ preAuthorisationCode?: string;
169
+ clientReferenceId?: string;
170
+ customerMessage?: string;
171
+ metadata: object[];
172
+ };
173
+ type BaseDepositResponse = {
174
+ depositId: string;
175
+ status: string;
176
+ };
177
+ type AcceptedDepositResponse = BaseDepositResponse & {
178
+ status: "ACCEPTED";
179
+ created: string;
180
+ };
181
+ type DepositIgnoredResponse = BaseDepositResponse & {
182
+ status: "DUPLICATE_IGNORED";
183
+ created: string;
184
+ };
185
+ type ProviderTemporaryUnavailableResponse = BaseDepositResponse & {
186
+ status: "REJECTED";
187
+ failureReason: {
188
+ failureCode: "PROVIDER_TEMPORARILY_UNAVAILABLE";
189
+ failureMessage: string;
190
+ };
191
+ };
192
+ type InvalidPhoneNumberResponse = BaseDepositResponse & {
193
+ status: "REJECTED";
194
+ failureReason: {
195
+ failureCode: "INVALID_PHONE_NUMBER";
196
+ failureMessage: string;
197
+ };
198
+ };
199
+ type InvalidCurrencyResponse = BaseDepositResponse & {
200
+ status: "REJECTED";
201
+ failureReason: {
202
+ failureCode: "INVALID_CURRENCY";
203
+ failureMessage: string;
204
+ };
205
+ };
206
+ type InvalidAmountResponse = BaseDepositResponse & {
207
+ status: "REJECTED";
208
+ failureReason: {
209
+ failureCode: "INVALID_AMOUNT";
210
+ failureMessage: string;
211
+ };
212
+ };
213
+ type AmountOutOfBoundsResponse = BaseDepositResponse & {
214
+ status: "REJECTED";
215
+ failureReason: {
216
+ failureCode: "AMOUNT_OUT_OF_BOUNDS";
217
+ failureMessage: string;
218
+ };
219
+ };
220
+ type DepositResponse_v2 = AcceptedDepositResponse | DepositIgnoredResponse | ProviderTemporaryUnavailableResponse | InvalidPhoneNumberResponse | InvalidCurrencyResponse | InvalidAmountResponse | AmountOutOfBoundsResponse;
221
+ type BaseDepositResendCallbackResponse = {
222
+ depositId: string;
223
+ status: string;
224
+ };
225
+ type DepositResendCallbackAcceptedResponse = BaseDepositResendCallbackResponse & {
226
+ status: "ACCEPTED";
227
+ };
228
+ type DepositResendCallbackInvalidStateResponse = BaseDepositResendCallbackResponse & {
229
+ status: "REJECTED";
230
+ failureReason: {
231
+ failureCode: "INVALID_STATE";
232
+ failureMessage: string;
233
+ };
234
+ };
235
+ type DepositResendCallbackNotFoundResponse = BaseDepositResendCallbackResponse & {
236
+ status: "REJECTED";
237
+ failureReason: {
238
+ failureCode: "NOT_FOUND";
239
+ failureMessage: string;
240
+ };
241
+ };
242
+ type ResendDepositCallbackResponse_v2 = DepositResendCallbackAcceptedResponse | DepositResendCallbackInvalidStateResponse | DepositResendCallbackNotFoundResponse;
243
+ //#endregion
244
+ //#region src/types/index.t.d.ts
245
+ /** biome-ignore-all lint/suspicious/noExplicitAny: <'can use any'> */
1
246
  interface PawaPayResponse<T = any, E = any> {
2
- success: boolean;
3
- data?: T;
4
- status?: number;
5
- error?: E;
6
- headers?: any;
247
+ success: boolean;
248
+ data?: T;
249
+ status?: number;
250
+ error?: E;
251
+ headers?: any;
7
252
  }
8
253
  interface RequestOptions {
9
- timeout?: number;
10
- headers?: Record<string, string>;
254
+ timeout?: number;
255
+ headers?: Record<string, string>;
11
256
  }
12
257
  type DepositConfig = {
13
- /**
14
- * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
15
- * Required string length: 36
16
- * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
17
- */
18
- depositId: string;
19
- /**
20
- * @description The amount to be collected (deposit) or disbursed (payout or refund).
21
- *
22
- * Amount must follow below requirements or the request will be rejected:
23
- *
24
- * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
25
- * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
26
- * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
27
- * Trailing zeroes are permitted.
28
- *
29
- * Valid examples:
30
- *
31
- * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
32
- *
33
- * Not valid examples:
34
- *
35
- * @ 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
36
- *
37
- * Required string length: 1 - 23
38
- *
39
- * @example Example: "15"
40
-
41
- */
42
- amount: string;
43
- /**
44
- * @description The currency in which the amount is specified.
45
- *
46
- * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
47
- *
48
- * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
49
- *
50
- * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
51
- *
52
- * @example Example: "MWK"
53
- */
54
- currency: string;
55
- /**
56
- * @description The country in which the MMO operates.
57
- *
58
- * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
59
- *
60
- * @example Example: "MWI"
61
- */
62
- country?: string;
63
- /**
64
- * @description The correspondent code refers to the specific MMO that the specified phone number (MSISDN) has an active mobile money wallet with.
65
- *
66
- * You can find all the supported correspondents {@link https://docs.pawapay.io/using_the_api#correspondents | listed here}.
67
- *
68
- * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account.
69
- *
70
- * You can use the {@link https://docs.pawapay.io/v1/api-reference/toolkit/predict-correspondent | predict correspondent} enpoint to predict the correct correspondent to use based on the phone number (MSISDN).
71
- *
258
+ /**
259
+ * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
260
+ * Required string length: 36
261
+ * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
262
+ */
263
+ depositId: string;
264
+ /**
265
+ * @description The amount to be collected (deposit) or disbursed (payout or refund).
266
+ *
267
+ * Amount must follow below requirements or the request will be rejected:
268
+ *
269
+ * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
270
+ * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
271
+ * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
272
+ * Trailing zeroes are permitted.
273
+ *
274
+ * Valid examples:
275
+ *
276
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
277
+ *
278
+ * Not valid examples:
279
+ *
280
+ * @ 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
281
+ *
282
+ * Required string length: 1 - 23
283
+ *
284
+ * @example Example: "15"
285
+ */
286
+ amount: string;
287
+ /**
288
+ * @description The currency in which the amount is specified.
289
+ *
290
+ * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
291
+ *
292
+ * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
293
+ *
294
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
295
+ *
296
+ * @example Example: "MWK"
297
+ */
298
+ currency: string;
299
+ /**
300
+ * @description The country in which the MMO operates.
301
+ *
302
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
303
+ *
304
+ * @example Example: "MWI"
305
+ */
306
+ country?: string;
307
+ /**
308
+ * @description The correspondent code refers to the specific MMO that the specified phone number (MSISDN) has an active mobile money wallet with.
309
+ *
310
+ * You can find all the supported correspondents {@link https://docs.pawapay.io/using_the_api#correspondents | listed here}.
311
+ *
312
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account.
313
+ *
314
+ * You can use the {@link https://docs.pawapay.io/v1/api-reference/toolkit/predict-correspondent | predict correspondent} enpoint to predict the correct correspondent to use based on the phone number (MSISDN).
315
+ *
316
+ * @example
317
+ * Example: "AIRTEL_MWI"
318
+ */
319
+ correspondent: string;
320
+ /**
321
+ * @description The phone number (MSISDN) of the recipient or payer must be specified as the `value` of the `address`.
322
+ */
323
+ payer: {
324
+ /** @description The type of financial address. At the moment, only MSISDN is supported as the financial address.
72
325
  * @example
73
- * Example: "AIRTEL_MWI"
74
- */
75
- correspondent: string;
76
- /**
77
- * @description The phone number (MSISDN) of the recipient or payer must be specified as the `value` of the `address`.
326
+ * {
327
+ * type: "MSISDN"
328
+ * }
78
329
  */
79
- payer: {
80
- /** @description The type of financial address. At the moment, only MSISDN is supported as the financial address.
81
- * @example
82
- * {
83
- * type: "MSISDN"
84
- * }
85
- */
86
- type: "MSISDN" & string;
87
- /**
88
- * @description The phone number (MSISDN) of the payer or recipient.
89
- *
90
- * The format is described in {@link https://en.wikipedia.org/wiki/MSISDN | Wikipedia}.
91
- *
92
- * MSISDN validation has following rules:
93
- *
94
- * - Only digits without whitespaces or any other separators or prefixes like '+'
95
- * - Should not start with zero.
96
- * - Country code is mandatory.
97
- * - Should not exceed or be less than the valid length of specified country.
98
- * - Valid examples for Malawi: 265999123456
99
- *
100
- * Not valid examples for Malawi:
101
- * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
102
- *
103
- * @example {value: "265 999 123 678"}
104
- *
105
- */
106
- address: {
107
- value: string;
108
- };
109
- };
330
+ type: "MSISDN" & string;
110
331
  /**
111
- * @description The timestamp of when the deposit was created in the pawaPay platform.
332
+ * @description The phone number (MSISDN) of the payer or recipient.
112
333
  *
113
- * Format defined by 'date-time' in RFC3339 section 5.6 from {@link https://tools.ietf.org/html/rfc3339#section-5.6 | IETF}
334
+ * The format is described in {@link https://en.wikipedia.org/wiki/MSISDN | Wikipedia}.
114
335
  *
115
- * @example Example:"2020-02-21T17:32:28Z"
116
- */
117
- customerTimestamp: string;
118
- /**
119
- * @description Short description for the transaction.
336
+ * MSISDN validation has following rules:
120
337
  *
121
- * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
338
+ * - Only digits without whitespaces or any other separators or prefixes like '+'
339
+ * - Should not start with zero.
340
+ * - Country code is mandatory.
341
+ * - Should not exceed or be less than the valid length of specified country.
342
+ * - Valid examples for Malawi: 265999123456
122
343
  *
123
- * Must be between 4 and 22 alphanumeric characters.
344
+ * Not valid examples for Malawi:
345
+ * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
124
346
  *
125
- * Required string length: 4 - 22
347
+ * @example {value: "265 999 123 678"}
126
348
  *
127
- * @example Example: "Note of 4 to 22 chars"
128
349
  */
129
- statementDescription: string;
130
- /**
131
- * @description For MMOs (correspondents) that use a preauthorisation code instead of a PIN prompt for authorising the deposit.
132
- *
133
- * Required string length: 1 - 36
350
+ address: {
351
+ value: string;
352
+ };
353
+ };
354
+ /**
355
+ * @description The timestamp of when the deposit was created in the pawaPay platform.
356
+ *
357
+ * Format defined by 'date-time' in RFC3339 section 5.6 from {@link https://tools.ietf.org/html/rfc3339#section-5.6 | IETF}
358
+ *
359
+ * @example Example:"2020-02-21T17:32:28Z"
360
+ */
361
+ customerTimestamp: string;
362
+ /**
363
+ * @description Short description for the transaction.
364
+ *
365
+ * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
366
+ *
367
+ * Must be between 4 and 22 alphanumeric characters.
368
+ *
369
+ * Required string length: 4 - 22
370
+ *
371
+ * @example Example: "Note of 4 to 22 chars"
372
+ */
373
+ statementDescription: string;
374
+ /**
375
+ * @description For MMOs (correspondents) that use a preauthorisation code instead of a PIN prompt for authorising the deposit.
376
+ *
377
+ * Required string length: 1 - 36
378
+ */
379
+ preAuthorisationCode?: string;
380
+ /**
381
+ * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
382
+ *
383
+ * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
384
+ *
385
+ * Metadata will not be visible to the customer that is party to this payment.
386
+ * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
387
+ * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
388
+ *
389
+ * Up to 10 metadata fields can be attached to a payment.
390
+ *
391
+ *
392
+ * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
393
+ * @example {fieldName: "orderId"}
394
+ *
395
+ *
396
+ * @param {string} metadata.metadata.fieldValue - The value for this metadata field
397
+ * @example {fieldValue: "ORD-123456789"}
398
+ *
399
+ *
400
+ * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
401
+ * @example {isPII: true}
402
+ */
403
+ metadata?: Array<{
404
+ fieldName: string;
405
+ fieldValue: string;
406
+ isPII?: boolean;
407
+ }>;
408
+ };
409
+ type DepositCallback = {
410
+ /**
411
+ * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
412
+ * Required string length: 36
413
+ * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
414
+ */
415
+ depositId: string;
416
+ /**
417
+ * @description The final status of the payment.
418
+ * COMPLETED - The payment has been successfully processed.
419
+ * FAILED - The payment request has been proceessed, but failed.
420
+ * Available options: `COMPLETED`, `FAILED`
421
+ */
422
+ status: string;
423
+ /**
424
+ * @description The amount to be collected or disbursed.
425
+ *
426
+ * Amount must follow below requirements or the request will be rejected:
427
+ *
428
+ * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
429
+ * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
430
+ * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
431
+ * Trailing zeroes are permitted.
432
+ *
433
+ * Valid examples:
434
+ *
435
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
436
+ *
437
+ * Not valid examples:
438
+ *
439
+ * @ 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
440
+ *
441
+ * Required string length: 1 - 23
442
+ *
443
+ * @example Example: "15"
444
+ */
445
+ requestedAmount: string;
446
+ /**
447
+ * @description The currency in which the amount is specified.
448
+ *
449
+ * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
450
+ *
451
+ * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
452
+ *
453
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
454
+ *
455
+ * @example Example: "MWK"
456
+ */
457
+ currency: string;
458
+ /**
459
+ * @description The country in which the MMO operates.
460
+ *
461
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
462
+ *
463
+ * @example Example: "MWI"
464
+ */
465
+ country: string;
466
+ /**
467
+ * @description The correspondent code refers to the specific MMO that the specified phone number (MSISDN) has an active mobile money wallet with.
468
+ *
469
+ * You can find all the supported correspondents {@link https://docs.pawapay.io/using_the_api#correspondents | listed here}.
470
+ *
471
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account.
472
+ *
473
+ * You can use the {@link https://docs.pawapay.io/v1/api-reference/toolkit/predict-correspondent | predict correspondent} enpoint to predict the correct correspondent to use based on the phone number (MSISDN).
474
+ *
475
+ * @example
476
+ * Example: "AIRTEL_MWI"
477
+ */
478
+ correspondent: string;
479
+ /**
480
+ * @description The phone number (MSISDN) of the recipient or payer must be specified as the `value` of the `address`.
481
+ */
482
+ payer: {
483
+ /** @description The type of financial address. At the moment, only MSISDN is supported as the financial address.
484
+ * @example
485
+ * {
486
+ * type: "MSISDN"
487
+ * }
134
488
  */
135
- preAuthorisationCode?: string;
489
+ type: "MSISDN" & string;
136
490
  /**
137
- * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
138
- *
139
- * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
140
- *
141
- * Metadata will not be visible to the customer that is party to this payment.
142
- * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
143
- * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
144
- *
145
- * Up to 10 metadata fields can be attached to a payment.
491
+ * @description The phone number (MSISDN) of the payer or recipient.
146
492
  *
493
+ * The format is described in {@link https://en.wikipedia.org/wiki/MSISDN | Wikipedia}.
147
494
  *
148
- * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
149
- * @example {fieldName: "orderId"}
495
+ * MSISDN validation has following rules:
150
496
  *
497
+ * - Only digits without whitespaces or any other separators or prefixes like '+'
498
+ * - Should not start with zero.
499
+ * - Country code is mandatory.
500
+ * - Should not exceed or be less than the valid length of specified country.
501
+ * - Valid examples for Malawi: 265999123456
151
502
  *
152
- * @param {string} metadata.metadata.fieldValue - The value for this metadata field
153
- * @example {fieldValue: "ORD-123456789"}
503
+ * Not valid examples for Malawi:
504
+ * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
154
505
  *
506
+ * @example {value: "265 999 123 678"}
155
507
  *
156
- * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
157
- * @example {isPII: true}
158
508
  */
159
- metadata?: Array<{
160
- fieldName: string;
161
- fieldValue: string;
162
- isPII?: boolean;
163
- }>;
509
+ address: {
510
+ value: string;
511
+ };
512
+ };
513
+ /**
514
+ * @description The timestamp of when the deposit was created in the pawaPay platform.
515
+ *
516
+ * Format defined by 'date-time' in RFC3339 section 5.6 from {@link https://tools.ietf.org/html/rfc3339#section-5.6 | IETF}
517
+ *
518
+ * @example Example:"2020-02-21T17:32:28Z"
519
+ */
520
+ customerTimestamp: string;
521
+ /**
522
+ * @description Short description for the transaction.
523
+ *
524
+ * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
525
+ *
526
+ * Must be between 4 and 22 alphanumeric characters.
527
+ *
528
+ * Required string length: 4 - 22
529
+ *
530
+ * @example Example: "Note of 4 to 22 chars"
531
+ */
532
+ statementDescription: string;
533
+ /**
534
+ * ISO Date String
535
+ * @example "2020-10-19T11:17:01Z"
536
+ */
537
+ created: string;
538
+ /**
539
+ * @description The amount to be collected or disbursed.
540
+ *
541
+ * Amount must follow below requirements or the request will be rejected:
542
+ *
543
+ * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
544
+ * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
545
+ * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
546
+ * Trailing zeroes are permitted.
547
+ *
548
+ * Valid examples:
549
+ *
550
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
551
+ *
552
+ * Not valid examples:
553
+ *
554
+ * @ 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
555
+ *
556
+ * Required string length: 1 - 23
557
+ *
558
+ * @example Example: "15"
559
+ */
560
+ depositedAmount: string;
561
+ /**
562
+ * @description When the MNO responded to this deposit request.
563
+ * Format defined by 'date-time' in RFC3339 section 5.6 (https://tools.ietf.org/html/rfc3339#section-5.6)
564
+ *
565
+ * Example: "2020-02-21T17:32:30Z"
566
+ */
567
+ respondedByPayer: string;
568
+ /**
569
+ * @description The unqiue ID for this financial transaction assigned by the MNO.
570
+ */
571
+ correspondentIds: Record<string, string>;
572
+ suspiciousActivityReport: {
573
+ activityTypw: string;
574
+ comment: string;
575
+ }[];
576
+ failureReason: {
577
+ failureCode: string;
578
+ failureMessage: string;
579
+ };
580
+ metadata: Record<string, unknown>;
164
581
  };
165
582
  type RequestPayoutConfig = {
166
- /**
167
- * @description A UUIDv4 based ID specified by you, that uniquely identifies the payout.
168
- * Required string length: 36
169
- * @example payoutId: "<INSERT_UUID_FOR_PAYOUT>"
170
- */
171
- payoutId: string;
172
- /**
173
- * @description The amount to be disbursed for the payout.
174
- *
175
- * Amount must follow the same requirements as in DepositConfig.
176
- * Valid examples: 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
177
- * Not valid examples: 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
178
- * Required string length: 1 - 23
179
- * @example "15"
180
- */
181
- amount: string;
182
- /**
183
- * @description The currency in which the amount is specified.
184
- * Format must be the ISO 4217 three character currency code in upper case.
185
- * @example "MWK"
186
- */
187
- currency: string;
188
- /**
189
- * @description The correspondent code refers to the specific MMO that the recipient has an active mobile money wallet with.
190
- * @example "AIRTEL_MWI"
191
- */
192
- correspondent: string;
193
- /**
194
- * @description The phone number (MSISDN) of the recipient.
195
- * Format: Only digits, no whitespaces or separators, no leading zero, must include country code.
196
- * @example "265999123456"
197
- */
198
- recipient: string;
199
- /**
200
- * @description The timestamp of when the payout was created in the pawaPay platform.
201
- * Format defined by 'date-time' in RFC3339 section 5.6.
202
- * @example "2020-02-21T17:32:28Z"
203
- */
204
- customerTimestamp: string;
205
- /**
206
- * @description Short description for the transaction, visible to the customer in SMS or transaction history.
207
- * Must be between 4 and 22 alphanumeric characters.
208
- * @example "Note of 4 to 22 chars"
209
- */
210
- statementDescription: string;
211
- /**
212
- * @description The country in which the MMO operates. ISO 3166-1 alpha-3 code in upper case.
213
- * @example "MWI"
214
- */
215
- country: string;
216
- /**
217
- * @description A list of metadata for providing additional context about the payout. Up to 10 fields allowed.
218
- * @example [{ fieldName: "orderId", fieldValue: "ORD-123456789", isPII: false }]
219
- */
220
- metadata: Array<{
221
- fieldName: string;
222
- fieldValue: string;
223
- isPII?: boolean;
224
- }>;
583
+ /**
584
+ * @description A UUIDv4 based ID specified by you, that uniquely identifies the payout.
585
+ * Required string length: 36
586
+ * @example payoutId: "<INSERT_UUID_FOR_PAYOUT>"
587
+ */
588
+ payoutId: string;
589
+ /**
590
+ * @description The amount to be disbursed for the payout.
591
+ *
592
+ * Amount must follow the same requirements as in DepositConfig.
593
+ * Valid examples: 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
594
+ * Not valid examples: 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
595
+ * Required string length: 1 - 23
596
+ * @example "15"
597
+ */
598
+ amount: string;
599
+ /**
600
+ * @description The currency in which the amount is specified.
601
+ * Format must be the ISO 4217 three character currency code in upper case.
602
+ * @example "MWK"
603
+ */
604
+ currency: string;
605
+ /**
606
+ * @description The correspondent code refers to the specific MMO that the recipient has an active mobile money wallet with.
607
+ * @example "AIRTEL_MWI"
608
+ */
609
+ correspondent: string;
610
+ /**
611
+ * @description The phone number (MSISDN) of the recipient.
612
+ * Format: Only digits, no whitespaces or separators, no leading zero, must include country code.
613
+ * @example "265999123456"
614
+ */
615
+ recipient: string;
616
+ /**
617
+ * @description The timestamp of when the payout was created in the pawaPay platform.
618
+ * Format defined by 'date-time' in RFC3339 section 5.6.
619
+ * @example "2020-02-21T17:32:28Z"
620
+ */
621
+ customerTimestamp: string;
622
+ /**
623
+ * @description Short description for the transaction, visible to the customer in SMS or transaction history.
624
+ * Must be between 4 and 22 alphanumeric characters.
625
+ * @example "Note of 4 to 22 chars"
626
+ */
627
+ statementDescription: string;
628
+ /**
629
+ * @description The country in which the MMO operates. ISO 3166-1 alpha-3 code in upper case.
630
+ * @example "MWI"
631
+ */
632
+ country: string;
633
+ /**
634
+ * @description A list of metadata for providing additional context about the payout. Up to 10 fields allowed.
635
+ * @example [{ fieldName: "orderId", fieldValue: "ORD-123456789", isPII: false }]
636
+ */
637
+ metadata: Array<{
638
+ fieldName: string;
639
+ fieldValue: string;
640
+ isPII?: boolean;
641
+ }>;
225
642
  };
226
643
  type BaseRequestPayoutResponse = {
227
- payoutId: string;
228
- status: string;
644
+ payoutId: string;
645
+ status: string;
229
646
  };
230
647
  type AcceptedRequestPayout = BaseRequestPayoutResponse & {
231
- status: "ACCEPTED";
232
- created: string;
648
+ status: "ACCEPTED";
649
+ created: string;
233
650
  };
234
651
  type DuplicateIgnoredRequestPayout = BaseRequestPayoutResponse & {
235
- status: "DUPLICATE_IGNORED";
236
- created: string;
652
+ status: "DUPLICATE_IGNORED";
653
+ created: string;
237
654
  };
238
655
  type RejectedRequestPayout = BaseRequestPayoutResponse & {
239
- status: "REJECTED";
240
- rejectionReason: {
241
- rejectionCode: string;
242
- rejectionMessage: string;
243
- };
656
+ status: "REJECTED";
657
+ rejectionReason: {
658
+ rejectionCode: string;
659
+ rejectionMessage: string;
660
+ };
244
661
  };
245
662
  type RequestPayoutRespose = AcceptedRequestPayout | DuplicateIgnoredRequestPayout | RejectedRequestPayout;
246
663
  type PayoutCallback = {
247
- payoutId: string;
248
- status: string;
249
- amount: string;
250
- currency: string;
251
- country: string;
252
- correspondent: string;
253
- recipient: {
254
- type: string;
255
- address: {
256
- value: string;
257
- };
664
+ payoutId: string;
665
+ status: string;
666
+ amount: string;
667
+ currency: string;
668
+ country: string;
669
+ correspondent: string;
670
+ recipient: {
671
+ type: string;
672
+ address: {
673
+ value: string;
258
674
  };
259
- customerTimestamp: string;
260
- statementDescription: string;
261
- created: string;
262
- receivedByRecipient: string;
263
- correspondentIds: {};
264
- failureReason: {
265
- failureCode: string;
266
- failureMessage: string;
267
- };
268
- metadata: {};
675
+ };
676
+ customerTimestamp: string;
677
+ statementDescription: string;
678
+ created: string;
679
+ receivedByRecipient: string;
680
+ correspondentIds: Record<string, string>;
681
+ failureReason: {
682
+ failureCode: string;
683
+ failureMessage: string;
684
+ };
685
+ metadata: Record<string, string>;
269
686
  };
270
687
  type CheckPayoutStatusBase = {
271
- payoutId: string;
272
- status: string;
273
- amount: string;
274
- currency: string;
275
- country: string;
276
- correspondent: string;
277
- recipient: {
278
- type: string;
279
- address: {
280
- value: string;
281
- };
688
+ payoutId: string;
689
+ status: string;
690
+ amount: string;
691
+ currency: string;
692
+ country: string;
693
+ correspondent: string;
694
+ recipient: {
695
+ type: string;
696
+ address: {
697
+ value: string;
282
698
  };
283
- customerTimestamp: string;
284
- statementDescription: string;
285
- created: string;
286
- metadata: {};
699
+ };
700
+ customerTimestamp: string;
701
+ statementDescription: string;
702
+ created: string;
703
+ metadata: Record<string, unknown>;
287
704
  };
288
705
  type CheckPayoutStatusAccepted = CheckPayoutStatusBase & {
289
- status: "ACCEPTED";
290
- created: string;
706
+ status: "ACCEPTED";
707
+ created: string;
291
708
  };
292
709
  type CheckPayoutStatusCompleted = CheckPayoutStatusBase & {
293
- status: "COMPLETED";
294
- receivedByRecipient: string;
295
- correspondentIds: {};
710
+ status: "COMPLETED";
711
+ receivedByRecipient: string;
712
+ correspondentIds: Record<string, string>;
296
713
  };
297
714
  type CheckPayoutStatusSubmitted = CheckPayoutStatusBase & {
298
- status: "SUBMITTED";
299
- created: string;
715
+ status: "SUBMITTED";
716
+ created: string;
300
717
  };
301
718
  type CheckPayoutStatusEnqueued = CheckPayoutStatusBase & {
302
- status: "ENQUEUED";
303
- created: string;
719
+ status: "ENQUEUED";
720
+ created: string;
304
721
  };
305
722
  type CheckPayoutStatusSFailed = CheckPayoutStatusBase & {
306
- status: "FAILED";
307
- failureReason: {
308
- failureCode: string;
309
- failureMessage: string;
310
- };
311
- created: string;
723
+ status: "FAILED";
724
+ failureReason: {
725
+ failureCode: string;
726
+ failureMessage: string;
727
+ };
728
+ created: string;
312
729
  };
313
730
  type CheckPayoutStatusResponse = CheckPayoutStatusAccepted | CheckPayoutStatusCompleted | CheckPayoutStatusSubmitted | CheckPayoutStatusEnqueued | CheckPayoutStatusSFailed;
314
731
  type CancelEnqueuedPayoutBase = {
315
- payoutId: string;
316
- status: string;
732
+ payoutId: string;
733
+ status: string;
317
734
  };
318
735
  type CancelEnqueuedPayoutAccepted = CancelEnqueuedPayoutBase & {
319
- status: "ACCEPTED";
320
- created: string;
736
+ status: "ACCEPTED";
737
+ created: string;
321
738
  };
322
739
  type CancelEnqueuedPayoutRejected = CancelEnqueuedPayoutBase & {
323
- status: "REJECTED";
324
- failureReason: string;
740
+ status: "REJECTED";
741
+ failureReason: string;
325
742
  };
326
743
  type CancelEnqueuedPayoutFailed = CancelEnqueuedPayoutBase & {
327
- status: "FAILED";
744
+ status: "FAILED";
328
745
  };
329
746
  type CancelEnqueuedPayoutResponse = CancelEnqueuedPayoutAccepted | CancelEnqueuedPayoutRejected | CancelEnqueuedPayoutFailed;
330
747
  type RequestBulkPayoutConfig = {
331
- payoutId: string;
332
- amount: string;
333
- currency: string;
334
- country: string;
335
- correspondent: string;
336
- recipient: {
337
- type: string;
338
- address: {
339
- value: string;
340
- };
748
+ payoutId: string;
749
+ amount: string;
750
+ currency: string;
751
+ country: string;
752
+ correspondent: string;
753
+ recipient: {
754
+ type: string;
755
+ address: {
756
+ value: string;
341
757
  };
342
- customerTimestamp: string;
343
- statementDescription: string;
344
- metadata: Array<{
345
- fieldName: string;
346
- fieldValue: string;
347
- isPII: boolean;
348
- }>;
758
+ };
759
+ customerTimestamp: string;
760
+ statementDescription: string;
761
+ metadata: Array<{
762
+ fieldName: string;
763
+ fieldValue: string;
764
+ isPII: boolean;
765
+ }>;
349
766
  };
350
767
  type RequestBuildPayoutResponseBase = {
351
- payoutId: string;
352
- status: string;
353
- created: string;
768
+ payoutId: string;
769
+ status: string;
770
+ created: string;
354
771
  };
355
772
  type RequestBuildPayoutResponseAccepted = RequestBuildPayoutResponseBase & {
356
- status: "ACCEPTED";
357
- created: string;
773
+ status: "ACCEPTED";
774
+ created: string;
358
775
  };
359
776
  type RequestBuildPayoutResponseDuplicateIgnored = RequestBuildPayoutResponseBase & {
360
- status: "DUPLICATE_IGNORED";
777
+ status: "DUPLICATE_IGNORED";
361
778
  };
362
779
  type RequestBuildPayoutResponseRejected = RequestBuildPayoutResponseBase & {
363
- status: "REJECTED";
364
- failureReason: {
365
- rejectionCode: string;
366
- rejectionMessage: string;
367
- };
780
+ status: "REJECTED";
781
+ failureReason: {
782
+ rejectionCode: string;
783
+ rejectionMessage: string;
784
+ };
368
785
  };
369
786
  type RequestBuildPayoutResponse = RequestBuildPayoutResponseAccepted | RequestBuildPayoutResponseDuplicateIgnored | RequestBuildPayoutResponseRejected;
370
787
  type ResendPayoutCallbackBase = {
371
- payoutId: string;
372
- status: string;
788
+ payoutId: string;
789
+ status: string;
373
790
  };
374
791
  type ResendPayoutCallbackAccepted = ResendPayoutCallbackBase & {
375
- status: "ACCEPTED";
792
+ status: "ACCEPTED";
376
793
  };
377
794
  type ResendPayoutCallbackRejected = ResendPayoutCallbackBase & {
378
- status: "REJECTED";
379
- failureReason: string;
795
+ status: "REJECTED";
796
+ failureReason: string;
380
797
  };
381
798
  type ResendPayoutCallbackFailed = ResendPayoutCallbackBase & {
382
- status: "FAILED";
799
+ status: "FAILED";
383
800
  };
384
801
  type ResendPayoutCallbackResponse = ResendPayoutCallbackAccepted | ResendPayoutCallbackRejected | ResendPayoutCallbackFailed;
385
802
  type RequestPayPageConfig = {
386
- /**
387
- * A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
388
- *
389
- * Required string length: 36
390
- * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
391
- */
392
- depositId: string;
393
- /**
394
- * The URL to which the user will be redirected after completion of the operation.
395
- *
396
- * @example returnUrl: "https://merchant.com/paymentProcessed"
397
- */
398
- returnUrl: string;
399
- /**
400
- * @description Short description for the transaction.
401
- *
402
- * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
403
- *
404
- * Must be between 4 and 22 alphanumeric characters.
405
- *
406
- * Required string length: 4 - 22
407
- *
408
- * @example Example: "Note of 4 to 22 chars"
409
- */
410
- statementDescription?: string;
411
- /**
412
- * If specified, the amount will be displayed to the customer as the payment amount. For example, when paying for specific goods or services.
413
- *
414
- * If not specified, the customer will have to specify the amount they wish to pay. For example, when depositing money into their eWallet.
415
- *
416
- * Amount must follow below requirements or the request will be rejected:
417
- *
418
- * - Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
419
- *
420
- * - The minimum and maximum amounts depend on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
421
- * - Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
422
- * - Trailing zeroes are permitted.
423
- *
424
- * Valid examples:
425
- * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
426
- *
427
- * Not valid examples:
428
- * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
429
- *
430
- * Required string length: 1 - 23
431
- *
432
- * @example amount: "15"
803
+ /**
804
+ * A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
805
+ *
806
+ * Required string length: 36
807
+ * @example depositId: "<INSERT_UUID_FOR_DEPOSIT>"
808
+ */
809
+ depositId: string;
810
+ /**
811
+ * The URL to which the user will be redirected after completion of the operation.
812
+ *
813
+ * @example returnUrl: "https://merchant.com/paymentProcessed"
814
+ */
815
+ returnUrl: string;
816
+ /**
817
+ * @description Short description for the transaction.
818
+ *
819
+ * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
820
+ *
821
+ * Must be between 4 and 22 alphanumeric characters.
822
+ *
823
+ * Required string length: 4 - 22
824
+ *
825
+ * @example Example: "Note of 4 to 22 chars"
826
+ */
827
+ statementDescription?: string;
828
+ /**
829
+ * If specified, the amount will be displayed to the customer as the payment amount. For example, when paying for specific goods or services.
830
+ *
831
+ * If not specified, the customer will have to specify the amount they wish to pay. For example, when depositing money into their eWallet.
832
+ *
833
+ * Amount must follow below requirements or the request will be rejected:
834
+ *
835
+ * - Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
836
+ *
837
+ * - The minimum and maximum amounts depend on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
838
+ * - Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
839
+ * - Trailing zeroes are permitted.
840
+ *
841
+ * Valid examples:
842
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
843
+ *
844
+ * Not valid examples:
845
+ * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
846
+ *
847
+ * Required string length: 1 - 23
848
+ *
849
+ * @example amount: "15"
850
+ */
851
+ amount?: string;
852
+ /**
853
+ * @description The phone number (MSISDN) of the payer or recipient.
854
+ *
855
+ * The format is described in {@link https://en.wikipedia.org/wiki/MSISDN | Wikipedia}.
856
+ *
857
+ * MSISDN validation has following rules:
858
+ *
859
+ * - Only digits without whitespaces or any other separators or prefixes like '+'
860
+ * - Should not start with zero.
861
+ * - Country code is mandatory.
862
+ * - Should not exceed or be less than the valid length of specified country.
863
+ * - Valid examples for Malawi: 265999123456
864
+ *
865
+ * Not valid examples for Malawi:
866
+ * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
867
+ *
868
+ * @example {value: "265 999 123 678"}
869
+ *
870
+ */
871
+ msisdn: string;
872
+ /**
873
+ * The language in which the Payment Page will be presented to the customer. If the user has explicitly changed their languages preferences, their selection will override this parameter.
874
+ *
875
+ * Available options: EN, FR
876
+ *
877
+ * @example language: "EN"
878
+ */
879
+ language?: string;
880
+ /**
881
+ * @description The country in which the MMO operates.
882
+ *
883
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
884
+ *
885
+ * @example Example: "MWI"
886
+ */
887
+ country?: string;
888
+ /**
889
+ * Optional text which will be displayed to the customer on the payment page to specify what they are paying for.
890
+ *
891
+ * Required string length: 1 - 50
892
+ *
893
+ * @example reason: "Ticket to festival"
894
+ */
895
+ reason?: string;
896
+ /**
897
+ * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
898
+ *
899
+ * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
900
+ *
901
+ * Metadata will not be visible to the customer that is party to this payment.
902
+ * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
903
+ * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
904
+ *
905
+ * Up to 10 metadata fields can be attached to a payment.
906
+ *
907
+ *
908
+ * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
909
+ * @example {fieldName: "orderId"}
910
+ *
911
+ *
912
+ * @param {string} metadata.metadata.fieldValue - The value for this metadata field
913
+ * @example {fieldValue: "ORD-123456789"}
914
+ *
915
+ *
916
+ * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
917
+ * @example {isPII: true}
918
+ */
919
+ metadata?: Array<{
920
+ fieldName: string;
921
+ fieldValue: string;
922
+ isPII?: boolean;
923
+ }>;
924
+ };
925
+ type RequestRefundConfig = {
926
+ /**
927
+ *@description A UUIDv4 based ID specified by you, that uniquely identifies the refund.
928
+ *
929
+ * Required string length: 36
930
+ *
931
+ * @example refundId:"<INSERT_UUID_FOR_REFUND>"
932
+ */
933
+ refundId: string;
934
+ /**
935
+ * @description The depositId of the deposit to be refunded.
936
+ *
937
+ * Required string length: 36
938
+ *
939
+ * @example depositId:"<INSERT_UUID_OF_DEPOSIT_TO_REFUND>"
940
+ */
941
+ depositId: string;
942
+ /**
943
+ * @description The amount to be collected (deposit) or disbursed (payout or refund).
944
+ *
945
+ * Amount must follow below requirements or the request will be rejected:
946
+ *
947
+ * - Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
948
+ *
949
+ * - The minimum and maximum amounts depend on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
950
+ * - Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
951
+ * - Trailing zeroes are permitted.
952
+ *
953
+ * Valid examples:
954
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
955
+ *
956
+ * Not valid examples:
957
+ * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
958
+ *
959
+ * Required string length: 1 - 23
960
+ *
961
+ * @example amount: "15"
962
+ */
963
+ amount?: string;
964
+ /**
965
+ * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
966
+ *
967
+ * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
968
+ *
969
+ * Metadata will not be visible to the customer that is party to this payment.
970
+ * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
971
+ * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
972
+ *
973
+ * Up to 10 metadata fields can be attached to a payment.
974
+ *
975
+ *
976
+ * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
977
+ * @example {fieldName: "orderId"}
978
+ *
979
+ *
980
+ * @param {string} metadata.metadata.fieldValue - The value for this metadata field
981
+ * @example {fieldValue: "ORD-123456789"}
982
+ *
983
+ *
984
+ * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
985
+ * @example {isPII: true}
986
+ */
987
+ metadata?: Array<{
988
+ fieldName: string;
989
+ fieldValue: string;
990
+ isPII?: boolean;
991
+ }>;
992
+ };
993
+ type RequestPayPageResponse = {
994
+ /**
995
+ * @description The unique URL of the payment page for this specific payment session.
996
+ *
997
+ * Customer has to be forwarded to this URL where they can complete the payment.
998
+ * The session is valid for 15 minutes for the customer to complete the payment.
999
+ *
1000
+ * Please note! The URL is valid for 5 minutes.
1001
+ *
1002
+ * @example
1003
+ * redirectUrl: "https://paywith.pawapay.io/?token=AgV4aA3ZxKfGcdMIo6a6Upf7X2MRptdFUrc6Oi3U53CxC0YAkAADABVhd3MtY3J5cHRv"
1004
+ */
1005
+ redirectUrl: string;
1006
+ };
1007
+ type PawaPayError = {
1008
+ /**
1009
+ * @description A unique error ID in the pawaPay platform.
1010
+ *
1011
+ * Maximum length: 36
1012
+ *
1013
+ * @example errorId: "63743264-7292-11ea-bc55-0242ac130003"
1014
+ *
1015
+ */
1016
+ errorId?: string;
1017
+ /**
1018
+ * @description pawaPay internal error code.
1019
+ * @example errorCode: 1
1020
+ */
1021
+ errorCode?: number;
1022
+ /**
1023
+ * @description Error message.
1024
+ *
1025
+ * @example errorMessage: "Internal error"
1026
+ */
1027
+ errorMessage?: string;
1028
+ };
1029
+ type AcceptedDeposit = {
1030
+ /**
1031
+ * @description The depositId of the deposit transaction.
1032
+ *
1033
+ * Required string length: 36
1034
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1035
+ */
1036
+ depositId: string;
1037
+ /**
1038
+ * @description The deposit request has been accepted by pawaPay for processing.
1039
+ */
1040
+ status: "ACCEPTED";
1041
+ /**
1042
+ * ISO Date String
1043
+ * @example "2020-10-19T11:17:01Z"
1044
+ */
1045
+ created: string;
1046
+ };
1047
+ type DuplicatedIgnoredDeposit = {
1048
+ /**
1049
+ * @description The depositId of the deposit transaction.
1050
+ *
1051
+ * Required string length: 36
1052
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1053
+ */
1054
+ depositId: string;
1055
+ /**
1056
+ * @description The deposit request has been ignored as a duplicate of an already accepted deposit request. Duplication logic relies upon depositId.
1057
+ */
1058
+ status: "DUPLICATE_IGNORED";
1059
+ /**
1060
+ * ISO Date String
1061
+ * @example "2020-10-19T11:17:01Z"
1062
+ */
1063
+ created: string;
1064
+ };
1065
+ type RejectedDeposit = {
1066
+ /**
1067
+ * @description The depositId of the deposit transaction.
1068
+ *
1069
+ * Required string length: 36
1070
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1071
+ */
1072
+ depositId: string;
1073
+ /**
1074
+ * @description The deposit request has been rejected. See rejectionReason for details.
1075
+ */
1076
+ status: "REJECTED";
1077
+ rejectionReason: {
1078
+ /**
1079
+ * @description Possible deposit rejection codes:
1080
+ *
1081
+ * - INVALID_PAYER_FORMAT - The payer address (phone number) is invalid.
1082
+ * - INVALID_CORRESPONDENT - The specified correspondent is not supported.
1083
+ * - INVALID_AMOUNT - The specified amount is not supported.
1084
+ * - AMOUNT_TOO_SMALL - The specified amount is smaller than the minimum allowed by the MMO specified as the correspondent.
1085
+ * - AMOUNT_TOO_LARGE - The specified amount is larger than the maximum allowed by the MMO specified as the correspondent.
1086
+ * - INVALID_CURRENCY - The specified currency is not supported for the MMO specified as the correspondent.
1087
+ * - INVALID_COUNTRY - The specified country is not supported for this MMO specified as the correspondent.
1088
+ * - PARAMETER_INVALID - One or more parameters are invalid.
1089
+ * - INVALID_INPUT - We were unable to parse the payload of the request.
1090
+ * - DEPOSITS_NOT_ALLOWED - Deposits are not allowed for the merchant or the MMO specified as the correspondent.
1091
+ * - CORRESPONDENT_TEMPORARILY_UNAVAILABLE - The MMO specified as the correspondent is currently experiencing an outage and processing of payments has been temporarily halted.
1092
+ *
1093
+ * Please refer to our {@link https://status.pawapay.io/ | Status Page} for live information about MMO availability.
1094
+ *
1095
+ * @example rejectionCode: "INVALID_AMOUNT"
1096
+ *
1097
+ */
1098
+ rejectionCode: "INVALID_PAYER_FORMAT" | "INVALID_CORRESPONDENT" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "INVALID_CURRENCY" | "INVALID_COUNTRY" | "PARAMETER_INVALID" | "INVALID_INPUT" | "DEPOSITS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE";
1099
+ /**
1100
+ * Additional optional rejection message
1101
+ * @example rejectionMessage: "You don't have access to this correspondent"
1102
+ */
1103
+ rejectionMessage: string;
1104
+ };
1105
+ };
1106
+ type DepositResponse = AcceptedDeposit | DuplicatedIgnoredDeposit | RejectedDeposit;
1107
+ type CheckStatusBaseResponse = {
1108
+ /**
1109
+ * A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
1110
+ *
1111
+ * Required string length: 36
1112
+ *
1113
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1114
+ */
1115
+ depositId: string;
1116
+ /**
1117
+ * The amount to be collected (deposit) or disbursed (payout or refund).
1118
+ *
1119
+ * Amount must follow below requirements or the request will be rejected:
1120
+ * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
1121
+ * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.\
1122
+ * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
1123
+ * Trailing zeroes are permitted.
1124
+ *
1125
+ * Valid examples:
1126
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
1127
+ *
1128
+ * Not valid examples:
1129
+ * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
1130
+ *
1131
+ * Required string length: 1 - 23
1132
+ *
1133
+ * @example requestedAmount: "15"
1134
+ */
1135
+ requestedAmout: string;
1136
+ /**
1137
+ * @description The currency in which the amount is specified.
1138
+ *
1139
+ * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
1140
+ *
1141
+ * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
1142
+ *
1143
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
1144
+ *
1145
+ * @example Example: "MWK"
1146
+ */
1147
+ currency: string;
1148
+ /**
1149
+ * @description The country in which the MMO operates.
1150
+ *
1151
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
1152
+ *
1153
+ * @example Example: "MWI"
1154
+ */
1155
+ country: string;
1156
+ /**
1157
+ * @description The correspondent code refers to the specific MMO that the specified phone number (MSISDN) has an active mobile money wallet with.
1158
+ *
1159
+ * You can find all the supported correspondents {@link https://docs.pawapay.io/using_the_api#correspondents | listed here}.
1160
+ *
1161
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account.
1162
+ *
1163
+ * You can use the {@link https://docs.pawapay.io/v1/api-reference/toolkit/predict-correspondent | predict correspondent} enpoint to predict the correct correspondent to use based on the phone number (MSISDN).
1164
+ *
1165
+ * @example
1166
+ * Example: "AIRTEL_MWI"
1167
+ */
1168
+ correspondent: string;
1169
+ /**
1170
+ * @description The phone number (MSISDN) of the recipient or payer must be specified as the `value` of the `address`.
1171
+ */
1172
+ payer: {
1173
+ /** @description The type of financial address. At the moment, only MSISDN is supported as the financial address.
1174
+ * @example
1175
+ * {
1176
+ * type: "MSISDN"
1177
+ * }
433
1178
  */
434
- amount?: string;
1179
+ type: "MSISDN" & string;
435
1180
  /**
436
1181
  * @description The phone number (MSISDN) of the payer or recipient.
437
1182
  *
@@ -448,810 +1193,1138 @@ type RequestPayPageConfig = {
448
1193
  * Not valid examples for Malawi:
449
1194
  * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
450
1195
  *
451
- * @example {value: "265 999 123 678"}
452
- *
453
- */
454
- msisdn: string;
455
- /**
456
- * The language in which the Payment Page will be presented to the customer. If the user has explicitly changed their languages preferences, their selection will override this parameter.
457
- *
458
- * Available options: EN, FR
1196
+ * @example {value: "260763456789"}
459
1197
  *
460
- * @example language: "EN"
461
1198
  */
462
- language?: string;
1199
+ address: {
1200
+ value: string;
1201
+ };
1202
+ };
1203
+ /**
1204
+ * @description The timestamp of when the deposit was created in the pawaPay platform.
1205
+ *
1206
+ * Format defined by 'date-time' in RFC3339 section 5.6 from {@link https://tools.ietf.org/html/rfc3339#section-5.6 | IETF}
1207
+ *
1208
+ * @example Example:"2020-02-21T17:32:28Z"
1209
+ */
1210
+ customerTimestamp: string;
1211
+ /**
1212
+ * @description Short description for the transaction.
1213
+ *
1214
+ * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
1215
+ *
1216
+ * Must be between 4 and 22 alphanumeric characters.
1217
+ *
1218
+ * Required string length: 4 - 22
1219
+ *
1220
+ * @example Example: "Note of 4 to 22 chars"
1221
+ */
1222
+ statementDescription: string;
1223
+ /**
1224
+ * ISO Date String
1225
+ * @example "2020-10-19T11:17:01Z"
1226
+ */
1227
+ created: string;
1228
+ /**
1229
+ * @description The metadata that was provided in the original initation request in a JSON object format.
1230
+ */
1231
+ metadata: Record<string, unknown>;
1232
+ };
1233
+ type CompletedStatus = CheckStatusBaseResponse & {
1234
+ /**
1235
+ * @description The payout request has been successfully processed. This is a Final state.
1236
+ */
1237
+ status: "COMPLETED";
1238
+ /**
1239
+ * @description The amount to be collected (deposit) or disbursed (payout or refund).
1240
+ *
1241
+ * Amount must follow below requirements or the request will be rejected:
1242
+ *
1243
+ * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
1244
+ * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
1245
+ * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
1246
+ * Trailing zeroes are permitted.
1247
+ *
1248
+ * Valid examples:
1249
+ * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
1250
+ *
1251
+ * Not valid examples:
1252
+ *
1253
+ * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
1254
+ *
1255
+ * Required string length: 1 - 23
1256
+ *
1257
+ * @example depositedAmount: "15"
1258
+ */
1259
+ depositedAmount: string;
1260
+ /**
1261
+ * When the MMO responded to this deposit request. Format defined by 'date-time' in RFC3339 section 5.6 from IETF
1262
+ *
1263
+ * @example
1264
+ * respondedByPayer: "2020-02-21T17:32:30Z"
1265
+ */
1266
+ respondedByPayer: string;
1267
+ /**
1268
+ * @description The unique ID for this financial transaction assigned by the MMO.
1269
+ * @example
1270
+ * {
1271
+ "MTN_INIT": "ABC123",
1272
+ "MTN_FINAL": "DEF456"
1273
+ }
1274
+ */
1275
+ correspondentIds: {
1276
+ [key: string]: string;
1277
+ };
1278
+ };
1279
+ type AcceptedStatus = CheckStatusBaseResponse & {
1280
+ /**
1281
+ * @description The payout request has been accepted by pawaPay for processing.
1282
+ */
1283
+ status: "ACCEPTED";
1284
+ };
1285
+ type EnqueuedStatus = CheckStatusBaseResponse & {
1286
+ /**
1287
+ * @description The payout request has been accepted, but has been enqueued for processing later. Read more about {@link https://docs.pawapay.io/payouts#enqueued-payouts | enqueued payouts}.
1288
+ */
1289
+ status: "ENQUEUED";
1290
+ };
1291
+ type SubmittedStatus = CheckStatusBaseResponse & {
1292
+ /**
1293
+ * @description The payout request has been submitted to the MMO and is being processed.
1294
+ */
1295
+ status: "SUBMITTED";
1296
+ };
1297
+ type FailedStatus = CheckStatusBaseResponse & {
1298
+ /**
1299
+ * @description The payout request has been processed, but failed. Final state.
1300
+ */
1301
+ status: "FAILED";
1302
+ failureReason: {
463
1303
  /**
464
- * @description The country in which the MMO operates.
1304
+ * @description Possible deposit failure codes:
465
1305
  *
466
- * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
1306
+ * - PAYER_NOT_FOUND - The phone number specified as the Payer does not belong to the MMO specified as the correspondent.
1307
+ * - PAYMENT_NOT_APPROVED - Payer did not approve the payment.
1308
+ * - PAYER_LIMIT_REACHED - Payer has reached a transaction limit of their mobile money wallet.
1309
+ * - INSUFFICIENT_BALANCE - Payer does not have enough funds.
1310
+ * - TRANSACTION_ALREADY_IN_PROCESS - Payer already has an unfinalized transaction being processed by the MMO.
1311
+ * - OTHER_ERROR - Any other error. Please refer to failureMessage.
467
1312
  *
468
- * @example Example: "MWI"
1313
+ * @example failureCode: "OTHER_ERROR"
469
1314
  */
470
- country?: string;
1315
+ failureCode: "PAYER_NOT_FOUND" | "PAYMENT_NOT_APPROVED" | "PAYER_LIMIT_REACHED" | "INSUFFICIENT_BALANCE" | "TRANSACTION_ALREADY_IN_PROCESS" | "OTHER_ERROR";
471
1316
  /**
472
- * Optional text which will be displayed to the customer on the payment page to specify what they are paying for.
473
- *
474
- * Required string length: 1 - 50
475
- *
476
- * @example reason: "Ticket to festival"
1317
+ * @description Additional optional failure message
1318
+ * @example failureMessage: "Recipient's address is blocked"
477
1319
  */
478
- reason?: string;
479
- /**
480
- * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
481
- *
482
- * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
483
- *
484
- * Metadata will not be visible to the customer that is party to this payment.
485
- * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
486
- * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
487
- *
488
- * Up to 10 metadata fields can be attached to a payment.
489
- *
490
- *
491
- * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
492
- * @example {fieldName: "orderId"}
493
- *
494
- *
495
- * @param {string} metadata.metadata.fieldValue - The value for this metadata field
496
- * @example {fieldValue: "ORD-123456789"}
497
- *
498
- *
499
- * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
500
- * @example {isPII: true}
501
- */
502
- metadata?: Array<{
503
- fieldName: string;
504
- fieldValue: string;
505
- isPII?: boolean;
506
- }>;
507
- };
508
- type RequestRefundConfig = {
509
- /**
510
- *@description A UUIDv4 based ID specified by you, that uniquely identifies the refund.
511
- *
512
- * Required string length: 36
513
- *
514
- * @example refundId:"<INSERT_UUID_FOR_REFUND>"
515
- */
516
- refundId: string;
517
- /**
518
- * @description The depositId of the deposit to be refunded.
519
- *
520
- * Required string length: 36
521
- *
522
- * @example depositId:"<INSERT_UUID_OF_DEPOSIT_TO_REFUND>"
523
- */
524
- depositId: string;
525
- /**
526
- * @description The amount to be collected (deposit) or disbursed (payout or refund).
527
- *
528
- * Amount must follow below requirements or the request will be rejected:
529
- *
530
- * - Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
531
- *
532
- * - The minimum and maximum amounts depend on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
533
- * - Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
534
- * - Trailing zeroes are permitted.
535
- *
536
- * Valid examples:
537
- * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
538
- *
539
- * Not valid examples:
540
- * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
541
- *
542
- * Required string length: 1 - 23
543
- *
544
- * @example amount: "15"
545
- */
546
- amount?: string;
547
- /**
548
- * @description A list of metadata that you can attach to the payment for providing additional context about the payment.
549
- *
550
- * For example, adding orderId to indicate for which order this payment was for or customerId to know which customer this payment pertains to.
551
- *
552
- * Metadata will not be visible to the customer that is party to this payment.
553
- * It will be visible in the pawaPay Dashboard on the payment details page and in your financial statements as a JSON object to support automated reconciliation.\
554
- * It is also possible to search for recent payments in the pawaPay Dashboard using global search based on the values of metadata.
555
- *
556
- * Up to 10 metadata fields can be attached to a payment.
557
- *
558
- *
559
- * @param {string} metadata.fieldName - The name of the metadata that you are attaching to the payment.
560
- * @example {fieldName: "orderId"}
561
- *
562
- *
563
- * @param {string} metadata.metadata.fieldValue - The value for this metadata field
564
- * @example {fieldValue: "ORD-123456789"}
565
- *
566
- *
567
- * @param {boolean} metadata.isPII - Indicates whether the field contains personally identifiable information. Used for enabling compliance with GDPR or other relevant data privacy laws.
568
- * @example {isPII: true}
569
- */
570
- metadata?: Array<{
571
- fieldName: string;
572
- fieldValue: string;
573
- isPII?: boolean;
574
- }>;
575
- };
576
- type RequestPayPageResponse = {
577
- /**
578
- * @description The unique URL of the payment page for this specific payment session.
579
- *
580
- * Customer has to be forwarded to this URL where they can complete the payment.
581
- * The session is valid for 15 minutes for the customer to complete the payment.
582
- *
583
- * Please note! The URL is valid for 5 minutes.
584
- *
585
- * @example
586
- * redirectUrl: "https://paywith.pawapay.io/?token=AgV4aA3ZxKfGcdMIo6a6Upf7X2MRptdFUrc6Oi3U53CxC0YAkAADABVhd3MtY3J5cHRv"
587
- */
588
- redirectUrl: string;
589
- };
590
- type PawaPayError = {
591
- /**
592
- * @description A unique error ID in the pawaPay platform.
593
- *
594
- * Maximum length: 36
595
- *
596
- * @example errorId: "63743264-7292-11ea-bc55-0242ac130003"
597
- *
598
- */
599
- errorId?: string;
600
- /**
601
- * @description pawaPay internal error code.
602
- * @example errorCode: 1
603
- */
604
- errorCode?: number;
605
- /**
606
- * @description Error message.
607
- *
608
- * @example errorMessage: "Internal error"
609
- */
610
- errorMessage?: string;
611
- };
612
- type AcceptedDeposit = {
613
- /**
614
- * @description The depositId of the deposit transaction.
615
- *
616
- * Required string length: 36
617
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
618
- */
619
- depositId: string;
620
- /**
621
- * @description The deposit request has been accepted by pawaPay for processing.
622
- */
623
- status: "ACCEPTED";
624
- /**
625
- * ISO Date String
626
- * @example "2020-10-19T11:17:01Z"
627
- */
628
- created: string;
629
- };
630
- type DuplicatedIgnoredDeposit = {
631
- /**
632
- * @description The depositId of the deposit transaction.
633
- *
634
- * Required string length: 36
635
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
636
- */
637
- depositId: string;
638
- /**
639
- * @description The deposit request has been ignored as a duplicate of an already accepted deposit request. Duplication logic relies upon depositId.
640
- */
641
- status: "DUPLICATE_IGNORED";
642
- /**
643
- * ISO Date String
644
- * @example "2020-10-19T11:17:01Z"
645
- */
646
- created: string;
647
- };
648
- type RejectedDeposit = {
649
- /**
650
- * @description The depositId of the deposit transaction.
651
- *
652
- * Required string length: 36
653
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
654
- */
655
- depositId: string;
656
- /**
657
- * @description The deposit request has been rejected. See rejectionReason for details.
658
- */
659
- status: "REJECTED";
660
- rejectionReason: {
661
- /**
662
- * @description Possible deposit rejection codes:
663
- *
664
- * - INVALID_PAYER_FORMAT - The payer address (phone number) is invalid.
665
- * - INVALID_CORRESPONDENT - The specified correspondent is not supported.
666
- * - INVALID_AMOUNT - The specified amount is not supported.
667
- * - AMOUNT_TOO_SMALL - The specified amount is smaller than the minimum allowed by the MMO specified as the correspondent.
668
- * - AMOUNT_TOO_LARGE - The specified amount is larger than the maximum allowed by the MMO specified as the correspondent.
669
- * - INVALID_CURRENCY - The specified currency is not supported for the MMO specified as the correspondent.
670
- * - INVALID_COUNTRY - The specified country is not supported for this MMO specified as the correspondent.
671
- * - PARAMETER_INVALID - One or more parameters are invalid.
672
- * - INVALID_INPUT - We were unable to parse the payload of the request.
673
- * - DEPOSITS_NOT_ALLOWED - Deposits are not allowed for the merchant or the MMO specified as the correspondent.
674
- * - CORRESPONDENT_TEMPORARILY_UNAVAILABLE - The MMO specified as the correspondent is currently experiencing an outage and processing of payments has been temporarily halted.
675
- *
676
- * Please refer to our {@link https://status.pawapay.io/ | Status Page} for live information about MMO availability.
677
- *
678
- * @example rejectionCode: "INVALID_AMOUNT"
679
- *
680
- */
681
- rejectionCode: "INVALID_PAYER_FORMAT" | "INVALID_CORRESPONDENT" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "INVALID_CURRENCY" | "INVALID_COUNTRY" | "PARAMETER_INVALID" | "INVALID_INPUT" | "DEPOSITS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE";
682
- /**
683
- * Additional optional rejection message
684
- * @example rejectionMessage: "You don't have access to this correspondent"
685
- */
686
- rejectionMessage: string;
687
- };
688
- };
689
- type DepositResponse = AcceptedDeposit | DuplicatedIgnoredDeposit | RejectedDeposit;
690
- type CheckStatusBaseResponse = {
691
- /**
692
- * A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
693
- *
694
- * Required string length: 36
695
- *
696
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
697
- */
698
- depositId: string;
699
- /**
700
- * The amount to be collected (deposit) or disbursed (payout or refund).
701
- *
702
- * Amount must follow below requirements or the request will be rejected:
703
- * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
704
- * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.\
705
- * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
706
- * Trailing zeroes are permitted.
707
- *
708
- * Valid examples:
709
- * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
710
- *
711
- * Not valid examples:
712
- * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
713
- *
714
- * Required string length: 1 - 23
715
- *
716
- * @example requestedAmount: "15"
717
- */
718
- requestedAmout: string;
719
- /**
720
- * @description The currency in which the amount is specified.
721
- *
722
- * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
723
- *
724
- * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
725
- *
726
- * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
727
- *
728
- * @example Example: "MWK"
729
- */
730
- currency: string;
731
- /**
732
- * @description The country in which the MMO operates.
733
- *
734
- * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
735
- *
736
- * @example Example: "MWI"
737
- */
738
- country: string;
739
- /**
740
- * @description The correspondent code refers to the specific MMO that the specified phone number (MSISDN) has an active mobile money wallet with.
741
- *
742
- * You can find all the supported correspondents {@link https://docs.pawapay.io/using_the_api#correspondents | listed here}.
743
- *
744
- * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account.
745
- *
746
- * You can use the {@link https://docs.pawapay.io/v1/api-reference/toolkit/predict-correspondent | predict correspondent} enpoint to predict the correct correspondent to use based on the phone number (MSISDN).
747
- *
748
- * @example
749
- * Example: "AIRTEL_MWI"
750
- */
751
- correspondent: string;
752
- /**
753
- * @description The phone number (MSISDN) of the recipient or payer must be specified as the `value` of the `address`.
754
- */
755
- payer: {
756
- /** @description The type of financial address. At the moment, only MSISDN is supported as the financial address.
757
- * @example
758
- * {
759
- * type: "MSISDN"
760
- * }
761
- */
762
- type: "MSISDN" & string;
763
- /**
764
- * @description The phone number (MSISDN) of the payer or recipient.
765
- *
766
- * The format is described in {@link https://en.wikipedia.org/wiki/MSISDN | Wikipedia}.
767
- *
768
- * MSISDN validation has following rules:
769
- *
770
- * - Only digits without whitespaces or any other separators or prefixes like '+'
771
- * - Should not start with zero.
772
- * - Country code is mandatory.
773
- * - Should not exceed or be less than the valid length of specified country.
774
- * - Valid examples for Malawi: 265999123456
775
- *
776
- * Not valid examples for Malawi:
777
- * +265999123456, +2650999123456, 265 999 123 456, 265-9991-23456, 0265999123456,
778
- *
779
- * @example {value: "260763456789"}
780
- *
781
- */
782
- address: {
783
- value: string;
784
- };
785
- };
786
- /**
787
- * @description The timestamp of when the deposit was created in the pawaPay platform.
788
- *
789
- * Format defined by 'date-time' in RFC3339 section 5.6 from {@link https://tools.ietf.org/html/rfc3339#section-5.6 | IETF}
790
- *
791
- * @example Example:"2020-02-21T17:32:28Z"
792
- */
793
- customerTimestamp: string;
794
- /**
795
- * @description Short description for the transaction.
796
- *
797
- * Depending on the specific MMO performing the transaction this message may be visible to the customer in the SMS receipt or within their transaction history.
798
- *
799
- * Must be between 4 and 22 alphanumeric characters.
800
- *
801
- * Required string length: 4 - 22
802
- *
803
- * @example Example: "Note of 4 to 22 chars"
804
- */
805
- statementDescription: string;
806
- /**
807
- * ISO Date String
808
- * @example "2020-10-19T11:17:01Z"
809
- */
810
- created: string;
811
- /**
812
- * @description The metadata that was provided in the original initation request in a JSON object format.
813
- */
814
- metadata: {};
815
- };
816
- type CompletedStatus = CheckStatusBaseResponse & {
817
- /**
818
- * @description The payout request has been successfully processed. This is a Final state.
819
- */
820
- status: "COMPLETED";
821
- /**
822
- * @description The amount to be collected (deposit) or disbursed (payout or refund).
823
- *
824
- * Amount must follow below requirements or the request will be rejected:
825
- *
826
- * Between zero and two decimal places can be supplied, depending on what the specific MMO supports. Learn about all MMO supported decimal places.
827
- * The minimum and maximum amount depends on the limits of the specific MMO. You can find them from the Active Configuration endpoint.
828
- * Leading zeroes are not permitted except where the value is less than 1. For any value less than one, one and only one leading zero must be supplied.
829
- * Trailing zeroes are permitted.
830
- *
831
- * Valid examples:
832
- * 5, 5.0, 5.00, 5.5, 5.55, 5555555, 0.5
833
- *
834
- * Not valid examples:
835
- *
836
- * 5., 5.555, 5555555555555555555, .5, -5.5, 00.5, 00.00, 00001.32
837
- *
838
- * Required string length: 1 - 23
839
- *
840
- * @example depositedAmount: "15"
841
- */
842
- depositedAmount: string;
843
- /**
844
- * When the MMO responded to this deposit request. Format defined by 'date-time' in RFC3339 section 5.6 from IETF
845
- *
846
- * @example
847
- * respondedByPayer: "2020-02-21T17:32:30Z"
848
- */
849
- respondedByPayer: string;
850
- /**
851
- * @description The unique ID for this financial transaction assigned by the MMO.
852
- * @example
853
- * {
854
- "MTN_INIT": "ABC123",
855
- "MTN_FINAL": "DEF456"
856
- }
857
- */
858
- correspondentIds: {
859
- [key: string]: string;
860
- };
861
- };
862
- type AcceptedStatus = CheckStatusBaseResponse & {
863
- /**
864
- * @description The payout request has been accepted by pawaPay for processing.
865
- */
866
- status: "ACCEPTED";
867
- };
868
- type EnqueuedStatus = CheckStatusBaseResponse & {
869
- /**
870
- * @description The payout request has been accepted, but has been enqueued for processing later. Read more about {@link https://docs.pawapay.io/payouts#enqueued-payouts | enqueued payouts}.
871
- */
872
- status: "ENQUEUED";
873
- };
874
- type SubmittedStatus = CheckStatusBaseResponse & {
875
- /**
876
- * @description The payout request has been submitted to the MMO and is being processed.
877
- */
878
- status: "SUBMITTED";
879
- };
880
- type FailedStatus = CheckStatusBaseResponse & {
881
- /**
882
- * @description The payout request has been processed, but failed. Final state.
883
- */
884
- status: "FAILED";
885
- failureReason: {
886
- /**
887
- * @description Possible deposit failure codes:
888
- *
889
- * - PAYER_NOT_FOUND - The phone number specified as the Payer does not belong to the MMO specified as the correspondent.
890
- * - PAYMENT_NOT_APPROVED - Payer did not approve the payment.
891
- * - PAYER_LIMIT_REACHED - Payer has reached a transaction limit of their mobile money wallet.
892
- * - INSUFFICIENT_BALANCE - Payer does not have enough funds.
893
- * - TRANSACTION_ALREADY_IN_PROCESS - Payer already has an unfinalized transaction being processed by the MMO.
894
- * - OTHER_ERROR - Any other error. Please refer to failureMessage.
895
- *
896
- * @example failureCode: "OTHER_ERROR"
897
- */
898
- failureCode: "PAYER_NOT_FOUND" | "PAYMENT_NOT_APPROVED" | "PAYER_LIMIT_REACHED" | "INSUFFICIENT_BALANCE" | "TRANSACTION_ALREADY_IN_PROCESS" | "OTHER_ERROR";
899
- /**
900
- * @description Additional optional failure message
901
- * @example failureMessage: "Recipient's address is blocked"
902
- */
903
- failureMessage: string;
904
- };
1320
+ failureMessage: string;
1321
+ };
905
1322
  };
906
1323
  type DepositStatus = CompletedStatus | AcceptedStatus | EnqueuedStatus | SubmittedStatus | FailedStatus;
907
1324
  type ResendDepositBase = {
908
- /**
909
- * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
910
- *
911
- * Required string length: 36
912
- *
913
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
914
- */
915
- despositId: string;
1325
+ /**
1326
+ * @description A UUIDv4 based ID specified by you, that uniquely identifies the deposit.
1327
+ *
1328
+ * Required string length: 36
1329
+ *
1330
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1331
+ */
1332
+ despositId: string;
916
1333
  };
917
1334
  type ResendDepositAccepted = ResendDepositBase & {
918
- /**
919
- *@description The manual action request has been accepted by pawaPay for processing. */
920
- status: "ACCEPTED";
1335
+ /**
1336
+ *@description The manual action request has been accepted by pawaPay for processing. */
1337
+ status: "ACCEPTED";
921
1338
  };
922
1339
  type ResendDepositRejected = ResendDepositBase & {
923
- /**
924
- *@description The manual action request has been rejected by pawaPay. See rejectionReason for details. */
925
- status: "REJECTED";
926
- /**
927
- * @description Human-readable explanation why request has been rejected
928
- * @example rejectionReason:"Deposit with ID \\#f4401bd2-1568-4140-bf2d-eb77d2b2b639 not found"
929
- */
930
- rejectionReason: string;
1340
+ /**
1341
+ *@description The manual action request has been rejected by pawaPay. See rejectionReason for details. */
1342
+ status: "REJECTED";
1343
+ /**
1344
+ * @description Human-readable explanation why request has been rejected
1345
+ * @example rejectionReason:"Deposit with ID \\#f4401bd2-1568-4140-bf2d-eb77d2b2b639 not found"
1346
+ */
1347
+ rejectionReason: string;
931
1348
  };
932
1349
  type ResendDepositFailed = ResendDepositBase & {
933
- /**
934
- *@description The manual action request has failed during submitting for processing due to internal reasons. */
935
- status: "FAILED";
1350
+ /**
1351
+ *@description The manual action request has failed during submitting for processing due to internal reasons. */
1352
+ status: "FAILED";
936
1353
  };
937
1354
  type ResendDepositResponse = ResendDepositAccepted | ResendDepositRejected | ResendDepositFailed;
938
1355
  type AcceptedRefund = {
939
- /**
940
- * @description The refundId of the deposit transaction.
941
- *
942
- * Required string length: 36
943
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
944
- */
945
- refundId: string;
946
- /**
947
- * @description The refund request has been accepted by pawaPay for processing.
948
- */
949
- status: "ACCEPTED";
950
- /**
951
- * ISO Date String
952
- * @example "2020-10-19T11:17:01Z"
953
- */
954
- created: string;
1356
+ /**
1357
+ * @description The refundId of the deposit transaction.
1358
+ *
1359
+ * Required string length: 36
1360
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1361
+ */
1362
+ refundId: string;
1363
+ /**
1364
+ * @description The refund request has been accepted by pawaPay for processing.
1365
+ */
1366
+ status: "ACCEPTED";
1367
+ /**
1368
+ * ISO Date String
1369
+ * @example "2020-10-19T11:17:01Z"
1370
+ */
1371
+ created: string;
955
1372
  };
956
1373
  type DuplicatedIgnoredRefund = {
957
- /**
958
- * @description The refundId of the deposit transaction.
959
- *
960
- * Required string length: 36
961
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
962
- */
963
- depositId: string;
964
- /**
965
- * @description The refund request has been ignored as a duplicate of an already accepted refund request. Duplication logic relies upon refundId.
966
- */
967
- status: "DUPLICATE_IGNORED";
968
- /**
969
- * ISO Date String
970
- * @example "2020-10-19T11:17:01Z"
971
- */
972
- created: string;
1374
+ /**
1375
+ * @description The refundId of the deposit transaction.
1376
+ *
1377
+ * Required string length: 36
1378
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1379
+ */
1380
+ depositId: string;
1381
+ /**
1382
+ * @description The refund request has been ignored as a duplicate of an already accepted refund request. Duplication logic relies upon refundId.
1383
+ */
1384
+ status: "DUPLICATE_IGNORED";
1385
+ /**
1386
+ * ISO Date String
1387
+ * @example "2020-10-19T11:17:01Z"
1388
+ */
1389
+ created: string;
973
1390
  };
974
1391
  type RejectedRefund = {
975
- /**
976
- * @description The refundId of the deposit transaction.
977
- *
978
- * Required string length: 36
979
- * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
980
- */
981
- refundId: string;
982
- /**
983
- * @description The refund request has been rejected by pawaPay. See rejectionReason for details.
984
- */
985
- status: "REJECTED";
986
- rejectionReason: {
987
- /**
988
- * @description Possible deposit rejection codes:
989
- *
990
- * - DEPOSIT_NOT_FOUND- Requested deposit for refund has not been found.
991
- * - DEPOSIT_NOT_COMPLETED- Requested deposit was not completed.
992
- * - ALREADY_REFUNDED- Requested deposit has been already refunded.
993
- * - IN_PROGRESS- Another refund transaction is already in progress.
994
- * - INVALID_AMOUNT- The specified amount is not supported.
995
- * - AMOUNT_TOO_SMALL - The specified amount is smaller than the minimum allowed by the MMO specified as the correspondent.
996
- * - AMOUNT_TOO_LARGE - The specified amount is larger than the maximum allowed by the MMO specified as the correspondent.
997
- * - INVALID_CURRENCY - The specified currency is not supported by the MMO specified as the correspondent.
998
- * - INVALID_COUNTRY - The specified country is not supported for the MMO specified as the correspondent.
999
- * - PARAMETER_INVALID - One or more parameters are invalid.
1000
- * - INVALID_INPUT - We were unable to parse the payload of the request.
1001
- * - REFUNDS_NOT_ALLOWED - Refunds are not allowed for this merchant or the MMO specified as the correspondent.
1002
- * - CORRESPONDENT_TEMPORARILY_UNAVAILABLE - The MMO specified as the correspondent is currently experiencing an outage and processing of payments has been temporarily halted.
1003
- *
1004
- * Please refer to our {@link https://status.pawapay.io/ | Status Page} for live information about MMO availability.
1005
- *
1006
- * @example rejectionCode: "INVALID_AMOUNT"
1007
- *
1008
- */
1009
- rejectionCode: "DEPOSIT_NOT_FOUND" | "DEPOSIT_NOT_COMPLETED" | "ALREADY_REFUNDED" | "IN_PROGRESS" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "PARAMETER_INVALID" | "INVALID_INPUT" | "REFUNDS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE";
1010
- /**
1011
- * Additional optional rejection message
1012
- * @example rejectionMessage: "You don't have access to this correspondent"
1013
- */
1014
- rejectionMessage: string;
1015
- };
1392
+ /**
1393
+ * @description The refundId of the deposit transaction.
1394
+ *
1395
+ * Required string length: 36
1396
+ * @example depositId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1397
+ */
1398
+ refundId: string;
1399
+ /**
1400
+ * @description The refund request has been rejected by pawaPay. See rejectionReason for details.
1401
+ */
1402
+ status: "REJECTED";
1403
+ rejectionReason: {
1404
+ /**
1405
+ * @description Possible deposit rejection codes:
1406
+ *
1407
+ * - DEPOSIT_NOT_FOUND- Requested deposit for refund has not been found.
1408
+ * - DEPOSIT_NOT_COMPLETED- Requested deposit was not completed.
1409
+ * - ALREADY_REFUNDED- Requested deposit has been already refunded.
1410
+ * - IN_PROGRESS- Another refund transaction is already in progress.
1411
+ * - INVALID_AMOUNT- The specified amount is not supported.
1412
+ * - AMOUNT_TOO_SMALL - The specified amount is smaller than the minimum allowed by the MMO specified as the correspondent.
1413
+ * - AMOUNT_TOO_LARGE - The specified amount is larger than the maximum allowed by the MMO specified as the correspondent.
1414
+ * - INVALID_CURRENCY - The specified currency is not supported by the MMO specified as the correspondent.
1415
+ * - INVALID_COUNTRY - The specified country is not supported for the MMO specified as the correspondent.
1416
+ * - PARAMETER_INVALID - One or more parameters are invalid.
1417
+ * - INVALID_INPUT - We were unable to parse the payload of the request.
1418
+ * - REFUNDS_NOT_ALLOWED - Refunds are not allowed for this merchant or the MMO specified as the correspondent.
1419
+ * - CORRESPONDENT_TEMPORARILY_UNAVAILABLE - The MMO specified as the correspondent is currently experiencing an outage and processing of payments has been temporarily halted.
1420
+ *
1421
+ * Please refer to our {@link https://status.pawapay.io/ | Status Page} for live information about MMO availability.
1422
+ *
1423
+ * @example rejectionCode: "INVALID_AMOUNT"
1424
+ *
1425
+ */
1426
+ rejectionCode: "DEPOSIT_NOT_FOUND" | "DEPOSIT_NOT_COMPLETED" | "ALREADY_REFUNDED" | "IN_PROGRESS" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "PARAMETER_INVALID" | "INVALID_INPUT" | "REFUNDS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE";
1427
+ /**
1428
+ * Additional optional rejection message
1429
+ * @example rejectionMessage: "You don't have access to this correspondent"
1430
+ */
1431
+ rejectionMessage: string;
1432
+ };
1016
1433
  };
1017
1434
  type RequestRefundResponse = AcceptedRefund | RejectedRefund | DuplicatedIgnoredRefund;
1018
1435
  type ResendRefundBase = {
1019
- /**
1020
- * @description The refundId of the refund transaction.
1021
- *
1022
- * Required string length: 36
1023
- *
1024
- * @example refundId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1025
- */
1026
- refundId: string;
1436
+ /**
1437
+ * @description The refundId of the refund transaction.
1438
+ *
1439
+ * Required string length: 36
1440
+ *
1441
+ * @example refundId: "f4401bd2-1568-4140-bf2d-eb77d2b2b639"
1442
+ */
1443
+ refundId: string;
1027
1444
  };
1028
1445
  type ResendRefundAccepted = ResendRefundBase & {
1029
- /**
1030
- *@description The manual action request has been accepted by pawaPay for processing. */
1031
- status: "ACCEPTED";
1446
+ /**
1447
+ *@description The manual action request has been accepted by pawaPay for processing. */
1448
+ status: "ACCEPTED";
1032
1449
  };
1033
1450
  type ResendRefundRejected = ResendRefundBase & {
1034
- /**
1035
- *@description The manual action request has been rejected by pawaPay. See rejectionReason for details. */
1036
- status: "REJECTED";
1037
- /**
1038
- * @description Human-readable explanation why request has been rejected
1039
- * @example rejectionReason:"Refund with ID \\#f4401bd2-1568-4140-bf2d-eb77d2b2b639 not found"
1040
- */
1041
- rejectionReason: string;
1451
+ /**
1452
+ *@description The manual action request has been rejected by pawaPay. See rejectionReason for details. */
1453
+ status: "REJECTED";
1454
+ /**
1455
+ * @description Human-readable explanation why request has been rejected
1456
+ * @example rejectionReason:"Refund with ID \\#f4401bd2-1568-4140-bf2d-eb77d2b2b639 not found"
1457
+ */
1458
+ rejectionReason: string;
1042
1459
  };
1043
1460
  type ResendRefundFailed = ResendRefundBase & {
1044
- /**
1045
- *@description The manual action request has failed during submitting for processing due to internal reasons. */
1046
- status: "FAILED";
1461
+ /**
1462
+ *@description The manual action request has failed during submitting for processing due to internal reasons. */
1463
+ status: "FAILED";
1047
1464
  };
1048
1465
  type ResendRefundCallbackResponse = ResendRefundAccepted | ResendRefundRejected | ResendRefundFailed;
1049
1466
  type CheckRefundStatusBase = {
1050
- refundId: string;
1051
- status: string;
1052
- amount: string;
1053
- currency: string;
1054
- country: string;
1055
- correspondent: string;
1056
- recipient: {
1057
- type: string;
1058
- address: {
1059
- value: string;
1060
- };
1467
+ refundId: string;
1468
+ status: string;
1469
+ amount: string;
1470
+ currency: string;
1471
+ country: string;
1472
+ correspondent: string;
1473
+ recipient: {
1474
+ type: string;
1475
+ address: {
1476
+ value: string;
1061
1477
  };
1062
- customerTimestamp: string;
1063
- statementDescription: string;
1064
- created: string;
1065
- metadata: {};
1478
+ };
1479
+ customerTimestamp: string;
1480
+ statementDescription: string;
1481
+ created: string;
1482
+ metadata: Record<string, unknown>;
1066
1483
  };
1067
1484
  type CheckRefundStatusCompleted = CheckRefundStatusBase & {
1068
- status: "COMPLETED";
1069
- receivedByRecipient: string;
1070
- correspondentIds: {};
1485
+ status: "COMPLETED";
1486
+ receivedByRecipient: string;
1487
+ correspondentIds: Record<string, unknown>;
1071
1488
  };
1072
1489
  type CheckRefundStatusAccepted = CheckRefundStatusBase & {
1073
- status: "ACCEPTED";
1490
+ status: "ACCEPTED";
1074
1491
  };
1075
1492
  type CheckRefundStatusSubmitted = CheckRefundStatusBase & {
1076
- status: "SUBMITTED";
1493
+ status: "SUBMITTED";
1077
1494
  };
1078
1495
  type CheckRefundStatusFailed = CheckRefundStatusBase & {
1079
- status: "FAILED";
1080
- failureReason: {
1081
- failureCode: string;
1082
- failureMessage: string;
1083
- };
1496
+ status: "FAILED";
1497
+ failureReason: {
1498
+ failureCode: string;
1499
+ failureMessage: string;
1500
+ };
1084
1501
  };
1085
1502
  type CheckRefundStatusResponse = CheckRefundStatusCompleted | CheckRefundStatusAccepted | CheckRefundStatusSubmitted | CheckRefundStatusFailed;
1086
1503
  type RefundCallback = {
1087
- refundId: string;
1088
- status: string;
1089
- amount: string;
1090
- currency: string;
1091
- country: string;
1092
- correspondent: string;
1093
- recipient: {
1094
- type: string;
1095
- address: {
1096
- value: string;
1097
- };
1504
+ refundId: string;
1505
+ status: string;
1506
+ amount: string;
1507
+ currency: string;
1508
+ country: string;
1509
+ correspondent: string;
1510
+ recipient: {
1511
+ type: string;
1512
+ address: {
1513
+ value: string;
1098
1514
  };
1099
- customerTimestamp: string;
1100
- statementDescription: string;
1101
- created: string;
1102
- receivedByRecipient: string;
1103
- correspondentIds: {};
1104
- failureReason: {
1105
- failureCode: string;
1106
- failureMessage: string;
1107
- };
1108
- metadata: {};
1515
+ };
1516
+ customerTimestamp: string;
1517
+ statementDescription: string;
1518
+ created: string;
1519
+ receivedByRecipient: string;
1520
+ correspondentIds: Record<string, unknown>;
1521
+ failureReason: {
1522
+ failureCode: string;
1523
+ failureMessage: string;
1524
+ };
1525
+ metadata: Record<string, unknown>;
1109
1526
  };
1110
1527
  type WalletBalance = {
1111
- balances: {
1112
- /**
1113
- * @description The country in which the MMO operates.
1114
- *
1115
- * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
1116
- *
1117
- * @example Example: "MWI"
1118
- */
1119
- country: string;
1120
- /**
1121
- * @description The current balance of the wallet.
1122
- *
1123
- * @example balance: "1000.0"
1124
- */
1125
- balance: string;
1126
- /**
1127
- * @description The currency in which the amount is specified.
1128
- *
1129
- * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
1130
- *
1131
- * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
1132
- *
1133
- * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
1134
- *
1135
- * @example Example: "MWK"
1136
- */
1137
- currency: string;
1138
- /**
1139
- * @example If you are using a wallet that is only used by a single MMO, that MMO-s correspondent code will be shown here.
1140
- *
1141
- * @example mno: "AIRTEL_MWI"
1142
- */
1143
- mno: string;
1144
- }[];
1528
+ balances: {
1529
+ /**
1530
+ * @description The country in which the MMO operates.
1531
+ *
1532
+ * Format is ISO 3166-1 alpha-3, three character country code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements | Wikipedia}.
1533
+ *
1534
+ * @example Example: "MWI"
1535
+ */
1536
+ country: string;
1537
+ /**
1538
+ * @description The current balance of the wallet.
1539
+ *
1540
+ * @example balance: "1000.0"
1541
+ */
1542
+ balance: string;
1543
+ /**
1544
+ * @description The currency in which the amount is specified.
1545
+ *
1546
+ * Format must be the ISO 4217 three character currency code in upper case. Read more from {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes |Wikipedia}.
1547
+ *
1548
+ * You can find all the supported currencies that the specific correspondent supports {@link https://docs.pawapay.io/using_the_api#correspondents | from here}.
1549
+ *
1550
+ * The {@link https://docs.pawapay.io/v1/api-reference/toolkit/active-configuration | active configuration} endpoint provides the list of correspondents configured for your account together with the currencies.
1551
+ *
1552
+ * @example Example: "MWK"
1553
+ */
1554
+ currency: string;
1555
+ /**
1556
+ * @example If you are using a wallet that is only used by a single MMO, that MMO-s correspondent code will be shown here.
1557
+ *
1558
+ * @example mno: "AIRTEL_MWI"
1559
+ */
1560
+ mno: string;
1561
+ }[];
1145
1562
  };
1146
1563
  type OperationalType = {
1147
- operationType: string;
1148
- minTransactionLimit: string;
1149
- maxTransactionLimit: string;
1564
+ operationType: string;
1565
+ minTransactionLimit: string;
1566
+ maxTransactionLimit: string;
1150
1567
  };
1151
1568
  type Correspondent = {
1152
- correspondent: string;
1153
- currency: string;
1154
- ownerName: string;
1155
- operationTypes: Array<OperationalType>;
1569
+ correspondent: string;
1570
+ currency: string;
1571
+ ownerName: string;
1572
+ operationTypes: Array<OperationalType>;
1156
1573
  };
1157
1574
  interface Countries<T> {
1158
- country: string;
1159
- correspondents: Array<T>;
1575
+ country: string;
1576
+ correspondents: Array<T>;
1160
1577
  }
1161
1578
  type ActiveConfigurationResponse = {
1162
- merchantId: string;
1163
- merchantName: string;
1164
- countries: Array<Countries<Correspondent>>;
1579
+ merchantId: string;
1580
+ merchantName: string;
1581
+ countries: Array<Countries<Correspondent>>;
1165
1582
  };
1166
1583
  type CorrespondentOperationalType = {
1167
- operationType: "DEPOSIT" | "PAYOUT";
1168
- status: "OPERATIONAL" | "DELAYED" | "CLOSED";
1584
+ operationType: "DEPOSIT" | "PAYOUT";
1585
+ status: "OPERATIONAL" | "DELAYED" | "CLOSED";
1169
1586
  };
1170
1587
  type CorrespondentData = {
1171
- correspondent: string;
1172
- operationalType: Array<CorrespondentOperationalType>;
1588
+ correspondent: string;
1589
+ operationalType: Array<CorrespondentOperationalType>;
1173
1590
  };
1174
- interface AvailableCorrespondentResponse extends Countries<CorrespondentData> {
1175
- }
1591
+ interface AvailableCorrespondentResponse extends Countries<CorrespondentData> {}
1176
1592
  interface PredictCorrespondentResponse {
1177
- country: string;
1178
- operator: string;
1179
- correspondent: string;
1180
- msisdn: string;
1593
+ country: string;
1594
+ operator: string;
1595
+ correspondent: string;
1596
+ msisdn: string;
1181
1597
  }
1182
1598
  type PublicKeysResponse = {
1183
- /**
1184
- * @description The ID of the public key. */
1185
- id: string;
1186
- /**
1187
- * @description The public key to use when verifying the signature in a callback sent by pawaPay. */
1188
- key: string;
1189
- };
1190
-
1191
- type ClientConfig = {
1192
- environment?: "live" | "sandbox";
1193
- overrideUrl?: string;
1194
- };
1195
- declare class PawaPayClient {
1196
- private apiClient;
1197
- protected apiKey: string;
1198
- private config?;
1199
- constructor(apiKey: string, config?: ClientConfig);
1200
- private request;
1201
- requestDeposit(data: DepositConfig, { options }?: {
1202
- options?: RequestOptions;
1203
- }): Promise<PawaPayResponse<DepositResponse, PawaPayError>>;
1204
- checkDepositStatus(depositId: string, { options }?: {
1205
- options?: RequestOptions;
1206
- }): Promise<PawaPayResponse<DepositStatus[], PawaPayError>>;
1207
- resendDepositCallback(depositId: string, { options }?: {
1208
- options?: RequestOptions;
1209
- }): Promise<PawaPayResponse<ResendDepositResponse, PawaPayError>>;
1210
- requestPayout(data: RequestPayoutConfig, { options }?: {
1211
- options?: RequestOptions;
1212
- }): Promise<PawaPayResponse<RequestPayoutRespose, PawaPayError>>;
1213
- checkPayoutStatus(payoutId: string, { options }?: {
1214
- options?: RequestOptions;
1215
- }): Promise<PawaPayResponse<CheckPayoutStatusResponse[], PawaPayError>>;
1216
- resendPayoutCallback(payoutId: string, { options }?: {
1217
- options?: RequestOptions;
1218
- }): Promise<PawaPayResponse<ResendPayoutCallbackResponse, PawaPayError>>;
1219
- cancelEnqueuedPayout(payoutId: string, { options }?: {
1220
- options?: RequestOptions;
1221
- }): Promise<PawaPayResponse<CancelEnqueuedPayoutResponse, PawaPayError>>;
1222
- requestBulkPayout(data: RequestBulkPayoutConfig[], { options }?: {
1223
- options?: RequestOptions;
1224
- }): Promise<PawaPayResponse<RequestBuildPayoutResponse[], PawaPayError>>;
1225
- requestRefund(refundConfig: RequestRefundConfig, { options }?: {
1226
- options?: RequestOptions;
1227
- }): Promise<PawaPayResponse<RequestRefundResponse, PawaPayError>>;
1228
- checkRefundStatus(refundId: string, { options }?: {
1229
- options?: RequestOptions;
1230
- }): Promise<PawaPayResponse<CheckRefundStatusResponse[], PawaPayError>>;
1231
- resendRefundCallback(refundId: string, { options }?: {
1232
- options?: RequestOptions;
1233
- }): Promise<PawaPayResponse<ResendRefundCallbackResponse, PawaPayError>>;
1234
- requestPaymentPage(payload: RequestPayPageConfig, { options }?: {
1235
- options?: RequestOptions;
1236
- }): Promise<PawaPayResponse<RequestPayPageResponse, PawaPayError>>;
1237
- checkWalletBalances({ options }?: {
1238
- options?: RequestOptions;
1239
- }): Promise<PawaPayResponse<WalletBalance, PawaPayError>>;
1240
- checkWalletBalancesByCountry(country: string, { options }?: {
1241
- options?: RequestOptions;
1242
- }): Promise<PawaPayResponse<WalletBalance, PawaPayError>>;
1243
- getActiveConfiguration({ options }?: {
1244
- options?: RequestOptions;
1245
- }): Promise<PawaPayResponse<ActiveConfigurationResponse, PawaPayError>>;
1246
- getAvailableCorrespondent({ options }?: {
1247
- options?: RequestOptions;
1248
- }): Promise<PawaPayResponse<AvailableCorrespondentResponse[], PawaPayError>>;
1249
- predictCorrespondent(msisdn: string, { options }?: {
1250
- options?: RequestOptions;
1251
- }): Promise<PawaPayResponse<PredictCorrespondentResponse, PawaPayError>>;
1252
- getPublicKey({ options }?: {
1253
- options?: RequestOptions;
1254
- }): Promise<PawaPayResponse<PublicKeysResponse[], PawaPayError>>;
1599
+ /**
1600
+ * @description The ID of the public key. */
1601
+ id: string;
1602
+ /**
1603
+ * @description The public key to use when verifying the signature in a callback sent by pawaPay. */
1604
+ key: string;
1605
+ };
1606
+ //#endregion
1607
+ //#region src/types/v2/active-conf.t.d.ts
1608
+ type OperationTypeCode = "DEPOSIT" | "PAYOUT" | "REFUND" | "REMITTANCE" | "USSD_DEPOSIT" | "NAME_LOOKUP";
1609
+ type OperationStatus = "OPERATIONAL" | "DELAYED" | "CLOSED";
1610
+ type DecimalsInAmount = "NONE" | "FIXED" | "VARIABLE";
1611
+ type AuthType = "PROVIDER_AUTH";
1612
+ type PinPromptType = "AUTOMATIC" | "MANUAL";
1613
+ type ChannelType = "USSD";
1614
+ interface ActiveConfiguration {
1615
+ companyName: string;
1616
+ signatureConfiguration: SignatureConfiguration;
1617
+ countries: Country[];
1618
+ }
1619
+ interface SignatureConfiguration {
1620
+ signedRequestsOnly: boolean;
1621
+ signedCallbacks: boolean;
1622
+ }
1623
+ interface DisplayName {
1624
+ en: string;
1625
+ fr: string;
1626
+ }
1627
+ interface Country {
1628
+ country: string;
1629
+ displayName: DisplayName;
1630
+ prefix: string;
1631
+ flag: string;
1632
+ providers: Provider[];
1633
+ }
1634
+ interface Provider {
1635
+ provider: string;
1636
+ displayName: string;
1637
+ logo: string;
1638
+ nameDisplayedToCustomer: string;
1639
+ currencies: Currency[];
1640
+ }
1641
+ interface Currency {
1642
+ currency: string;
1643
+ displayName: string;
1644
+ operationTypes: OperationType[];
1645
+ }
1646
+ interface OperationType {
1647
+ operationType: OperationTypeCode;
1648
+ config?: DepositConfig$1;
1649
+ minTransactionLimit?: string;
1650
+ maxTransactionLimit?: string;
1651
+ decimalsInAmount?: DecimalsInAmount;
1652
+ status?: OperationStatus;
1653
+ callbackUrl?: string;
1654
+ }
1655
+ interface PinPromptInstructions {
1656
+ channels: Channel[];
1657
+ }
1658
+ interface Channel {
1659
+ type: ChannelType;
1660
+ displayName: DisplayName;
1661
+ quickLink: string;
1662
+ variables: Variables;
1663
+ instructions: Instructions;
1664
+ }
1665
+ interface Variables {
1666
+ shortCode: string;
1667
+ }
1668
+ interface Instructions {
1669
+ en: Instruction[];
1670
+ fr: Instruction[];
1671
+ }
1672
+ interface Instruction {
1673
+ text: string;
1674
+ template: string;
1255
1675
  }
1256
-
1257
- export { type ActiveConfigurationResponse, type AvailableCorrespondentResponse, type CancelEnqueuedPayoutResponse, type CheckPayoutStatusResponse, type CheckRefundStatusResponse, type DepositConfig, type DepositResponse, type DepositStatus, PawaPayClient, type PawaPayError, type PawaPayResponse, type PayoutCallback, type PredictCorrespondentResponse, type PublicKeysResponse, type RefundCallback, type RequestBuildPayoutResponse, type RequestBulkPayoutConfig, type RequestOptions, type RequestPayPageConfig, type RequestPayPageResponse, type RequestPayoutConfig, type RequestPayoutRespose, type RequestRefundConfig, type RequestRefundResponse, type ResendDepositResponse, type ResendPayoutCallbackResponse, type ResendRefundCallbackResponse, type WalletBalance };
1676
+ interface DepositConfig$1 {
1677
+ authType: AuthType;
1678
+ pinPrompt: PinPromptType;
1679
+ pinPromptRevivable: boolean;
1680
+ pinPromptInstructions: PinPromptInstructions;
1681
+ }
1682
+ //#endregion
1683
+ //#region src/types/v2/payouts.t.d.ts
1684
+ type ResendPayoutCallbackResponse_v2 = {
1685
+ remittanceId: string;
1686
+ status: "ACCEPTED";
1687
+ } | {
1688
+ remittanceId: string;
1689
+ status: "REJECTED";
1690
+ failureReason: {
1691
+ failureCode: "NOT_FOUND" | "INVALID_STATE";
1692
+ failureMessage: string;
1693
+ };
1694
+ };
1695
+ type CancelEnqueuedPayoutResponse_v2 = {
1696
+ remittanceId: string;
1697
+ status: "ACCEPTED";
1698
+ } | {
1699
+ remittanceId: string;
1700
+ status: "REJECTED";
1701
+ failureReason: {
1702
+ failureCode: "NOT_FOUND" | "INVALID_STATE";
1703
+ failureMessage: string;
1704
+ };
1705
+ };
1706
+ type RequestPayoutConfig_v2 = {
1707
+ payoutId: string;
1708
+ recipient: {
1709
+ type: "MMO";
1710
+ accountDetails: {
1711
+ phoneNumber: string;
1712
+ provider: string;
1713
+ };
1714
+ };
1715
+ amount: string;
1716
+ currency: string;
1717
+ clientReferenceId: string;
1718
+ customerMessage: string;
1719
+ metadata: Array<Record<string, unknown>>;
1720
+ };
1721
+ type RequestPayoutResponse_v2 = {
1722
+ payoutId: string;
1723
+ status: "ACCEPTED" | "DUPLICATE_IGNORED";
1724
+ created: string;
1725
+ } | {
1726
+ payoutId: string;
1727
+ status: "REJECTED";
1728
+ failureReason: {
1729
+ failureCode: "PROVIDER_TEMPORARILY_UNAVAILABLE" | "INVALID_PHONE_NUMBER" | "INVALID_CURRENCY" | "INVALID_AMOUNT" | "AMOUNT_OUT_OF_BOUNDS";
1730
+ failureMessage: string;
1731
+ };
1732
+ };
1733
+ type CheckPayoutData_v2 = {
1734
+ payoutId: string;
1735
+ amount: string;
1736
+ currency: string;
1737
+ country: string;
1738
+ recipient: {
1739
+ type: "MMO";
1740
+ accountDetails: {
1741
+ phoneNumber: string;
1742
+ provider: string;
1743
+ };
1744
+ };
1745
+ clientReferenceId: string;
1746
+ customerMessage: string;
1747
+ created: string;
1748
+ metadata: object;
1749
+ } & ({
1750
+ status: "COMPLETED";
1751
+ providerTransactionId: string;
1752
+ } | {
1753
+ status: "FAILED";
1754
+ failureReason: {
1755
+ failureCode: "RECIPIENT_NOT_FOUND";
1756
+ failureMessage: string;
1757
+ };
1758
+ } | {
1759
+ status: "ACCEPTED" | "PROCESSING" | "IN_RECONCILIATION";
1760
+ });
1761
+ type CheckPayoutStatus_v2 = {
1762
+ status: "FOUND";
1763
+ data: CheckPayoutData_v2;
1764
+ } | {
1765
+ status: "NOT_FOUND";
1766
+ };
1767
+ type BulkPayoutResponse_v2 = ({
1768
+ payoutId: string;
1769
+ status: "ACCEPTED" | "DUPLICATE_IGNORED";
1770
+ created: string;
1771
+ } | {
1772
+ payoutId: string;
1773
+ status: "REJECTED";
1774
+ failureReason: {
1775
+ failureCode: string;
1776
+ failureMessage: string;
1777
+ };
1778
+ })[];
1779
+ //#endregion
1780
+ //#region src/types/v2/paypage.t.d.ts
1781
+ type RequestPayPageConfig_v2 = {
1782
+ depositId: string;
1783
+ returnUrl: string;
1784
+ customerMessage: string;
1785
+ amountDetails: {
1786
+ amount: string;
1787
+ currency: string;
1788
+ };
1789
+ phoneNumber: string;
1790
+ language: string;
1791
+ country: string;
1792
+ reason: string;
1793
+ metadata: Array<Record<string, unknown>>;
1794
+ };
1795
+ //#endregion
1796
+ //#region src/types/v2/refunds.t.d.ts
1797
+ type RequestRefundConfig_v2 = {
1798
+ refundId: string;
1799
+ depositId: string;
1800
+ amount: string;
1801
+ currency: string;
1802
+ clientReferenceId: string;
1803
+ metadata: Array<Record<string, unknown>>;
1804
+ };
1805
+ type RequestRefundResponse_v2 = {
1806
+ refundId: string;
1807
+ status: "ACCEPTED";
1808
+ created: string;
1809
+ } | {
1810
+ refundId: string;
1811
+ status: "DUPLICATE_IGNORED";
1812
+ created: string;
1813
+ } | {
1814
+ refundId: string;
1815
+ status: "REJECTED";
1816
+ failureReason: {
1817
+ failureCode: "PROVIDER_TEMPORARILY_UNAVAILABLE" | "INVALID_PHONE_NUMBER" | "INVALID_CURRENCY" | "INVALID_AMOUNT" | "AMOUNT_OUT_OF_BOUNDS";
1818
+ failureMessage: string;
1819
+ };
1820
+ };
1821
+ type RefundStatusResponse_v2 = {
1822
+ status: "FOUND";
1823
+ data: {
1824
+ refundId: string;
1825
+ status: "COMPLETED" | "ACCEPTED";
1826
+ amount: string;
1827
+ currency: string;
1828
+ country: string;
1829
+ recipient: {
1830
+ type: "MMO";
1831
+ accountDetails: {
1832
+ phoneNumber: string;
1833
+ provider: string;
1834
+ };
1835
+ };
1836
+ clientReferenceId: string;
1837
+ customerMessage: string;
1838
+ created: string;
1839
+ providerTransactionId?: string;
1840
+ metadata: {
1841
+ orderId: string;
1842
+ customerId: string;
1843
+ };
1844
+ };
1845
+ } | {
1846
+ status: "NOT_FOUND";
1847
+ };
1848
+ type ResendRefundCallbackResponse_v2 = {
1849
+ remittanceId: string;
1850
+ status: "ACCEPTED";
1851
+ } | {
1852
+ remittanceId: string;
1853
+ status: "REJECTED";
1854
+ failureReason: {
1855
+ failureCode: "NOT_FOUND" | "INVALID_STATE";
1856
+ failureMessage: string;
1857
+ };
1858
+ };
1859
+ //#endregion
1860
+ //#region src/types/v2/remittence.t.d.ts
1861
+ type InitiateRemittanceConfig = {
1862
+ remittanceId: string;
1863
+ recipient: {
1864
+ type: string;
1865
+ accountDetails: {
1866
+ phoneNumber: string;
1867
+ provider: string;
1868
+ };
1869
+ recipientDetails: {
1870
+ firstName: string;
1871
+ lastName: string;
1872
+ };
1873
+ };
1874
+ sender: {
1875
+ transactionDetails: {
1876
+ transactionReference: string;
1877
+ originalAmount: string;
1878
+ originalCurrency: string;
1879
+ buyFxRate: string;
1880
+ senderFees: string;
1881
+ purposeOfFunds: string;
1882
+ sourceOfFunds: string;
1883
+ };
1884
+ senderDetails: {
1885
+ firstName: string;
1886
+ lastName: string;
1887
+ nationality: string;
1888
+ phoneNumber: string;
1889
+ address: {
1890
+ addressLine: string;
1891
+ postalCode: string;
1892
+ city: string;
1893
+ country: string;
1894
+ };
1895
+ identification: {
1896
+ type: string;
1897
+ number: string;
1898
+ };
1899
+ gender: string;
1900
+ dateOfBirth: string;
1901
+ placeOfBirth: string;
1902
+ occupation: string;
1903
+ relationshipRecipient: string;
1904
+ };
1905
+ };
1906
+ amount: string;
1907
+ currency: string;
1908
+ customerMessage: string;
1909
+ metadata: Array<Record<string, unknown>>;
1910
+ };
1911
+ type InitiateRemittanceResponse = {
1912
+ remittanceId: string;
1913
+ status: "ACCEPTED" | "DUPLICATE_IGNORED";
1914
+ created: string;
1915
+ } | {
1916
+ remittanceId: string | null;
1917
+ status: "REJECTED";
1918
+ failureReason: {
1919
+ failureCode: string;
1920
+ failureMessage: string;
1921
+ };
1922
+ };
1923
+ type RemittanceCallback = {
1924
+ remittanceId: string;
1925
+ status: string;
1926
+ amount: string;
1927
+ currency: string;
1928
+ country: string;
1929
+ recipient: {
1930
+ type: string;
1931
+ accountDetails: {
1932
+ phoneNumber: string;
1933
+ provider: string;
1934
+ };
1935
+ recipientDetails: {
1936
+ firstName: string;
1937
+ lastName: string;
1938
+ };
1939
+ };
1940
+ sender: {
1941
+ transactionDetails: {
1942
+ transactionReference: string;
1943
+ originalAmount: string;
1944
+ originalCurrency: string;
1945
+ buyFxRate: string;
1946
+ senderFees: string;
1947
+ purposeOfFunds: string;
1948
+ sourceOfFunds: string;
1949
+ };
1950
+ senderDetails: {
1951
+ firstName: string;
1952
+ lastName: string;
1953
+ nationality: string;
1954
+ phoneNumber: string;
1955
+ address: {
1956
+ addressLine: string;
1957
+ postalCode: string;
1958
+ city: string;
1959
+ country: string;
1960
+ };
1961
+ identification: {
1962
+ type: string;
1963
+ number: string;
1964
+ };
1965
+ gender: string;
1966
+ dateOfBirth: string;
1967
+ placeOfBirth: string;
1968
+ occupation: string;
1969
+ relationshipRecipient: string;
1970
+ };
1971
+ };
1972
+ created: string;
1973
+ customerMessage: string;
1974
+ providerTransactionId: string;
1975
+ failureReason: {
1976
+ failureCode: string;
1977
+ failureMessage: string;
1978
+ };
1979
+ metadata: {
1980
+ orderId: string;
1981
+ customerId: string;
1982
+ };
1983
+ };
1984
+ type CancelEnqueuedRemittanceResponse = {
1985
+ remittanceId: string;
1986
+ status: "ACCEPTED";
1987
+ } | {
1988
+ remittanceId: string;
1989
+ status: "REJECTED";
1990
+ failureReason: {
1991
+ failureCode: "NOT_FOUND" | "INVALID_STATE";
1992
+ failureMessage: string;
1993
+ };
1994
+ };
1995
+ type CheckRemittanceStatusResponse = {
1996
+ status: "FOUND";
1997
+ data: {
1998
+ remittanceId: string;
1999
+ status: "COMPLETED";
2000
+ amount: string;
2001
+ currency: string;
2002
+ country: string;
2003
+ recipient: {
2004
+ type: string;
2005
+ accountDetails: {
2006
+ phoneNumber: string;
2007
+ provider: string;
2008
+ };
2009
+ };
2010
+ customerMessage: string;
2011
+ created: string;
2012
+ providerTransactionId: string;
2013
+ metadata: {
2014
+ orderId: string;
2015
+ customerId: string;
2016
+ };
2017
+ } | {
2018
+ remittanceId: string;
2019
+ status: "ACCEPTED" | "PROCESSING" | "IN_RECONCILIATION";
2020
+ amount: string;
2021
+ currency: string;
2022
+ country: string;
2023
+ recipient: {
2024
+ type: string;
2025
+ accountDetails: {
2026
+ phoneNumber: string;
2027
+ provider: string;
2028
+ };
2029
+ };
2030
+ customerMessage: string;
2031
+ created: string;
2032
+ metadata: {
2033
+ orderId: string;
2034
+ customerId: string;
2035
+ };
2036
+ } | {
2037
+ remittanceId: string;
2038
+ status: "FAILED";
2039
+ amount: string;
2040
+ currency: string;
2041
+ country: string;
2042
+ recipient: {
2043
+ type: string;
2044
+ accountDetails: {
2045
+ phoneNumber: string;
2046
+ provider: string;
2047
+ };
2048
+ };
2049
+ customerMessage: string;
2050
+ created: string;
2051
+ failureReason: {
2052
+ failureCode: string;
2053
+ failureMessage: string;
2054
+ };
2055
+ metadata: {
2056
+ orderId: string;
2057
+ customerId: string;
2058
+ };
2059
+ };
2060
+ } | {
2061
+ status: "NOT_FOUND";
2062
+ };
2063
+ type ResendRemittanceCallbackResponse = {
2064
+ remittanceId: string;
2065
+ status: "ACCEPTED";
2066
+ } | {
2067
+ remittanceId: string;
2068
+ status: "REJECTED";
2069
+ failureReason: {
2070
+ failureCode: "NOT_FOUND" | "INVALID_STATE";
2071
+ failureMessage: string;
2072
+ };
2073
+ };
2074
+ //#endregion
2075
+ //#region src/types/v2/statements.t.d.ts
2076
+ type RequestStatementConfig = {
2077
+ wallet: {
2078
+ country: string;
2079
+ currency: string;
2080
+ provider: string;
2081
+ };
2082
+ callbackUrl: string;
2083
+ startDate: string;
2084
+ endDate: string;
2085
+ compressed: boolean;
2086
+ };
2087
+ type RequestStatementResponse_v2 = {
2088
+ status: "ACCEPTED";
2089
+ statementId: string;
2090
+ created: string;
2091
+ } | {
2092
+ status: "REJECTED";
2093
+ failureReason: {
2094
+ failureCode: "INVALID_CALLBACK_URL" | "INVALID_DATE_RANGE" | "WALLET_NOT_FOUND";
2095
+ failureMessage: string;
2096
+ };
2097
+ };
2098
+ type StatementWallet = {
2099
+ currency: string;
2100
+ country: string;
2101
+ provider: string;
2102
+ };
2103
+ type StatementData = {
2104
+ statementId: string;
2105
+ status: "COMPLETED";
2106
+ wallet: StatementWallet;
2107
+ created: string;
2108
+ startDate: string;
2109
+ endDate: string;
2110
+ fileSIze: number;
2111
+ downloadUrl: string;
2112
+ downloadUrlExpiresAt: string;
2113
+ completedAt: string;
2114
+ } | {
2115
+ statementId: string;
2116
+ status: "PROCESSING";
2117
+ wallet: StatementWallet;
2118
+ created: string;
2119
+ startDate: string;
2120
+ endDate: string;
2121
+ } | {
2122
+ statementId: string;
2123
+ status: "FAILED";
2124
+ wallet: StatementWallet;
2125
+ created: string;
2126
+ startDate: string;
2127
+ endDate: string;
2128
+ failedAt: string;
2129
+ };
2130
+ type CheckStatementStaus_v2 = {
2131
+ status: "FOUND";
2132
+ data: StatementData;
2133
+ } | {
2134
+ status: "NOT_FOUND";
2135
+ };
2136
+ type StatementCallback_v2 = {
2137
+ statementId: string;
2138
+ status: "PROCESSING" | "COMPLETED" | "FAILED";
2139
+ wallet: {
2140
+ country: string;
2141
+ currency: string;
2142
+ provider: string;
2143
+ };
2144
+ created: string;
2145
+ startDate: string;
2146
+ endDate: string;
2147
+ fileSize: number;
2148
+ downloadUrl: string;
2149
+ downloadUrlExpiresAt: string;
2150
+ completedAt: string;
2151
+ failedAt: string;
2152
+ failureReason: {
2153
+ failureCode: string;
2154
+ failureMessage: string;
2155
+ };
2156
+ };
2157
+ //#endregion
2158
+ //#region src/types/v2/toolkit.t.d.ts
2159
+ type ProviderAvailability_v2 = Array<{
2160
+ country: string;
2161
+ providers: Array<{
2162
+ provider: string;
2163
+ operationTypes: Array<{
2164
+ operationType: "DEPOSIT" | "PAYOUT" | "REMITTANCE" | "REFUND" | "USSD_DEPOSIT" | "NAME_LOOKUP";
2165
+ status: "OPERATIONAL" | "DELAYED" | "CLOSED";
2166
+ }>;
2167
+ }>;
2168
+ }>;
2169
+ type ProviderPrediction_v2 = {
2170
+ country: string;
2171
+ provider: string;
2172
+ phoneNumber: string;
2173
+ };
2174
+ type WalletBalance_v2 = {
2175
+ balances: Array<{
2176
+ country: string;
2177
+ balance: string;
2178
+ currency: string;
2179
+ provider: string;
2180
+ }>;
2181
+ };
2182
+ //#endregion
2183
+ //#region src/types/methods.t.d.ts
2184
+ type V1Methods = {
2185
+ requestDeposit(data: DepositConfig, args?: {
2186
+ options?: RequestOptions;
2187
+ }): Promise<PawaPayResponse<DepositResponse, PawaPayError>>;
2188
+ checkDepositStatus(depositId: string, args?: {
2189
+ options?: RequestOptions;
2190
+ }): Promise<PawaPayResponse<DepositStatus[], PawaPayError>>;
2191
+ resendDepositCallback(depositId: string, args?: {
2192
+ options?: RequestOptions;
2193
+ }): Promise<PawaPayResponse<ResendDepositResponse, PawaPayError>>;
2194
+ requestPayout(data: RequestPayoutConfig, args?: {
2195
+ options?: RequestOptions;
2196
+ }): Promise<PawaPayResponse<RequestPayoutRespose, PawaPayError>>;
2197
+ checkPayoutStatus(payoutId: string, args?: {
2198
+ options?: RequestOptions;
2199
+ }): Promise<PawaPayResponse<CheckPayoutStatusResponse[], PawaPayError>>;
2200
+ resendPayoutCallback(payoutId: string, args?: {
2201
+ options?: RequestOptions;
2202
+ }): Promise<PawaPayResponse<ResendPayoutCallbackResponse, PawaPayError>>;
2203
+ cancelEnqueuedPayout(payoutId: string, args?: {
2204
+ options?: RequestOptions;
2205
+ }): Promise<PawaPayResponse<CancelEnqueuedPayoutResponse, PawaPayError>>;
2206
+ initiateBulkPayout(data: RequestBulkPayoutConfig[], args?: {
2207
+ options?: RequestOptions;
2208
+ }): Promise<PawaPayResponse<RequestBuildPayoutResponse[], PawaPayError>>;
2209
+ initiateRefund(refundConfig: RequestRefundConfig, args?: {
2210
+ options?: RequestOptions;
2211
+ }): Promise<PawaPayResponse<RequestRefundResponse, PawaPayError>>;
2212
+ checkRefundStatus(refundId: string, args?: {
2213
+ options?: RequestOptions;
2214
+ }): Promise<PawaPayResponse<CheckRefundStatusResponse[], PawaPayError>>;
2215
+ resendRefundCallback(refundId: string, args?: {
2216
+ options?: RequestOptions;
2217
+ }): Promise<PawaPayResponse<ResendRefundCallbackResponse, PawaPayError>>;
2218
+ requestPayPage(payload: RequestPayPageConfig, args?: {
2219
+ options?: RequestOptions;
2220
+ }): Promise<PawaPayResponse<RequestPayPageResponse, PawaPayError>>;
2221
+ getWalletBalances(args?: {
2222
+ options?: RequestOptions;
2223
+ }): Promise<PawaPayResponse<WalletBalance, PawaPayError>>;
2224
+ getWalletBalancesByCountry(country: string, args?: {
2225
+ options?: RequestOptions;
2226
+ }): Promise<PawaPayResponse<WalletBalance, PawaPayError>>;
2227
+ getActiveConfiguration(args?: {
2228
+ options?: RequestOptions;
2229
+ }): Promise<PawaPayResponse<ActiveConfigurationResponse, PawaPayError>>;
2230
+ getProviderAvailability(args?: {
2231
+ options?: RequestOptions;
2232
+ }): Promise<PawaPayResponse<AvailableCorrespondentResponse[], PawaPayError>>;
2233
+ getProviderPrediction(msisdn: string, args?: {
2234
+ options?: RequestOptions;
2235
+ }): Promise<PawaPayResponse<PredictCorrespondentResponse, PawaPayError>>;
2236
+ getPublicKeys(args?: {
2237
+ options?: RequestOptions;
2238
+ }): Promise<PawaPayResponse<PublicKeysResponse[], PawaPayError>>;
2239
+ };
2240
+ type V2Methods = {
2241
+ requestDeposit(data: DepositConfig_v2, args?: {
2242
+ options?: RequestOptions;
2243
+ }): Promise<PawaPayResponse<DepositResponse_v2, PawaPayError>>;
2244
+ checkDepositStatus(depositId: string, args?: {
2245
+ options?: RequestOptions;
2246
+ }): Promise<PawaPayResponse<DepositStatusResponse_v2, PawaPayError>>;
2247
+ resendDepositCallback(depositId: string, args?: {
2248
+ options?: RequestOptions;
2249
+ }): Promise<PawaPayResponse<ResendDepositCallbackResponse_v2, PawaPayError>>;
2250
+ checkPayoutStatus(payoutId: string, args?: {
2251
+ options?: RequestOptions;
2252
+ }): Promise<PawaPayResponse<CheckPayoutStatus_v2, PawaPayError>>;
2253
+ requestPayout(data: RequestPayoutConfig_v2, args?: {
2254
+ options?: RequestOptions;
2255
+ }): Promise<PawaPayResponse<RequestPayoutResponse_v2, PawaPayError>>;
2256
+ cancelEnqueuedPayout(payoutId: string, args?: {
2257
+ options?: RequestOptions;
2258
+ }): Promise<PawaPayResponse<CancelEnqueuedPayoutResponse_v2, PawaPayError>>;
2259
+ resendPayoutCallback(payoutId: string, args?: {
2260
+ options?: RequestOptions;
2261
+ }): Promise<PawaPayResponse<ResendPayoutCallbackResponse_v2, PawaPayError>>;
2262
+ initiateBulkPayout(data: Array<RequestPayoutConfig_v2>, args?: {
2263
+ options?: RequestOptions;
2264
+ }): Promise<PawaPayResponse<BulkPayoutResponse_v2, PawaPayError>>;
2265
+ initiateRefund(data: RequestRefundConfig_v2, args?: {
2266
+ options?: RequestOptions;
2267
+ }): Promise<PawaPayResponse<RequestRefundResponse_v2, PawaPayError>>;
2268
+ checkRefundStatus(refundId: string, args?: {
2269
+ options?: RequestOptions;
2270
+ }): Promise<PawaPayResponse<RefundStatusResponse_v2, PawaPayError>>;
2271
+ resendRefundCallback(refundId: string, args?: {
2272
+ options?: RequestOptions;
2273
+ }): Promise<PawaPayResponse<ResendRefundCallbackResponse_v2, PawaPayError>>;
2274
+ initiateRemittance(data: InitiateRemittanceConfig, args?: {
2275
+ options?: RequestOptions;
2276
+ }): Promise<PawaPayResponse<InitiateRemittanceResponse, PawaPayError>>;
2277
+ resendRemittanceCallback(remittanceId: string, args?: {
2278
+ options?: RequestOptions;
2279
+ }): Promise<PawaPayResponse<ResendRemittanceCallbackResponse, PawaPayError>>;
2280
+ checkRemittanceStatus(remittanceId: string, args?: {
2281
+ options?: RequestOptions;
2282
+ }): Promise<PawaPayResponse<CheckRemittanceStatusResponse, PawaPayError>>;
2283
+ cancelEnqueuedRemittance(remittanceId: string, args?: {
2284
+ options?: RequestOptions;
2285
+ }): Promise<PawaPayResponse<CancelEnqueuedRemittanceResponse, PawaPayError>>;
2286
+ requestPayPage(data: RequestPayPageConfig_v2, args?: {
2287
+ options?: RequestOptions;
2288
+ }): Promise<PawaPayResponse<RequestPayPageResponse, PawaPayError>>;
2289
+ getWalletBalances(args?: {
2290
+ options?: RequestOptions;
2291
+ }): Promise<PawaPayResponse<WalletBalance_v2, PawaPayError>>;
2292
+ requestStatement(data: RequestStatementConfig, args?: {
2293
+ options?: RequestOptions;
2294
+ }): Promise<PawaPayResponse<RequestStatementResponse_v2, PawaPayError>>;
2295
+ getStatementStatus(statementId: string, args?: {
2296
+ options?: RequestOptions;
2297
+ }): Promise<PawaPayResponse<CheckStatementStaus_v2, PawaPayError>>;
2298
+ getActiveConfiguration(args?: {
2299
+ options?: RequestOptions;
2300
+ }): Promise<PawaPayResponse<ActiveConfiguration, PawaPayError>>;
2301
+ getProviderAvailability(args?: {
2302
+ options?: RequestOptions;
2303
+ }): Promise<PawaPayResponse<ProviderAvailability_v2, PawaPayError>>;
2304
+ getProviderPrediction(phoneNumber: string, args?: {
2305
+ options?: RequestOptions;
2306
+ }): Promise<PawaPayResponse<ProviderPrediction_v2, PawaPayError>>;
2307
+ getPublicKeys(args?: {
2308
+ options?: RequestOptions;
2309
+ }): Promise<PawaPayResponse<PublicKeysResponse, PawaPayError>>;
2310
+ };
2311
+ //#endregion
2312
+ //#region src/client.d.ts
2313
+ type ApiVersion = "v1" | "v2";
2314
+ type ClientConfig<T extends ApiVersion> = {
2315
+ apiVersion?: T;
2316
+ environment?: "live" | "sandbox";
2317
+ };
2318
+ //#endregion
2319
+ //#region src/types/factory.d.ts
2320
+ type PawaPayClientV1 = V1Methods;
2321
+ type PawaPayClientV2 = V2Methods;
2322
+ declare function createPawaPayClient(apiKey: string, config?: ClientConfig<"v1"> & {
2323
+ apiVersion?: "v1";
2324
+ }): PawaPayClientV1;
2325
+ declare function createPawaPayClient(apiKey: string, config?: ClientConfig<"v2"> & {
2326
+ apiVersion?: "v2";
2327
+ }): PawaPayClientV2;
2328
+ //#endregion
2329
+ export { ActiveConfiguration, type ActiveConfigurationResponse, AuthType, type AvailableCorrespondentResponse, BulkPayoutResponse_v2, type CancelEnqueuedPayoutResponse, CancelEnqueuedPayoutResponse_v2, CancelEnqueuedRemittanceResponse, Channel, ChannelType, type CheckPayoutStatusResponse, CheckPayoutStatus_v2, type CheckRefundStatusResponse, CheckRemittanceStatusResponse, CheckStatementStaus_v2, Country, Currency, DecimalsInAmount, DepositCallBack_v2, type DepositCallback, type DepositConfig, DepositConfig_v2, type DepositResponse, DepositResponse_v2, type DepositStatus, DepositStatusResponse_v2, DisplayName, InitiateRemittanceConfig, InitiateRemittanceResponse, Instruction, Instructions, OperationStatus, OperationType, OperationTypeCode, type PawaPayError, type PawaPayResponse, type PayoutCallback, PinPromptInstructions, PinPromptType, type PredictCorrespondentResponse, Provider, ProviderAvailability_v2, ProviderPrediction_v2, type PublicKeysResponse, type RefundCallback, RefundStatusResponse_v2, RemittanceCallback, type RequestBuildPayoutResponse, type RequestBulkPayoutConfig, type RequestOptions, type RequestPayPageConfig, RequestPayPageConfig_v2, type RequestPayPageResponse, type RequestPayoutConfig, RequestPayoutConfig_v2, RequestPayoutResponse_v2, type RequestPayoutRespose, type RequestRefundConfig, RequestRefundConfig_v2, type RequestRefundResponse, RequestRefundResponse_v2, RequestStatementConfig, RequestStatementResponse_v2, ResendDepositCallbackResponse_v2, type ResendDepositResponse, type ResendPayoutCallbackResponse, ResendPayoutCallbackResponse_v2, type ResendRefundCallbackResponse, ResendRefundCallbackResponse_v2, ResendRemittanceCallbackResponse, SignatureConfiguration, StatementCallback_v2, Variables, type WalletBalance, WalletBalance_v2, createPawaPayClient };
2330
+ //# sourceMappingURL=index.d.cts.map