pi-spi-sdk 0.1.2 → 0.1.3

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/config.js +2 -1
  3. package/dist/error-handler.js +11 -8
  4. package/dist/errors.js +13 -5
  5. package/dist/examples.js +11 -9
  6. package/dist/generated/core/ApiError.js +5 -1
  7. package/dist/generated/core/ApiRequestOptions.js +2 -1
  8. package/dist/generated/core/ApiResult.js +2 -1
  9. package/dist/generated/core/CancelablePromise.js +7 -2
  10. package/dist/generated/core/OpenAPI.js +4 -1
  11. package/dist/generated/core/request.js +75 -52
  12. package/dist/generated/index.js +82 -39
  13. package/dist/generated/models/AliasCreationReponse.js +2 -1
  14. package/dist/generated/models/AliasCreationRequest.js +2 -1
  15. package/dist/generated/models/AliasReponseListe.js +2 -1
  16. package/dist/generated/models/AnnulationStatut.js +5 -2
  17. package/dist/generated/models/Champs.js +2 -1
  18. package/dist/generated/models/CompteOperation.js +5 -2
  19. package/dist/generated/models/CompteOperationListe.js +2 -1
  20. package/dist/generated/models/CompteSolde.js +5 -2
  21. package/dist/generated/models/CompteTransfertIntraReponse.js +5 -2
  22. package/dist/generated/models/CompteTransfertIntraRequest.js +2 -1
  23. package/dist/generated/models/DemandePaiementConfirmationAnnulationRaison.js +5 -2
  24. package/dist/generated/models/DemandePaiementConfirmationReponse.js +5 -2
  25. package/dist/generated/models/DemandePaiementConfirmationRequest.js +2 -1
  26. package/dist/generated/models/DemandePaiementConfirmationRequestAccepter.js +2 -1
  27. package/dist/generated/models/DemandePaiementConfirmationRequestRejeter.js +2 -1
  28. package/dist/generated/models/DemandePaiementConsultationReponse.js +5 -2
  29. package/dist/generated/models/DemandePaiementEnMasseConfirmationRequest.js +2 -1
  30. package/dist/generated/models/DemandePaiementEnMasseConfirmationRequestAccepter.js +2 -1
  31. package/dist/generated/models/DemandePaiementEnMasseConfirmationRequestRejeter.js +2 -1
  32. package/dist/generated/models/DemandePaiementEnMasseRequest.js +2 -1
  33. package/dist/generated/models/DemandePaiementEnMasseStatutReponse.js +5 -2
  34. package/dist/generated/models/DemandePaiementListe.js +2 -1
  35. package/dist/generated/models/DemandePaiementListeItem.js +5 -2
  36. package/dist/generated/models/DemandePaiementReponse.js +2 -1
  37. package/dist/generated/models/DemandePaiementReponseRequest.js +5 -2
  38. package/dist/generated/models/DemandePaiementRequest.js +5 -2
  39. package/dist/generated/models/DemandePaiementRequestBase.js +2 -1
  40. package/dist/generated/models/DemandePaiementRequestCategorie.js +5 -2
  41. package/dist/generated/models/DemandePaiementStatut.js +5 -2
  42. package/dist/generated/models/DemandePaiementStatutRaison.js +5 -2
  43. package/dist/generated/models/ListeMeta.js +2 -1
  44. package/dist/generated/models/Paiement.js +5 -2
  45. package/dist/generated/models/PaiementAnnulationMotif.js +5 -2
  46. package/dist/generated/models/PaiementAnnulationReponseRequest.js +2 -1
  47. package/dist/generated/models/PaiementAnnulationReponseRequestAccepter.js +2 -1
  48. package/dist/generated/models/PaiementAnnulationReponseRequestRejeter.js +2 -1
  49. package/dist/generated/models/PaiementAnnulationRequest.js +2 -1
  50. package/dist/generated/models/PaiementAnnulationStatutRaison.js +5 -2
  51. package/dist/generated/models/PaiementEnMasseConfirmationRequest.js +2 -1
  52. package/dist/generated/models/PaiementEnMasseConfirmationRequestAccepter.js +2 -1
  53. package/dist/generated/models/PaiementEnMasseConfirmationRequestRejeter.js +2 -1
  54. package/dist/generated/models/PaiementEnMasseReponseStatut.js +5 -2
  55. package/dist/generated/models/PaiementEnMasseRequest.js +2 -1
  56. package/dist/generated/models/PaiementImmediatConfirmationReponse.js +5 -2
  57. package/dist/generated/models/PaiementImmediatConfirmationRequest.js +2 -1
  58. package/dist/generated/models/PaiementImmediatConfirmationRequestAccepter.js +2 -1
  59. package/dist/generated/models/PaiementImmediatConfirmationRequestRejeter.js +2 -1
  60. package/dist/generated/models/PaiementImmediatReponse.js +5 -2
  61. package/dist/generated/models/PaiementImmediatRequest.js +2 -1
  62. package/dist/generated/models/PaiementListe.js +2 -1
  63. package/dist/generated/models/PaiementRequest.js +2 -1
  64. package/dist/generated/models/PaiementStatut.js +5 -2
  65. package/dist/generated/models/PaiementStatutRaison.js +5 -2
  66. package/dist/generated/models/Problem7807.js +2 -1
  67. package/dist/generated/models/RefDocType.js +5 -2
  68. package/dist/generated/models/RetourStatut.js +5 -2
  69. package/dist/generated/models/RetourStatutRaison.js +5 -2
  70. package/dist/generated/models/WebhookCreationRequest.js +2 -1
  71. package/dist/generated/models/WebhookCreationResponse.js +2 -1
  72. package/dist/generated/models/WebhookData.js +2 -1
  73. package/dist/generated/models/WebhookEvent.js +5 -2
  74. package/dist/generated/models/WebhookEventsList.js +2 -1
  75. package/dist/generated/models/WebhookList.js +2 -1
  76. package/dist/generated/models/WebhookModificationRequest.js +2 -1
  77. package/dist/generated/models/WebhooksEvents.js +5 -2
  78. package/dist/generated/services/AliasService.js +10 -6
  79. package/dist/generated/services/ComptesService.js +10 -6
  80. package/dist/generated/services/DemandeAnnulationService.js +9 -5
  81. package/dist/generated/services/DemandesDePaiementEnMasseService.js +10 -6
  82. package/dist/generated/services/DemandesDePaiementService.js +12 -8
  83. package/dist/generated/services/NotificationService.js +12 -8
  84. package/dist/generated/services/PaiementEnMasseService.js +10 -6
  85. package/dist/generated/services/PaiementImmediatService.js +12 -8
  86. package/dist/generated/services/RetoursdeFondsService.js +8 -4
  87. package/dist/index.d.ts +1 -0
  88. package/dist/index.js +57 -8
  89. package/dist/qrcode/index.d.ts +62 -0
  90. package/dist/qrcode/index.js +541 -0
  91. package/dist/qrcode/logo.d.ts +3 -0
  92. package/dist/qrcode/logo.js +142 -0
  93. package/dist/query-builder.js +5 -1
  94. package/dist/sdk.d.ts +16 -0
  95. package/dist/sdk.js +81 -41
  96. package/dist/services/alias.d.ts +7 -3
  97. package/dist/services/alias.js +13 -15
  98. package/dist/services/base.d.ts +12 -1
  99. package/dist/services/base.js +54 -4
  100. package/dist/services/comptes.js +6 -2
  101. package/dist/services/demandes-annulation.js +6 -2
  102. package/dist/services/demandes-paiement-en-masse.d.ts +4 -110
  103. package/dist/services/demandes-paiement-en-masse.js +21 -116
  104. package/dist/services/demandes-paiement.d.ts +5 -1
  105. package/dist/services/demandes-paiement.js +7 -5
  106. package/dist/services/paiements-en-masse.js +6 -2
  107. package/dist/services/paiements.js +6 -2
  108. package/dist/services/retours-fonds.js +6 -2
  109. package/dist/services/webhooks.js +6 -2
  110. package/dist/types/alias.js +12 -7
  111. package/dist/utils/constants.js +12 -9
  112. package/dist/utils/index.js +20 -9
  113. package/package.json +6 -5
