@factpulse/sdk 3.0.37 → 4.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/.openapi-generator/FILES +6 -6
- package/CHANGELOG.md +10 -13
- package/README.md +135 -148
- package/api/invoice-processing-api.ts +2 -2
- package/dist/esm/models/chorus-pro-credentials.d.ts +19 -7
- package/dist/esm/models/chorus-pro-destination.d.ts +2 -2
- package/dist/esm/models/{facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.d.ts → facture-electronique-models-invoice-type-code.d.ts} +63 -18
- package/dist/{models/facture-electronique-rest-api-schemas-ereporting-invoice-type-code.js → esm/models/facture-electronique-models-invoice-type-code.js} +66 -10
- package/dist/esm/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.d.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.d.ts} +13 -4
- package/dist/esm/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.d.ts → facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.d.ts} +11 -9
- package/dist/esm/models/get-chorus-pro-id-request.d.ts +2 -2
- package/dist/esm/models/get-invoice-request.d.ts +2 -2
- package/dist/esm/models/get-structure-request.d.ts +2 -2
- package/dist/esm/models/index.d.ts +3 -3
- package/dist/esm/models/index.js +3 -3
- package/dist/esm/models/invoice-input.d.ts +2 -2
- package/dist/esm/models/invoice-type-code.d.ts +6 -65
- package/dist/esm/models/invoice-type-code.js +6 -65
- package/dist/esm/models/recipient.d.ts +1 -1
- package/dist/esm/models/scheme-id.d.ts +7 -7
- package/dist/esm/models/scheme-id.js +7 -7
- package/dist/esm/models/search-structure-request.d.ts +2 -2
- package/dist/esm/models/simplified-invoice-data.d.ts +2 -2
- package/dist/esm/models/submit-complete-invoice-response.d.ts +1 -1
- package/dist/esm/models/submit-invoice-request.d.ts +2 -2
- package/dist/esm/models/supplier.d.ts +1 -1
- package/dist/esm/models/validate-cdarresponse.d.ts +3 -3
- package/dist/esm/models/validation-error-response.d.ts +3 -12
- package/dist/esm/src/helpers/client.d.ts +43 -265
- package/dist/esm/src/helpers/client.js +196 -779
- package/dist/esm/src/helpers/index.d.ts +1 -2
- package/dist/esm/src/helpers/index.js +1 -3
- package/dist/models/chorus-pro-credentials.d.ts +19 -7
- package/dist/models/chorus-pro-destination.d.ts +2 -2
- package/dist/models/{facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.d.ts → facture-electronique-models-invoice-type-code.d.ts} +63 -18
- package/dist/models/facture-electronique-models-invoice-type-code.js +85 -0
- package/dist/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.d.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.d.ts} +13 -4
- package/dist/{esm/models/facture-electronique-rest-api-schemas-ereporting-invoice-type-code.js → models/facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.d.ts} +11 -10
- package/dist/models/get-chorus-pro-id-request.d.ts +2 -2
- package/dist/models/get-invoice-request.d.ts +2 -2
- package/dist/models/get-structure-request.d.ts +2 -2
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +3 -3
- package/dist/models/invoice-input.d.ts +2 -2
- package/dist/models/invoice-type-code.d.ts +6 -65
- package/dist/models/invoice-type-code.js +6 -65
- package/dist/models/recipient.d.ts +1 -1
- package/dist/models/scheme-id.d.ts +7 -7
- package/dist/models/scheme-id.js +7 -7
- package/dist/models/search-structure-request.d.ts +2 -2
- package/dist/models/simplified-invoice-data.d.ts +2 -2
- package/dist/models/submit-complete-invoice-response.d.ts +1 -1
- package/dist/models/submit-invoice-request.d.ts +2 -2
- package/dist/models/supplier.d.ts +1 -1
- package/dist/models/validate-cdarresponse.d.ts +3 -3
- package/dist/models/validation-error-response.d.ts +3 -12
- package/dist/src/helpers/client.d.ts +43 -265
- package/dist/src/helpers/client.js +199 -823
- package/dist/src/helpers/index.d.ts +1 -2
- package/dist/src/helpers/index.js +2 -12
- package/docs/ChorusProCredentials.md +9 -9
- package/docs/ChorusProDestination.md +1 -1
- package/docs/FactureElectroniqueModelsInvoiceTypeCode.md +39 -0
- package/docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md +27 -0
- package/docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md +29 -0
- package/docs/GetChorusProIdRequest.md +1 -1
- package/docs/GetInvoiceRequest.md +1 -1
- package/docs/GetStructureRequest.md +1 -1
- package/docs/InvoiceInput.md +1 -1
- package/docs/InvoiceTypeCode.md +6 -28
- package/docs/Recipient.md +1 -1
- package/docs/SchemeID.md +4 -4
- package/docs/SearchStructureRequest.md +1 -1
- package/docs/SimplifiedInvoiceData.md +1 -1
- package/docs/SubmitCompleteInvoiceResponse.md +2 -2
- package/docs/SubmitInvoiceRequest.md +1 -1
- package/docs/Supplier.md +1 -1
- package/docs/ValidateCDARResponse.md +2 -2
- package/docs/ValidationErrorResponse.md +3 -9
- package/models/chorus-pro-credentials.ts +19 -7
- package/models/chorus-pro-destination.ts +2 -2
- package/models/{facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.ts → facture-electronique-models-invoice-type-code.ts} +67 -18
- package/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.ts} +13 -4
- package/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.ts → facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.ts} +11 -13
- package/models/get-chorus-pro-id-request.ts +2 -2
- package/models/get-invoice-request.ts +2 -2
- package/models/get-structure-request.ts +2 -2
- package/models/index.ts +3 -3
- package/models/invoice-input.ts +2 -2
- package/models/invoice-type-code.ts +6 -65
- package/models/recipient.ts +1 -1
- package/models/scheme-id.ts +7 -7
- package/models/search-structure-request.ts +2 -2
- package/models/simplified-invoice-data.ts +2 -2
- package/models/submit-complete-invoice-response.ts +1 -1
- package/models/submit-invoice-request.ts +2 -2
- package/models/supplier.ts +1 -1
- package/models/validate-cdarresponse.ts +3 -3
- package/models/validation-error-response.ts +3 -12
- package/package.json +1 -1
- package/src/helpers/client.ts +211 -834
- package/src/helpers/index.ts +1 -3
- package/dist/models/facture-electronique-rest-api-schemas-ereporting-invoice-type-code.d.ts +0 -22
- package/docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md +0 -29
- package/docs/FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.md +0 -17
- package/docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md +0 -21
- /package/dist/esm/models/{facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.js → facture-electronique-rest-api-schemas-cdar-validation-error-response.js} +0 -0
- /package/dist/esm/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.js → facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.js} +0 -0
- /package/dist/models/{facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.js → facture-electronique-rest-api-schemas-cdar-validation-error-response.js} +0 -0
- /package/dist/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.js → facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.js} +0 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -173,9 +173,9 @@ docs/ErrorSource.md
|
|
|
173
173
|
docs/ExtractionInfo.md
|
|
174
174
|
docs/FacturXInvoice.md
|
|
175
175
|
docs/FacturXPDFInfo.md
|
|
176
|
-
docs/
|
|
177
|
-
docs/
|
|
178
|
-
docs/
|
|
176
|
+
docs/FactureElectroniqueModelsInvoiceTypeCode.md
|
|
177
|
+
docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md
|
|
178
|
+
docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md
|
|
179
179
|
docs/FieldStatus.md
|
|
180
180
|
docs/FileInfo.md
|
|
181
181
|
docs/FilesInfo.md
|
|
@@ -472,9 +472,9 @@ models/error-source.ts
|
|
|
472
472
|
models/extraction-info.ts
|
|
473
473
|
models/factur-xinvoice.ts
|
|
474
474
|
models/factur-xpdfinfo.ts
|
|
475
|
-
models/facture-electronique-
|
|
476
|
-
models/facture-electronique-rest-api-schemas-
|
|
477
|
-
models/facture-electronique-rest-api-schemas-
|
|
475
|
+
models/facture-electronique-models-invoice-type-code.ts
|
|
476
|
+
models/facture-electronique-rest-api-schemas-cdar-validation-error-response.ts
|
|
477
|
+
models/facture-electronique-rest-api-schemas-processing-chorus-pro-credentials.ts
|
|
478
478
|
models/field-status.ts
|
|
479
479
|
models/file-info.ts
|
|
480
480
|
models/files-info.ts
|
package/CHANGELOG.md
CHANGED
|
@@ -7,18 +7,15 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [
|
|
10
|
+
## [4.0.0] - 2026-01-19
|
|
11
11
|
|
|
12
12
|
### Added
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[Unreleased]: https://github.com/factpulse/sdk-typescript/compare/v3.0.37...HEAD
|
|
24
|
-
[3.0.37]: https://github.com/factpulse/sdk-typescript/releases/tag/v3.0.37
|
|
13
|
+
- Gestion automatique des taches asynchrones
|
|
14
|
+
- Gestion automatique du décodage des documents renvoyés en base 64.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Rework complet du fonctionnement des SDK, fonctionnement totalement générique et transparent
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
[Unreleased]: https://github.com/factpulse/sdk-typescript/compare/v4.0.0...HEAD
|
|
21
|
+
[4.0.0]: https://github.com/factpulse/sdk-typescript/releases/tag/v4.0.0
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Official TypeScript/JavaScript client for the FactPulse API - French electronic
|
|
|
8
8
|
- **Chorus Pro**: Integration with the French public invoicing platform
|
|
9
9
|
- **AFNOR PDP/PA**: Submission of flows compliant with XP Z12-013 standard
|
|
10
10
|
- **Electronic signature**: PDF signing (PAdES-B-B, PAdES-B-T, PAdES-B-LT)
|
|
11
|
-
- **
|
|
11
|
+
- **Thin HTTP wrapper**: Generic `post()` and `get()` methods with automatic JWT auth and polling
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -20,8 +20,6 @@ yarn add @factpulse/sdk
|
|
|
20
20
|
|
|
21
21
|
## Quick Start
|
|
22
22
|
|
|
23
|
-
The `helpers` module provides a simplified API with automatic authentication and polling:
|
|
24
|
-
|
|
25
23
|
```typescript
|
|
26
24
|
import { FactPulseClient } from '@factpulse/sdk/helpers';
|
|
27
25
|
import * as fs from 'fs';
|
|
@@ -29,189 +27,178 @@ import * as fs from 'fs';
|
|
|
29
27
|
// Create the client
|
|
30
28
|
const client = new FactPulseClient({
|
|
31
29
|
email: 'your_email@example.com',
|
|
32
|
-
password: 'your_password'
|
|
30
|
+
password: 'your_password',
|
|
31
|
+
clientUid: 'your-client-uuid', // From dashboard: Configuration > Clients
|
|
33
32
|
});
|
|
34
33
|
|
|
35
|
-
//
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
// Read your source PDF
|
|
35
|
+
const pdfB64 = fs.readFileSync('source_invoice.pdf').toString('base64');
|
|
36
|
+
|
|
37
|
+
// Generate Factur-X and submit to PDP in one call
|
|
38
|
+
const result = await client.post('processing/invoices/submit-complete-async', {
|
|
39
|
+
invoiceData: {
|
|
40
|
+
number: 'INV-2025-001',
|
|
41
|
+
supplier: {
|
|
42
|
+
siret: '12345678901234',
|
|
43
|
+
iban: 'FR7630001007941234567890185',
|
|
44
|
+
routing_address: '12345678901234',
|
|
45
|
+
},
|
|
46
|
+
recipient: {
|
|
47
|
+
siret: '98765432109876',
|
|
48
|
+
routing_address: '98765432109876',
|
|
49
|
+
},
|
|
50
|
+
lines: [
|
|
51
|
+
{
|
|
52
|
+
description: 'Consulting services',
|
|
53
|
+
quantity: 10,
|
|
54
|
+
unitPrice: 100.0,
|
|
55
|
+
vatRate: 20.0,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
46
58
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
unitPrice: 100.0,
|
|
52
|
-
vatRate: 20,
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// Generate the Factur-X PDF
|
|
58
|
-
const pdfBytes = await client.generateFacturx(invoiceData, 'source_invoice.pdf');
|
|
59
|
-
|
|
60
|
-
fs.writeFileSync('facturx_invoice.pdf', pdfBytes);
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Available Helpers
|
|
64
|
-
|
|
65
|
-
### amount(value)
|
|
59
|
+
sourcePdf: pdfB64,
|
|
60
|
+
profile: 'EN16931',
|
|
61
|
+
destination: { type: 'afnor' },
|
|
62
|
+
});
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
// PDF is in result.content (auto-polled, auto-decoded from base64)
|
|
65
|
+
fs.writeFileSync('facturx_invoice.pdf', result.content);
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
import { amount } from '@factpulse/sdk/helpers';
|
|
71
|
-
|
|
72
|
-
amount(1234.5); // "1234.50"
|
|
73
|
-
amount("1234.56"); // "1234.56"
|
|
74
|
-
amount(null); // "0.00"
|
|
67
|
+
console.log(`Flow ID: ${result.afnorResult?.flowId}`);
|
|
75
68
|
```
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
## API Methods
|
|
78
71
|
|
|
79
|
-
|
|
72
|
+
The SDK provides two generic methods that map directly to API endpoints:
|
|
80
73
|
|
|
81
74
|
```typescript
|
|
82
|
-
|
|
75
|
+
// POST /api/v1/{path}
|
|
76
|
+
const result = await client.post('path/to/endpoint', { key1: value1, key2: value2 });
|
|
83
77
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
globalAllowanceReason: 'Loyalty', // Optional
|
|
87
|
-
prepayment: 100.00, // Optional
|
|
88
|
-
});
|
|
78
|
+
// GET /api/v1/{path}
|
|
79
|
+
const result = await client.get('path/to/endpoint', { param1: value1 });
|
|
89
80
|
```
|
|
90
81
|
|
|
91
|
-
###
|
|
82
|
+
### Common Endpoints
|
|
92
83
|
|
|
93
|
-
|
|
84
|
+
| Endpoint | Method | Description |
|
|
85
|
+
|----------|--------|-------------|
|
|
86
|
+
| `processing/invoices/submit-complete-async` | POST | Generate Factur-X + submit to PDP |
|
|
87
|
+
| `processing/generate-invoice` | POST | Generate Factur-X XML or PDF |
|
|
88
|
+
| `processing/validate-xml` | POST | Validate Factur-X XML |
|
|
89
|
+
| `processing/validate-facturx-pdf` | POST | Validate Factur-X PDF |
|
|
90
|
+
| `processing/sign-pdf` | POST | Sign PDF with certificate |
|
|
91
|
+
| `afnor/flow/v1/flows` | POST | Submit flow to AFNOR PDP |
|
|
92
|
+
| `afnor/incoming-flows/{flow_id}` | GET | Get incoming invoice |
|
|
93
|
+
| `chorus-pro/factures/soumettre` | POST | Submit to Chorus Pro |
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
import { invoiceLine } from '@factpulse/sdk/helpers';
|
|
97
|
-
|
|
98
|
-
const line = invoiceLine(
|
|
99
|
-
1,
|
|
100
|
-
'Consulting services',
|
|
101
|
-
5,
|
|
102
|
-
200.00,
|
|
103
|
-
1000.00,
|
|
104
|
-
{
|
|
105
|
-
vatRate: 'TVA20', // Or manualVatRate: '20.00'
|
|
106
|
-
vatCategory: 'S', // S, Z, E, AE, K
|
|
107
|
-
unit: 'HOUR', // LUMP_SUM, PIECE, HOUR, DAY...
|
|
108
|
-
reference: 'REF-001', // Optional
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
```
|
|
95
|
+
## Webhooks
|
|
112
96
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Creates a VAT breakdown line.
|
|
97
|
+
Instead of polling, you can receive results via webhook by adding `callbackUrl`:
|
|
116
98
|
|
|
117
99
|
```typescript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
// Submit with webhook - returns immediately
|
|
101
|
+
const result = await client.post('processing/invoices/submit-complete-async', {
|
|
102
|
+
invoiceData,
|
|
103
|
+
sourcePdf: pdfB64,
|
|
104
|
+
destination: { type: 'afnor' },
|
|
105
|
+
callbackUrl: 'https://your-server.com/webhook/factpulse',
|
|
106
|
+
webhookMode: 'INLINE', // or 'DOWNLOAD_URL'
|
|
123
107
|
});
|
|
124
|
-
```
|
|
125
108
|
|
|
126
|
-
|
|
109
|
+
const taskId = result.taskId;
|
|
110
|
+
// Result will be POSTed to your webhook URL
|
|
111
|
+
```
|
|
127
112
|
|
|
128
|
-
|
|
113
|
+
### Webhook Receiver Example (Express.js)
|
|
129
114
|
|
|
130
115
|
```typescript
|
|
131
|
-
import
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
116
|
+
import express from 'express';
|
|
117
|
+
import crypto from 'crypto';
|
|
118
|
+
|
|
119
|
+
const app = express();
|
|
120
|
+
app.use(express.json({ verify: (req, res, buf) => (req.rawBody = buf) }));
|
|
121
|
+
|
|
122
|
+
const WEBHOOK_SECRET = 'your-shared-secret';
|
|
123
|
+
|
|
124
|
+
function verifySignature(payload: Buffer, signature: string): boolean {
|
|
125
|
+
if (!signature.startsWith('sha256=')) return false;
|
|
126
|
+
const expected = crypto
|
|
127
|
+
.createHmac('sha256', WEBHOOK_SECRET)
|
|
128
|
+
.update(payload)
|
|
129
|
+
.digest('hex');
|
|
130
|
+
return crypto.timingSafeEqual(
|
|
131
|
+
Buffer.from(signature.slice(7)),
|
|
132
|
+
Buffer.from(expected)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
app.post('/webhook/factpulse', (req, res) => {
|
|
137
|
+
const signature = req.headers['x-webhook-signature'] as string || '';
|
|
138
|
+
if (!verifySignature(req.rawBody, signature)) {
|
|
139
|
+
return res.status(401).json({ error: 'Invalid signature' });
|
|
140
|
+
}
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
const event = req.body;
|
|
143
|
+
const eventType = event.event_type;
|
|
144
|
+
const data = event.data;
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
if (eventType === 'submission.completed') {
|
|
147
|
+
console.log(`Invoice submitted: ${data.afnorResult?.flowId}`);
|
|
148
|
+
} else if (eventType === 'submission.failed') {
|
|
149
|
+
console.log(`Submission failed: ${data.error}`);
|
|
150
|
+
}
|
|
145
151
|
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
res.json({ status: 'received' });
|
|
153
|
+
});
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
const address = electronicAddress('123456789');
|
|
155
|
+
app.listen(3000);
|
|
151
156
|
```
|
|
152
157
|
|
|
153
|
-
###
|
|
158
|
+
### Webhook Event Types
|
|
154
159
|
|
|
155
|
-
|
|
160
|
+
| Event | Description |
|
|
161
|
+
|-------|-------------|
|
|
162
|
+
| `generation.completed` | Factur-X generated successfully |
|
|
163
|
+
| `generation.failed` | Generation failed |
|
|
164
|
+
| `validation.completed` | Validation passed |
|
|
165
|
+
| `validation.failed` | Validation failed |
|
|
166
|
+
| `signature.completed` | PDF signed |
|
|
167
|
+
| `submission.completed` | Submitted to PDP/Chorus |
|
|
168
|
+
| `submission.failed` | Submission failed |
|
|
156
169
|
|
|
157
|
-
|
|
158
|
-
import { supplier } from '@factpulse/sdk/helpers';
|
|
159
|
-
|
|
160
|
-
const s = supplier(
|
|
161
|
-
'My Company SAS',
|
|
162
|
-
'12345678901234',
|
|
163
|
-
'123 Example Street',
|
|
164
|
-
'75001',
|
|
165
|
-
'Paris',
|
|
166
|
-
{ iban: 'FR7630006000011234567890189' }
|
|
167
|
-
);
|
|
168
|
-
// SIREN and intra-EU VAT number calculated automatically
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### recipient(name, siret, addressLine1, postalCode, city, options?)
|
|
170
|
+
## Zero-Storage Mode
|
|
172
171
|
|
|
173
|
-
|
|
172
|
+
Pass PDP credentials directly in the request (no server-side storage):
|
|
174
173
|
|
|
175
174
|
```typescript
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
const result = await client.post('processing/invoices/submit-complete-async', {
|
|
176
|
+
invoiceData,
|
|
177
|
+
sourcePdf: pdfB64,
|
|
178
|
+
destination: {
|
|
179
|
+
type: 'afnor',
|
|
180
|
+
flowServiceUrl: 'https://api.pdp.example.com/flow/v1',
|
|
181
|
+
tokenUrl: 'https://auth.pdp.example.com/oauth/token',
|
|
182
|
+
clientId: 'your_pdp_client_id',
|
|
183
|
+
clientSecret: 'your_pdp_client_secret',
|
|
184
|
+
},
|
|
185
|
+
});
|
|
185
186
|
```
|
|
186
187
|
|
|
187
|
-
##
|
|
188
|
-
|
|
189
|
-
To pass your own credentials without server-side storage:
|
|
188
|
+
## Error Handling
|
|
190
189
|
|
|
191
190
|
```typescript
|
|
192
|
-
import {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
pisteClientSecret: 'your_client_secret',
|
|
204
|
-
chorusProLogin: 'your_login',
|
|
205
|
-
chorusProPassword: 'your_password',
|
|
206
|
-
sandbox: true,
|
|
207
|
-
},
|
|
208
|
-
afnorCredentials: {
|
|
209
|
-
flowServiceUrl: 'https://api.pdp.fr/flow/v1',
|
|
210
|
-
tokenUrl: 'https://auth.pdp.fr/oauth/token',
|
|
211
|
-
clientId: 'your_client_id',
|
|
212
|
-
clientSecret: 'your_client_secret',
|
|
213
|
-
},
|
|
214
|
-
});
|
|
191
|
+
import { FactPulseClient, FactPulseError } from '@factpulse/sdk/helpers';
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
const result = await client.post('processing/validate-xml', { xmlContent });
|
|
195
|
+
} catch (e) {
|
|
196
|
+
if (e instanceof FactPulseError) {
|
|
197
|
+
console.log(`Error: ${e.message}`);
|
|
198
|
+
console.log(`Status code: ${e.statusCode}`);
|
|
199
|
+
console.log(`Details: ${e.details}`); // Validation errors list
|
|
200
|
+
}
|
|
201
|
+
}
|
|
215
202
|
```
|
|
216
203
|
|
|
217
204
|
## Resources
|
|
@@ -28,8 +28,6 @@ import type { APIProfile } from '../models';
|
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
import type { AsyncTaskStatus } from '../models';
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
import type { FactureElectroniqueRestApiSchemasValidationValidationErrorResponse } from '../models';
|
|
32
|
-
// @ts-ignore
|
|
33
31
|
import type { GenerateCertificateRequest } from '../models';
|
|
34
32
|
// @ts-ignore
|
|
35
33
|
import type { GenerateCertificateResponse } from '../models';
|
|
@@ -46,6 +44,8 @@ import type { SubmitCompleteInvoiceResponse } from '../models';
|
|
|
46
44
|
// @ts-ignore
|
|
47
45
|
import type { TaskResponse } from '../models';
|
|
48
46
|
// @ts-ignore
|
|
47
|
+
import type { ValidationErrorResponse } from '../models';
|
|
48
|
+
// @ts-ignore
|
|
49
49
|
import type { ValidationSuccessResponse } from '../models';
|
|
50
50
|
/**
|
|
51
51
|
* InvoiceProcessingApi - axios parameter creator
|
|
@@ -10,15 +10,27 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Chorus Pro credentials for Zero-Trust mode. **Zero-Trust Mode**: Credentials are passed in each request and are NEVER stored. **Security**: - Credentials are never persisted in the database - They are used only for the duration of the request - Secure transmission via HTTPS **Use cases**: - High-security environments (banks, administrations) - Strict GDPR compliance - Tests with temporary credentials - Users who don\'t want to store their credentials
|
|
14
14
|
*/
|
|
15
15
|
export interface ChorusProCredentials {
|
|
16
|
-
'pisteClientId'?: string | null;
|
|
17
|
-
'pisteClientSecret'?: string | null;
|
|
18
|
-
'chorusLogin'?: string | null;
|
|
19
|
-
'chorusPassword'?: string | null;
|
|
20
16
|
/**
|
|
21
|
-
*
|
|
17
|
+
* PISTE Client ID (government API portal)
|
|
22
18
|
*/
|
|
23
|
-
'
|
|
19
|
+
'pisteClientId': string;
|
|
20
|
+
/**
|
|
21
|
+
* PISTE Client Secret
|
|
22
|
+
*/
|
|
23
|
+
'pisteClientSecret': string;
|
|
24
|
+
/**
|
|
25
|
+
* Chorus Pro login
|
|
26
|
+
*/
|
|
27
|
+
'chorusProLogin': string;
|
|
28
|
+
/**
|
|
29
|
+
* Chorus Pro password
|
|
30
|
+
*/
|
|
31
|
+
'chorusProPassword': string;
|
|
32
|
+
/**
|
|
33
|
+
* Use sandbox environment (true) or production (false)
|
|
34
|
+
*/
|
|
35
|
+
'sandbox'?: boolean;
|
|
24
36
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { FactureElectroniqueRestApiSchemasProcessingChorusProCredentials } from './facture-electronique-rest-api-schemas-processing-chorus-pro-credentials';
|
|
13
13
|
/**
|
|
14
14
|
* Specific configuration for Chorus Pro destination.
|
|
15
15
|
*/
|
|
16
16
|
export interface ChorusProDestination {
|
|
17
17
|
'type'?: ChorusProDestinationTypeEnum;
|
|
18
|
-
'credentials'?:
|
|
18
|
+
'credentials'?: FactureElectroniqueRestApiSchemasProcessingChorusProCredentials | null;
|
|
19
19
|
}
|
|
20
20
|
export declare const ChorusProDestinationTypeEnum: {
|
|
21
21
|
readonly ChorusPro: "chorus_pro";
|
|
@@ -10,27 +10,72 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Document type according to BR-FR-04 (UNTDID 1001 codes). | Code | Name | Description | |------|------|-------------| | 380 | INVOICE | Commercial invoice | | 389 | SELF_BILLED_INVOICE | Self-billed invoice | | 393 | FACTORED_INVOICE | Factored invoice | | 501 | SELF_BILLED_FACTORED_INVOICE | Self-billed factored invoice | | 386 | PREPAYMENT_INVOICE | Prepayment invoice | | 500 | SELF_BILLED_PREPAYMENT_INVOICE | Self-billed prepayment invoice | | 384 | CORRECTIVE_INVOICE | Corrective invoice | | 471 | SELF_BILLED_CORRECTIVE_INVOICE | Self-billed corrective invoice | | 472 | FACTORED_CORRECTIVE_INVOICE | Factored corrective invoice | | 473 | SELF_BILLED_FACTORED_CORRECTIVE_INVOICE | Self-billed factored corrective invoice | | 381 | CREDIT_NOTE | Credit note | | 261 | SELF_BILLED_CREDIT_NOTE | Self-billed credit note | | 262 | GLOBAL_ALLOWANCE_CREDIT_NOTE | Credit note for global allowance | | 396 | FACTORED_CREDIT_NOTE | Factored credit note | | 502 | SELF_BILLED_FACTORED_CREDIT_NOTE | Self-billed factored credit note | | 503 | PREPAYMENT_CREDIT_NOTE | Credit note for prepayment invoice |
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare const FactureElectroniqueModelsInvoiceTypeCode: {
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* Commercial Invoice
|
|
18
|
+
*/
|
|
19
|
+
readonly INVOICE: "380";
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
* Self-billed Invoice
|
|
22
|
+
*/
|
|
23
|
+
readonly SELF_BILLED_INVOICE: "389";
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
* Factored Invoice
|
|
26
|
+
*/
|
|
27
|
+
readonly FACTORED_INVOICE: "393";
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
* Self-billed Factored Invoice
|
|
30
|
+
*/
|
|
31
|
+
readonly SELF_BILLED_FACTORED_INVOICE: "501";
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
* Prepayment Invoice
|
|
34
|
+
*/
|
|
35
|
+
readonly PREPAYMENT_INVOICE: "386";
|
|
36
|
+
/**
|
|
37
|
+
* Self-billed Prepayment Invoice
|
|
38
|
+
*/
|
|
39
|
+
readonly SELF_BILLED_PREPAYMENT_INVOICE: "500";
|
|
40
|
+
/**
|
|
41
|
+
* Corrective Invoice
|
|
42
|
+
*/
|
|
43
|
+
readonly CORRECTIVE_INVOICE: "384";
|
|
44
|
+
/**
|
|
45
|
+
* Self-billed Corrective Invoice
|
|
46
|
+
*/
|
|
47
|
+
readonly SELF_BILLED_CORRECTIVE_INVOICE: "471";
|
|
48
|
+
/**
|
|
49
|
+
* Factored Corrective Invoice
|
|
50
|
+
*/
|
|
51
|
+
readonly FACTORED_CORRECTIVE_INVOICE: "472";
|
|
52
|
+
/**
|
|
53
|
+
* Self-billed Factored Corrective Invoice
|
|
54
|
+
*/
|
|
55
|
+
readonly SELF_BILLED_FACTORED_CORRECTIVE_INVOICE: "473";
|
|
56
|
+
/**
|
|
57
|
+
* Credit Note
|
|
58
|
+
*/
|
|
59
|
+
readonly CREDIT_NOTE: "381";
|
|
60
|
+
/**
|
|
61
|
+
* Self-billed Credit Note
|
|
62
|
+
*/
|
|
63
|
+
readonly SELF_BILLED_CREDIT_NOTE: "261";
|
|
64
|
+
/**
|
|
65
|
+
* Global Allowance Credit Note
|
|
66
|
+
*/
|
|
67
|
+
readonly GLOBAL_ALLOWANCE_CREDIT_NOTE: "262";
|
|
68
|
+
/**
|
|
69
|
+
* Factored Credit Note
|
|
70
|
+
*/
|
|
71
|
+
readonly FACTORED_CREDIT_NOTE: "396";
|
|
72
|
+
/**
|
|
73
|
+
* Self-billed Factored Credit Note
|
|
74
|
+
*/
|
|
75
|
+
readonly SELF_BILLED_FACTORED_CREDIT_NOTE: "502";
|
|
76
|
+
/**
|
|
77
|
+
* Prepayment Credit Note
|
|
78
|
+
*/
|
|
79
|
+
readonly PREPAYMENT_CREDIT_NOTE: "503";
|
|
80
|
+
};
|
|
81
|
+
export type FactureElectroniqueModelsInvoiceTypeCode = typeof FactureElectroniqueModelsInvoiceTypeCode[keyof typeof FactureElectroniqueModelsInvoiceTypeCode];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* tslint:disable */
|
|
3
2
|
/* eslint-disable */
|
|
4
3
|
/**
|
|
@@ -12,15 +11,72 @@
|
|
|
12
11
|
* https://openapi-generator.tech
|
|
13
12
|
* Do not edit the class manually.
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode = void 0;
|
|
17
14
|
/**
|
|
18
|
-
*
|
|
15
|
+
* Document type according to BR-FR-04 (UNTDID 1001 codes). | Code | Name | Description | |------|------|-------------| | 380 | INVOICE | Commercial invoice | | 389 | SELF_BILLED_INVOICE | Self-billed invoice | | 393 | FACTORED_INVOICE | Factored invoice | | 501 | SELF_BILLED_FACTORED_INVOICE | Self-billed factored invoice | | 386 | PREPAYMENT_INVOICE | Prepayment invoice | | 500 | SELF_BILLED_PREPAYMENT_INVOICE | Self-billed prepayment invoice | | 384 | CORRECTIVE_INVOICE | Corrective invoice | | 471 | SELF_BILLED_CORRECTIVE_INVOICE | Self-billed corrective invoice | | 472 | FACTORED_CORRECTIVE_INVOICE | Factored corrective invoice | | 473 | SELF_BILLED_FACTORED_CORRECTIVE_INVOICE | Self-billed factored corrective invoice | | 381 | CREDIT_NOTE | Credit note | | 261 | SELF_BILLED_CREDIT_NOTE | Self-billed credit note | | 262 | GLOBAL_ALLOWANCE_CREDIT_NOTE | Credit note for global allowance | | 396 | FACTORED_CREDIT_NOTE | Factored credit note | | 502 | SELF_BILLED_FACTORED_CREDIT_NOTE | Self-billed factored credit note | | 503 | PREPAYMENT_CREDIT_NOTE | Credit note for prepayment invoice |
|
|
19
16
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
export const FactureElectroniqueModelsInvoiceTypeCode = {
|
|
18
|
+
/**
|
|
19
|
+
* Commercial Invoice
|
|
20
|
+
*/
|
|
21
|
+
INVOICE: '380',
|
|
22
|
+
/**
|
|
23
|
+
* Self-billed Invoice
|
|
24
|
+
*/
|
|
25
|
+
SELF_BILLED_INVOICE: '389',
|
|
26
|
+
/**
|
|
27
|
+
* Factored Invoice
|
|
28
|
+
*/
|
|
29
|
+
FACTORED_INVOICE: '393',
|
|
30
|
+
/**
|
|
31
|
+
* Self-billed Factored Invoice
|
|
32
|
+
*/
|
|
33
|
+
SELF_BILLED_FACTORED_INVOICE: '501',
|
|
34
|
+
/**
|
|
35
|
+
* Prepayment Invoice
|
|
36
|
+
*/
|
|
37
|
+
PREPAYMENT_INVOICE: '386',
|
|
38
|
+
/**
|
|
39
|
+
* Self-billed Prepayment Invoice
|
|
40
|
+
*/
|
|
41
|
+
SELF_BILLED_PREPAYMENT_INVOICE: '500',
|
|
42
|
+
/**
|
|
43
|
+
* Corrective Invoice
|
|
44
|
+
*/
|
|
45
|
+
CORRECTIVE_INVOICE: '384',
|
|
46
|
+
/**
|
|
47
|
+
* Self-billed Corrective Invoice
|
|
48
|
+
*/
|
|
49
|
+
SELF_BILLED_CORRECTIVE_INVOICE: '471',
|
|
50
|
+
/**
|
|
51
|
+
* Factored Corrective Invoice
|
|
52
|
+
*/
|
|
53
|
+
FACTORED_CORRECTIVE_INVOICE: '472',
|
|
54
|
+
/**
|
|
55
|
+
* Self-billed Factored Corrective Invoice
|
|
56
|
+
*/
|
|
57
|
+
SELF_BILLED_FACTORED_CORRECTIVE_INVOICE: '473',
|
|
58
|
+
/**
|
|
59
|
+
* Credit Note
|
|
60
|
+
*/
|
|
61
|
+
CREDIT_NOTE: '381',
|
|
62
|
+
/**
|
|
63
|
+
* Self-billed Credit Note
|
|
64
|
+
*/
|
|
65
|
+
SELF_BILLED_CREDIT_NOTE: '261',
|
|
66
|
+
/**
|
|
67
|
+
* Global Allowance Credit Note
|
|
68
|
+
*/
|
|
69
|
+
GLOBAL_ALLOWANCE_CREDIT_NOTE: '262',
|
|
70
|
+
/**
|
|
71
|
+
* Factored Credit Note
|
|
72
|
+
*/
|
|
73
|
+
FACTORED_CREDIT_NOTE: '396',
|
|
74
|
+
/**
|
|
75
|
+
* Self-billed Factored Credit Note
|
|
76
|
+
*/
|
|
77
|
+
SELF_BILLED_FACTORED_CREDIT_NOTE: '502',
|
|
78
|
+
/**
|
|
79
|
+
* Prepayment Credit Note
|
|
80
|
+
*/
|
|
81
|
+
PREPAYMENT_CREDIT_NOTE: '503'
|
|
26
82
|
};
|