@@ -2,91 +2,11 @@
2
2
  * Bulk Payment Requests (Demandes de Paiement en Masse) service wrapper
3
3
  *
4
4
  * Provides methods for creating and managing bulk payment requests.
5
- *
6
- * **Bulk Payment Request Features:**
7
- * - Send multiple payment requests in a single operation
8
- * - Useful for invoicing multiple customers
9
- * - Each request can have different amounts and recipients
10
- * - All requests share the same `instructionId`
11
- * - Can confirm entire bulk at once
12
- *
13
- * **Use Cases:**
14
- * - Mass invoicing
15
- * - Subscription billing
16
- * - Bulk bill collection
17
- * - Multiple invoice requests
18
- *
19
- * @example
20
- * ```typescript
21
- * // Create bulk payment requests
22
- * const bulkRequests = await sdk.demandesPaiementEnMasse.create({
23
- * comptePaye: 'CIC2344256727788288822',
24
- * transactions: [
25
- * { txId: 'INV-001', payeurAlias: 'alias1', montant: 50000, motif: 'Facture' },
26
- * { txId: 'INV-002', payeurAlias: 'alias2', montant: 75000, motif: 'Facture' }
27
- * ]
28
- * });
29
- * ```
30
5
  */
31
6
  import { BaseService } from './base';
32
7
  export declare class DemandesPaiementEnMasseService extends BaseService {
33
8
  /**
34
9
  * Create bulk payment requests
35
- *
36
- * **Bulk Request Process:**
37
- * 1. Create bulk with multiple payment requests
38
- * 2. All requests are created with status `INITIE`
39
- * 3. Confirm bulk to send all requests to recipients
40
- * 4. Each recipient receives their individual payment request
41
- *
42
- * **Confirmation:**
43
- * - Use `confirm()` method to send all requests
44
- * - Individual requests can be accepted/rejected by recipients
45
- * - Each request follows standard payment request flow
46
- *
47
- * @param request - Bulk payment request creation data
48
- * @param request.comptePaye - Business account number (payee)
49
- * @param request.transactions - Array of payment request transactions
50
- * @param request.transactions[].txId - Unique transaction ID (must be unique within bulk)
51
- * @param request.transactions[].payeurAlias - Customer alias (payer)
52
- * @param request.transactions[].montant - Amount in centimes (e.g., 50000 = 500 XOF)
53
- * @param request.transactions[].motif - Payment reason/description
54
- * @param request.transactions[].categorie - Request category (optional, defaults to '401')
55
- * @param request.transactions[].dateLimitePaiement - Payment due date (optional)
56
- * @param request.transactions[].refDocType - Reference document type (optional)
57
- * @param request.transactions[].refDocNumero - Reference document number (optional)
58
- * @returns Bulk payment request response
59
- * @throws {PiSpiValidationError} If bulk fails validation (e.g., duplicate txId, invalid alias)
60
- *
61
- * @example
62
- * ```typescript
63
- * // Create bulk invoice requests
64
- * await sdk.demandesPaiementEnMasse.create({
65
- * comptePaye: 'CIC2344256727788288822',
66
- * transactions: [
67
- * {
68
- * txId: 'INV-2023-001',
69
- * payeurAlias: '9b1b3499-3e50-435b-b757-ac7a83d8aa96',
70
- * montant: 150000, // 1,500 XOF
71
- * motif: 'Facture électricité mars 2023',
72
- * categorie: '401',
73
- * dateLimitePaiement: '2023-12-31T23:59:59.999Z',
74
- * refDocType: 'CINV',
75
- * refDocNumero: 'FACT-ELEC-202303-001'
76
- * },
77
- * {
78
- * txId: 'INV-2023-002',
79
- * payeurAlias: '8b1b2499-3e50-435b-b757-ac7a83d8aa7f',
80
- * montant: 200000, // 2,000 XOF
81
- * motif: 'Facture téléphone mars 2023',
82
- * categorie: '401',
83
- * dateLimitePaiement: '2023-12-31T23:59:59.999Z',
84
- * refDocType: 'CINV',
85
- * refDocNumero: 'FACT-TEL-202303-002'
86
- * }
87
- * ]
88
- * });
89
- * ```
90
10
  */
91
11
  create(request: {
92
12
  comptePaye: string;
@@ -100,40 +20,14 @@ export declare class DemandesPaiementEnMasseService extends BaseService {
100
20
  refDocType?: string;
101
21
  refDocNumero?: string;
102
22
  }>;
103
- }): Promise<never>;
23
+ confirmation?: boolean;
24
+ }): Promise<unknown>;
104
25
  /**
105
26
  * Get bulk payment request details and status
106
- *
107
- * **Response Includes:**
108
- * - Overall bulk status
109
- * - Individual request statuses
110
- * - Accepted/rejected counts
111
- * - Payment statuses
112
- *
113
- * @param instructionId - Bulk instruction ID
114
- * @returns Bulk payment request details with individual request statuses
115
- * @throws {PiSpiNotFoundError} If bulk payment request not found
116
27
  */
117
- get(instructionId: string): Promise<never>;
28
+ get(instructionId: string): Promise<unknown>;
118
29
  /**
119
30
  * Confirm and send bulk payment requests
120
- *
121
- * **Confirmation Process:**
122
- * - All requests in bulk are sent to recipients
123
- * - Each recipient receives their individual payment request
124
- * - Recipients can accept/reject independently
125
- * - Bulk status updates as recipients respond
126
- *
127
- * @param instructionId - Bulk instruction ID
128
- * @returns Confirmation response
129
- * @throws {PiSpiNotFoundError} If bulk payment request not found
130
- * @throws {PiSpiError} If bulk already confirmed
131
- *
132
- * @example
133
- * ```typescript
134
- * // Confirm and send all requests
135
- * await sdk.demandesPaiementEnMasse.confirm('BULK-INV-2023-03');
136
- * ```
137
31
  */
138
- confirm(instructionId: string): Promise<never>;
32
+ confirm(instructionId: string): Promise<unknown>;
139
33
  }
@@ -1,139 +1,44 @@
1
+ "use strict";
1
2
  /**
2
3
  * Bulk Payment Requests (Demandes de Paiement en Masse) service wrapper
3
4
  *
4
5
  * Provides methods for creating and managing bulk payment requests.
5
- *
6
- * **Bulk Payment Request Features:**
7
- * - Send multiple payment requests in a single operation
8
- * - Useful for invoicing multiple customers
9
- * - Each request can have different amounts and recipients
10
- * - All requests share the same `instructionId`
11
- * - Can confirm entire bulk at once
12
- *
13
- * **Use Cases:**
14
- * - Mass invoicing
15
- * - Subscription billing
16
- * - Bulk bill collection
17
- * - Multiple invoice requests
18
- *
19
- * @example
20
- * ```typescript
21
- * // Create bulk payment requests
22
- * const bulkRequests = await sdk.demandesPaiementEnMasse.create({
23
- * comptePaye: 'CIC2344256727788288822',
24
- * transactions: [
25
- * { txId: 'INV-001', payeurAlias: 'alias1', montant: 50000, motif: 'Facture' },
26
- * { txId: 'INV-002', payeurAlias: 'alias2', montant: 75000, motif: 'Facture' }
27
- * ]
28
- * });
29
- * ```
30
6
  */
31
- import { BaseService } from './base';
32
- export class DemandesPaiementEnMasseService extends BaseService {
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.DemandesPaiementEnMasseService = void 0;
9
+ const base_1 = require("./base");
10
+ class DemandesPaiementEnMasseService extends base_1.BaseService {
33
11
  /**
34
12
  * Create bulk payment requests
35
- *
36
- * **Bulk Request Process:**
37
- * 1. Create bulk with multiple payment requests
38
- * 2. All requests are created with status `INITIE`
39
- * 3. Confirm bulk to send all requests to recipients
40
- * 4. Each recipient receives their individual payment request
41
- *
42
- * **Confirmation:**
43
- * - Use `confirm()` method to send all requests
44
- * - Individual requests can be accepted/rejected by recipients
45
- * - Each request follows standard payment request flow
46
- *
47
- * @param request - Bulk payment request creation data
48
- * @param request.comptePaye - Business account number (payee)
49
- * @param request.transactions - Array of payment request transactions
50
- * @param request.transactions[].txId - Unique transaction ID (must be unique within bulk)
51
- * @param request.transactions[].payeurAlias - Customer alias (payer)
52
- * @param request.transactions[].montant - Amount in centimes (e.g., 50000 = 500 XOF)
53
- * @param request.transactions[].motif - Payment reason/description
54
- * @param request.transactions[].categorie - Request category (optional, defaults to '401')
55
- * @param request.transactions[].dateLimitePaiement - Payment due date (optional)
56
- * @param request.transactions[].refDocType - Reference document type (optional)
57
- * @param request.transactions[].refDocNumero - Reference document number (optional)
58
- * @returns Bulk payment request response
59
- * @throws {PiSpiValidationError} If bulk fails validation (e.g., duplicate txId, invalid alias)
60
- *
61
- * @example
62
- * ```typescript
63
- * // Create bulk invoice requests
64
- * await sdk.demandesPaiementEnMasse.create({
65
- * comptePaye: 'CIC2344256727788288822',
66
- * transactions: [
67
- * {
68
- * txId: 'INV-2023-001',
69
- * payeurAlias: '9b1b3499-3e50-435b-b757-ac7a83d8aa96',
70
- * montant: 150000, // 1,500 XOF
71
- * motif: 'Facture électricité mars 2023',
72
- * categorie: '401',
73
- * dateLimitePaiement: '2023-12-31T23:59:59.999Z',
74
- * refDocType: 'CINV',
75
- * refDocNumero: 'FACT-ELEC-202303-001'
76
- * },
77
- * {
78
- * txId: 'INV-2023-002',
79
- * payeurAlias: '8b1b2499-3e50-435b-b757-ac7a83d8aa7f',
80
- * montant: 200000, // 2,000 XOF
81
- * motif: 'Facture téléphone mars 2023',
82
- * categorie: '401',
83
- * dateLimitePaiement: '2023-12-31T23:59:59.999Z',
84
- * refDocType: 'CINV',
85
- * refDocNumero: 'FACT-TEL-202303-002'
86
- * }
87
- * ]
88
- * });
89
- * ```
90
13
  */
91
14
  async create(request) {
92
- return this.execute(async () => {
93
- throw new Error('Service not yet generated. Run "pnpm run generate" first.');
15
+ // Ensure default category is 401 if not provided
16
+ const transactions = request.transactions.map(t => ({
17
+ ...t,
18
+ categorie: t.categorie || '401'
19
+ }));
20
+ // The SDK payload might need "transactions" but usually it's "demandesPaiement" or simply the body IS the object.
21
+ // Based on REFERENCE.md, POST /demandes-paiements-groupes
22
+ // It doesn't explicitly show the wrapper field name for transactions, let's assume it matches the input structure.
23
+ // Based on SDK patterns, we usually wrap it.
24
+ return this.request('POST', '/demandes-paiements-groupes', {
25
+ ...request,
26
+ transactions // Use the mapped transactions with defaults
94
27
  });
95
28
  }
96
29
  /**
97
30
  * Get bulk payment request details and status
98
- *
99
- * **Response Includes:**
100
- * - Overall bulk status
101
- * - Individual request statuses
102
- * - Accepted/rejected counts
103
- * - Payment statuses
104
- *
105
- * @param instructionId - Bulk instruction ID
106
- * @returns Bulk payment request details with individual request statuses
107
- * @throws {PiSpiNotFoundError} If bulk payment request not found
108
31
  */
109
32
  async get(instructionId) {
110
- return this.execute(async () => {
111
- throw new Error('Service not yet generated. Run "pnpm run generate" first.');
112
- });
33
+ return this.request('GET', `/demandes-paiements-groupes/${instructionId}`);
113
34
  }
114
35
  /**
115
36
  * Confirm and send bulk payment requests
116
- *
117
- * **Confirmation Process:**
118
- * - All requests in bulk are sent to recipients
119
- * - Each recipient receives their individual payment request
120
- * - Recipients can accept/reject independently
121
- * - Bulk status updates as recipients respond
122
- *
123
- * @param instructionId - Bulk instruction ID
124
- * @returns Confirmation response
125
- * @throws {PiSpiNotFoundError} If bulk payment request not found
126
- * @throws {PiSpiError} If bulk already confirmed
127
- *
128
- * @example
129
- * ```typescript
130
- * // Confirm and send all requests
131
- * await sdk.demandesPaiementEnMasse.confirm('BULK-INV-2023-03');
132
- * ```
133
37
  */
134
38
  async confirm(instructionId) {
135
- return this.execute(async () => {
136
- throw new Error('Service not yet generated. Run "pnpm run generate" first.');
39
+ return this.request('PUT', `/demandes-paiements-groupes/${instructionId}/confirmations`, {
40
+ decision: true
137
41
  });
138
42
  }
139
43
  }
44
+ exports.DemandesPaiementEnMasseService = DemandesPaiementEnMasseService;
@@ -103,7 +103,11 @@ export declare class DemandesPaiementService extends BaseService {
103
103
  confirmation?: boolean;
104
104
  refDocType?: string;
105
105
  refDocNumero?: string;
106
- }): Promise<never>;
106
+ }): Promise<{
107
+ statut?: string;
108
+ txId?: string;
109
+ dateLimiteReponse?: string;
110
+ }>;
107
111
  /**
108
112
  * List payment requests with filtering and pagination
109
113
  *
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Payment Requests (Demandes de Paiement) service wrapper
3
4
  *
@@ -29,8 +30,10 @@
29
30
  * });
30
31
  * ```
31
32
  */
32
- import { BaseService } from './base';
33
- export class DemandesPaiementService extends BaseService {
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.DemandesPaiementService = void 0;
35
+ const base_1 = require("./base");
36
+ class DemandesPaiementService extends base_1.BaseService {
34
37
  /**
35
38
  * Create a payment request
36
39
  *
@@ -91,9 +94,7 @@ export class DemandesPaiementService extends BaseService {
91
94
  * ```
92
95
  */
93
96
  async create(request) {
94
- return this.execute(async () => {
95
- throw new Error('Service not yet generated. Run "pnpm run generate" first.');
96
- });
97
+ return this.request('POST', '/demandes-paiements', request);
97
98
  }
98
99
  /**
99
100
  * List payment requests with filtering and pagination
@@ -149,3 +150,4 @@ export class DemandesPaiementService extends BaseService {
149
150
  });
150
151
  }
151
152
  }
153
+ exports.DemandesPaiementService = DemandesPaiementService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Bulk Payments (Paiements en Masse) service wrapper
3
4
  *
@@ -33,8 +34,10 @@
33
34
  * });
34
35
  * ```
35
36
  */
36
- import { BaseService } from './base';
37
- export class PaiementsEnMasseService extends BaseService {
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.PaiementsEnMasseService = void 0;
39
+ const base_1 = require("./base");
40
+ class PaiementsEnMasseService extends base_1.BaseService {
38
41
  /**
39
42
  * Create bulk payments
40
43
  *
@@ -151,3 +154,4 @@ export class PaiementsEnMasseService extends BaseService {
151
154
  });
152
155
  }
153
156
  }
157
+ exports.PaiementsEnMasseService = PaiementsEnMasseService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Payments (Paiements) service wrapper
3
4
  *
@@ -22,8 +23,10 @@
22
23
  * });
23
24
  * ```
24
25
  */
25
- import { BaseService } from './base';
26
- export class PaiementsService extends BaseService {
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.PaiementsService = void 0;
28
+ const base_1 = require("./base");
29
+ class PaiementsService extends base_1.BaseService {
27
30
  /**
28
31
  * Create an immediate payment
29
32
  *
@@ -133,3 +136,4 @@ export class PaiementsService extends BaseService {
133
136
  });
134
137
  }
135
138
  }
139
+ exports.PaiementsService = PaiementsService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Fund Returns (Retours de Fonds) service wrapper
3
4
  *
@@ -26,8 +27,10 @@
26
27
  * });
27
28
  * ```
28
29
  */
29
- import { BaseService } from './base';
30
- export class RetoursFondsService extends BaseService {
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.RetoursFondsService = void 0;
32
+ const base_1 = require("./base");
33
+ class RetoursFondsService extends base_1.BaseService {
31
34
  /**
32
35
  * Create a fund return
33
36
  *
@@ -98,3 +101,4 @@ export class RetoursFondsService extends BaseService {
98
101
  });
99
102
  }
100
103
  }
104
+ exports.RetoursFondsService = RetoursFondsService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Webhooks (Notifications) service wrapper
3
4
  *
@@ -24,8 +25,10 @@
24
25
  * });
25
26
  * ```
26
27
  */
27
- import { BaseService } from './base';
28
- export class WebhooksService extends BaseService {
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.WebhooksService = void 0;
30
+ const base_1 = require("./base");
31
+ class WebhooksService extends base_1.BaseService {
29
32
  /**
30
33
  * Create a webhook configuration
31
34
  *
@@ -140,3 +143,4 @@ export class WebhooksService extends BaseService {
140
143
  });
141
144
  }
142
145
  }
146
+ exports.WebhooksService = WebhooksService;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Alias Types for PI-SPI
3
4
  *
@@ -23,10 +24,14 @@
23
24
  * - Default limit: 20 aliases per account
24
25
  * - Limit can be increased based on client needs
25
26
  */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.ALIAS_TYPES = exports.AliasType = void 0;
29
+ exports.isValidAliasType = isValidAliasType;
30
+ exports.getAvailableAliasTypes = getAvailableAliasTypes;
26
31
  /**
27
32
  * Alias type values as defined in the PI-SPI API specification
28
33
  */
29
- export const AliasType = {
34
+ exports.AliasType = {
30
35
  /**
31
36
  * SHID - System-generated unique payment address (UUID format, 36 characters)
32
37
  * Available for all client types: P, C, B, G
@@ -46,12 +51,12 @@ export const AliasType = {
46
51
  /**
47
52
  * Valid alias types as a tuple for runtime validation
48
53
  */
49
- export const ALIAS_TYPES = [AliasType.SHID, AliasType.MCOD, AliasType.MBNO];
54
+ exports.ALIAS_TYPES = [exports.AliasType.SHID, exports.AliasType.MCOD, exports.AliasType.MBNO];
50
55
  /**
51
56
  * Check if a string is a valid alias type
52
57
  */
53
- export function isValidAliasType(value) {
54
- return ALIAS_TYPES.includes(value);
58
+ function isValidAliasType(value) {
59
+ return exports.ALIAS_TYPES.includes(value);
55
60
  }
56
61
  /**
57
62
  * Get available alias types for a client type
@@ -59,14 +64,14 @@ export function isValidAliasType(value) {
59
64
  * @param clientType - Client type: 'P' (Individual), 'C' (Merchant), 'B' (Business), 'G' (Government)
60
65
  * @returns Array of available alias types for the client type
61
66
  */
62
- export function getAvailableAliasTypes(clientType) {
67
+ function getAvailableAliasTypes(clientType) {
63
68
  switch (clientType) {
64
69
  case 'P':
65
- return [AliasType.MBNO, AliasType.SHID];
70
+ return [exports.AliasType.MBNO, exports.AliasType.SHID];
66
71
  case 'C':
67
72
  case 'B':
68
73
  case 'G':
69
- return [AliasType.SHID, AliasType.MCOD];
74
+ return [exports.AliasType.SHID, exports.AliasType.MCOD];
70
75
  default:
71
76
  return [];
72
77
  }
@@ -1,9 +1,12 @@
1
+ "use strict";
1
2
  /**
2
3
  * PI-SPI Constants
3
4
  *
4
5
  * Centralized constants for API endpoints, status codes, and configuration values
5
6
  */
6
- export const PI_SPI_ENDPOINTS = {
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.WEBHOOK_EVENTS = exports.DEFAULT_LIMITS = exports.CURRENCY = exports.UEMOA_COUNTRIES = exports.CLIENT_TYPE = exports.ACCOUNT_TYPE = exports.ACCOUNT_STATUS = exports.PAYMENT_STATUS = exports.PI_SPI_ENDPOINTS = void 0;
9
+ exports.PI_SPI_ENDPOINTS = {
7
10
  /** Production API endpoint */
8
11
  PRODUCTION: 'https://api.pi-bceao.com/piz/v1',
9
12
  /** Sandbox API endpoint */
@@ -11,7 +14,7 @@ export const PI_SPI_ENDPOINTS = {
11
14
  /** Default endpoint (sandbox) */
12
15
  DEFAULT: 'https://sandbox.api.pi-bceao.com/piz/v1',
13
16
  };
14
- export const PAYMENT_STATUS = {
17
+ exports.PAYMENT_STATUS = {
15
18
  /** Payment initiated (awaiting confirmation after alias lookup) */
16
19
  INITIE: 'INITIE',
17
20
  /** Payment sent (validations passed, PSP has sent the request) */
@@ -21,7 +24,7 @@ export const PAYMENT_STATUS = {
21
24
  /** Payment has been rejected */
22
25
  REJETE: 'REJETE',
23
26
  };
24
- export const ACCOUNT_STATUS = {
27
+ exports.ACCOUNT_STATUS = {
25
28
  /** Account is open */
26
29
  OPEN: 'OUVERT',
27
30
  /** Account is blocked */
@@ -29,13 +32,13 @@ export const ACCOUNT_STATUS = {
29
32
  /** Account is closed */
30
33
  CLOSED: 'CLOTURE',
31
34
  };
32
- export const ACCOUNT_TYPE = {
35
+ exports.ACCOUNT_TYPE = {
33
36
  /** Current account */
34
37
  CURRENT: 'CACC',
35
38
  /** Savings account */
36
39
  SAVINGS: 'SVGS',
37
40
  };
38
- export const CLIENT_TYPE = {
41
+ exports.CLIENT_TYPE = {
39
42
  /** Individual person */
40
43
  INDIVIDUAL: 'P',
41
44
  /** Merchant */
@@ -45,7 +48,7 @@ export const CLIENT_TYPE = {
45
48
  /** Government */
46
49
  GOVERNMENT: 'G',
47
50
  };
48
- export const UEMOA_COUNTRIES = {
51
+ exports.UEMOA_COUNTRIES = {
49
52
  BENIN: 'BJ',
50
53
  BURKINA_FASO: 'BF',
51
54
  IVORY_COAST: 'CI',
@@ -55,13 +58,13 @@ export const UEMOA_COUNTRIES = {
55
58
  SENEGAL: 'SN',
56
59
  TOGO: 'TG',
57
60
  };
58
- export const CURRENCY = {
61
+ exports.CURRENCY = {
59
62
  /** West African CFA Franc */
60
63
  XOF: 'XOF',
61
64
  /** Amounts are specified in centimes (1 XOF = 100 centimes) */
62
65
  CENTIMES_PER_XOF: 100,
63
66
  };
64
- export const DEFAULT_LIMITS = {
67
+ exports.DEFAULT_LIMITS = {
65
68
  /** Maximum page size for paginated requests */
66
69
  MAX_PAGE_SIZE: 100,
67
70
  /** Default page size */
@@ -69,7 +72,7 @@ export const DEFAULT_LIMITS = {
69
72
  /** Default aliases per account */
70
73
  DEFAULT_ALIASES_PER_ACCOUNT: 20,
71
74
  };
72
- export const WEBHOOK_EVENTS = {
75
+ exports.WEBHOOK_EVENTS = {
73
76
  /** Payment received */
74
77
  PAIEMENT_RECU: 'PAIEMENT_RECU',
75
78
  /** Payment sent */
@@ -1,15 +1,26 @@
1
+ "use strict";
1
2
  /**
2
3
  * Utility functions for PI-SPI operations
3
4
  *
4
5
  * Common helper functions for formatting amounts, validating inputs,
5
6
  * and other utility operations.
6
7
  */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.formatAmount = formatAmount;
10
+ exports.xofToCentimes = xofToCentimes;
11
+ exports.centimesToXof = centimesToXof;
12
+ exports.isValidAccountNumber = isValidAccountNumber;
13
+ exports.isValidShidAlias = isValidShidAlias;
14
+ exports.isValidPhoneNumber = isValidPhoneNumber;
15
+ exports.getCountryFromAccount = getCountryFromAccount;
16
+ exports.sleep = sleep;
17
+ exports.retryWithBackoff = retryWithBackoff;
7
18
  /**
8
19
  * Format amount from centimes to XOF
9
20
  * @param centimes - Amount in centimes
10
21
  * @returns Formatted amount string (e.g., "1 500 XOF")
11
22
  */
12
- export function formatAmount(centimes) {
23
+ function formatAmount(centimes) {
13
24
  const xof = centimes / 100;
14
25
  return new Intl.NumberFormat('fr-FR', {
15
26
  style: 'currency',
@@ -23,7 +34,7 @@ export function formatAmount(centimes) {
23
34
  * @param xof - Amount in XOF
24
35
  * @returns Amount in centimes
25
36
  */
26
- export function xofToCentimes(xof) {
37
+ function xofToCentimes(xof) {
27
38
  return Math.round(xof * 100);
28
39
  }
29
40
  /**
@@ -31,7 +42,7 @@ export function xofToCentimes(xof) {
31
42
  * @param centimes - Amount in centimes
32
43
  * @returns Amount in XOF
33
44
  */
34
- export function centimesToXof(centimes) {
45
+ function centimesToXof(centimes) {
35
46
  return centimes / 100;
36
47
  }
37
48
  /**
@@ -39,7 +50,7 @@ export function centimesToXof(centimes) {
39
50
  * @param accountNumber - Account number to validate
40
51
  * @returns True if valid format
41
52
  */
42
- export function isValidAccountNumber(accountNumber) {
53
+ function isValidAccountNumber(accountNumber) {
43
54
  // PI-SPI account numbers are typically 22 characters
44
55
  // Format: [Country Code][Bank Code][Account Number]
45
56
  // Example: CIC2344256727788288822 (Côte d'Ivoire)
@@ -50,7 +61,7 @@ export function isValidAccountNumber(accountNumber) {
50
61
  * @param alias - Alias to validate
51
62
  * @returns True if valid UUID format
52
63
  */
53
- export function isValidShidAlias(alias) {
64
+ function isValidShidAlias(alias) {
54
65
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
55
66
  return uuidRegex.test(alias);
56
67
  }
@@ -59,7 +70,7 @@ export function isValidShidAlias(alias) {
59
70
  * @param phoneNumber - Phone number to validate
60
71
  * @returns True if valid format
61
72
  */
62
- export function isValidPhoneNumber(phoneNumber) {
73
+ function isValidPhoneNumber(phoneNumber) {
63
74
  // Basic validation for West African phone numbers
64
75
  // Format: +[country code][number] or [country code][number]
65
76
  const phoneRegex = /^\+?[1-9]\d{8,12}$/;
@@ -70,7 +81,7 @@ export function isValidPhoneNumber(phoneNumber) {
70
81
  * @param accountNumber - Account number
71
82
  * @returns Country code or null
72
83
  */
73
- export function getCountryFromAccount(accountNumber) {
84
+ function getCountryFromAccount(accountNumber) {
74
85
  const countryMap = {
75
86
  CI: "Côte d'Ivoire",
76
87
  SN: 'Senegal',
@@ -88,7 +99,7 @@ export function getCountryFromAccount(accountNumber) {
88
99
  * Sleep/delay utility
89
100
  * @param ms - Milliseconds to wait
90
101
  */
91
- export function sleep(ms) {
102
+ function sleep(ms) {
92
103
  return new Promise((resolve) => setTimeout(resolve, ms));
93
104
  }
94
105
  /**
@@ -97,7 +108,7 @@ export function sleep(ms) {
97
108
  * @param maxRetries - Maximum number of retries
98
109
  * @param initialDelay - Initial delay in milliseconds
99
110
  */
100
- export async function retryWithBackoff(fn, maxRetries = 3, initialDelay = 1000) {
111
+ async function retryWithBackoff(fn, maxRetries = 3, initialDelay = 1000) {
101
112
  let lastError;
102
113
  for (let i = 0; i < maxRetries; i++) {
103
114
  try {