factpulse 2.0.34 → 2.0.36
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile.lock +2 -2
- data/docs/BoundingBoxSchema.md +30 -0
- data/docs/CadreDeFacturation.md +2 -0
- data/docs/ChampVerifieSchema.md +34 -0
- data/docs/DimensionPageSchema.md +20 -0
- data/docs/DirectionFlux.md +15 -0
- data/docs/FluxResume.md +32 -0
- data/docs/LigneDeTVA.md +5 -1
- data/docs/NatureOperation.md +15 -0
- data/docs/Note.md +4 -4
- data/docs/NoteObligatoireSchema.md +30 -0
- data/docs/PDPCredentials.md +26 -0
- data/docs/ProfilFlux.md +15 -0
- data/docs/ReponseHealthcheckAFNOR.md +22 -0
- data/docs/ReponseRechercheFlux.md +24 -0
- data/docs/ReponseSoumissionFlux.md +30 -0
- data/docs/ReponseVerificationSucces.md +36 -0
- data/docs/RequeteRechercheFlux.md +34 -0
- data/docs/RequeteSoumissionFlux.md +28 -0
- data/docs/StatutAcquittement.md +15 -0
- data/docs/StatutChampAPI.md +15 -0
- data/docs/SyntaxeFlux.md +15 -0
- data/docs/TraitementFactureApi.md +2 -2
- data/docs/TypeFlux.md +15 -0
- data/docs/VrificationPDFXMLApi.md +435 -0
- data/lib/factpulse/api/traitement_facture_api.rb +4 -4
- data/lib/factpulse/api/vrification_pdfxml_api.rb +430 -0
- data/lib/factpulse/helpers/client.rb +2 -1
- data/lib/factpulse/models/bounding_box_schema.rb +332 -0
- data/lib/factpulse/models/cadre_de_facturation.rb +12 -2
- data/lib/factpulse/models/champ_verifie_schema.rb +334 -0
- data/lib/factpulse/models/dimension_page_schema.rb +193 -0
- data/lib/factpulse/models/direction_flux.rb +40 -0
- data/lib/factpulse/models/flux_resume.rb +251 -0
- data/lib/factpulse/models/ligne_de_tva.rb +26 -6
- data/lib/factpulse/models/nature_operation.rb +66 -0
- data/lib/factpulse/models/note.rb +23 -23
- data/lib/factpulse/models/note_obligatoire_schema.rb +265 -0
- data/lib/factpulse/models/pdp_credentials.rb +257 -0
- data/lib/factpulse/models/profil_flux.rb +41 -0
- data/lib/factpulse/models/reponse_healthcheck_afnor.rb +220 -0
- data/lib/factpulse/models/reponse_recherche_flux.rb +249 -0
- data/lib/factpulse/models/reponse_soumission_flux.rb +294 -0
- data/lib/factpulse/models/reponse_verification_succes.rb +343 -0
- data/lib/factpulse/models/requete_recherche_flux.rb +306 -0
- data/lib/factpulse/models/requete_soumission_flux.rb +238 -0
- data/lib/factpulse/models/statut_acquittement.rb +41 -0
- data/lib/factpulse/models/statut_champ_api.rb +43 -0
- data/lib/factpulse/models/syntaxe_flux.rb +43 -0
- data/lib/factpulse/models/type_flux.rb +43 -0
- data/lib/factpulse/version.rb +1 -1
- data/lib/factpulse.rb +20 -0
- metadata +42 -2
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# FactPulse::VrificationPDFXMLApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *http://localhost*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get**](VrificationPDFXMLApi.md#obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get) | **GET** /api/v1/verification/verifier-async/{id_tache}/statut | Obtenir le statut d'une vérification asynchrone |
|
|
8
|
+
| [**obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0**](VrificationPDFXMLApi.md#obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0) | **GET** /api/v1/verification/verifier-async/{id_tache}/statut | Obtenir le statut d'une vérification asynchrone |
|
|
9
|
+
| [**verifier_pdf_async_api_v1_verification_verifier_async_post**](VrificationPDFXMLApi.md#verifier_pdf_async_api_v1_verification_verifier_async_post) | **POST** /api/v1/verification/verifier-async | Vérifier la conformité PDF/XML Factur-X (asynchrone) |
|
|
10
|
+
| [**verifier_pdf_async_api_v1_verification_verifier_async_post_0**](VrificationPDFXMLApi.md#verifier_pdf_async_api_v1_verification_verifier_async_post_0) | **POST** /api/v1/verification/verifier-async | Vérifier la conformité PDF/XML Factur-X (asynchrone) |
|
|
11
|
+
| [**verifier_pdf_sync_api_v1_verification_verifier_post**](VrificationPDFXMLApi.md#verifier_pdf_sync_api_v1_verification_verifier_post) | **POST** /api/v1/verification/verifier | Vérifier la conformité PDF/XML Factur-X (synchrone) |
|
|
12
|
+
| [**verifier_pdf_sync_api_v1_verification_verifier_post_0**](VrificationPDFXMLApi.md#verifier_pdf_sync_api_v1_verification_verifier_post_0) | **POST** /api/v1/verification/verifier | Vérifier la conformité PDF/XML Factur-X (synchrone) |
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get
|
|
16
|
+
|
|
17
|
+
> <StatutTache> obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get(id_tache)
|
|
18
|
+
|
|
19
|
+
Obtenir le statut d'une vérification asynchrone
|
|
20
|
+
|
|
21
|
+
Récupère le statut et le résultat d'une tâche de vérification asynchrone. **Statuts possibles:** - `PENDING`: Tâche en attente dans la file - `STARTED`: Tâche en cours d'exécution - `SUCCESS`: Tâche terminée avec succès (voir `resultat`) - `FAILURE`: Erreur système (exception non gérée) **Note:** Le champ `resultat.statut` peut être \"SUCCES\" ou \"ERREUR\" indépendamment du statut Celery (qui sera toujours SUCCESS si la tâche s'est exécutée).
|
|
22
|
+
|
|
23
|
+
### Examples
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require 'time'
|
|
27
|
+
require 'factpulse'
|
|
28
|
+
# setup authorization
|
|
29
|
+
FactPulse.configure do |config|
|
|
30
|
+
# Configure Bearer authorization: HTTPBearer
|
|
31
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
35
|
+
id_tache = 'id_tache_example' # String |
|
|
36
|
+
|
|
37
|
+
begin
|
|
38
|
+
# Obtenir le statut d'une vérification asynchrone
|
|
39
|
+
result = api_instance.obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get(id_tache)
|
|
40
|
+
p result
|
|
41
|
+
rescue FactPulse::ApiError => e
|
|
42
|
+
puts "Error when calling VrificationPDFXMLApi->obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get: #{e}"
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Using the obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_with_http_info variant
|
|
47
|
+
|
|
48
|
+
This returns an Array which contains the response data, status code and headers.
|
|
49
|
+
|
|
50
|
+
> <Array(<StatutTache>, Integer, Hash)> obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_with_http_info(id_tache)
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
begin
|
|
54
|
+
# Obtenir le statut d'une vérification asynchrone
|
|
55
|
+
data, status_code, headers = api_instance.obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_with_http_info(id_tache)
|
|
56
|
+
p status_code # => 2xx
|
|
57
|
+
p headers # => { ... }
|
|
58
|
+
p data # => <StatutTache>
|
|
59
|
+
rescue FactPulse::ApiError => e
|
|
60
|
+
puts "Error when calling VrificationPDFXMLApi->obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_with_http_info: #{e}"
|
|
61
|
+
end
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Parameters
|
|
65
|
+
|
|
66
|
+
| Name | Type | Description | Notes |
|
|
67
|
+
| ---- | ---- | ----------- | ----- |
|
|
68
|
+
| **id_tache** | **String** | | |
|
|
69
|
+
|
|
70
|
+
### Return type
|
|
71
|
+
|
|
72
|
+
[**StatutTache**](StatutTache.md)
|
|
73
|
+
|
|
74
|
+
### Authorization
|
|
75
|
+
|
|
76
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
77
|
+
|
|
78
|
+
### HTTP request headers
|
|
79
|
+
|
|
80
|
+
- **Content-Type**: Not defined
|
|
81
|
+
- **Accept**: application/json
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0
|
|
85
|
+
|
|
86
|
+
> <StatutTache> obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0(id_tache)
|
|
87
|
+
|
|
88
|
+
Obtenir le statut d'une vérification asynchrone
|
|
89
|
+
|
|
90
|
+
Récupère le statut et le résultat d'une tâche de vérification asynchrone. **Statuts possibles:** - `PENDING`: Tâche en attente dans la file - `STARTED`: Tâche en cours d'exécution - `SUCCESS`: Tâche terminée avec succès (voir `resultat`) - `FAILURE`: Erreur système (exception non gérée) **Note:** Le champ `resultat.statut` peut être \"SUCCES\" ou \"ERREUR\" indépendamment du statut Celery (qui sera toujours SUCCESS si la tâche s'est exécutée).
|
|
91
|
+
|
|
92
|
+
### Examples
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
require 'time'
|
|
96
|
+
require 'factpulse'
|
|
97
|
+
# setup authorization
|
|
98
|
+
FactPulse.configure do |config|
|
|
99
|
+
# Configure Bearer authorization: HTTPBearer
|
|
100
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
104
|
+
id_tache = 'id_tache_example' # String |
|
|
105
|
+
|
|
106
|
+
begin
|
|
107
|
+
# Obtenir le statut d'une vérification asynchrone
|
|
108
|
+
result = api_instance.obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0(id_tache)
|
|
109
|
+
p result
|
|
110
|
+
rescue FactPulse::ApiError => e
|
|
111
|
+
puts "Error when calling VrificationPDFXMLApi->obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0: #{e}"
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Using the obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0_with_http_info variant
|
|
116
|
+
|
|
117
|
+
This returns an Array which contains the response data, status code and headers.
|
|
118
|
+
|
|
119
|
+
> <Array(<StatutTache>, Integer, Hash)> obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0_with_http_info(id_tache)
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
begin
|
|
123
|
+
# Obtenir le statut d'une vérification asynchrone
|
|
124
|
+
data, status_code, headers = api_instance.obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0_with_http_info(id_tache)
|
|
125
|
+
p status_code # => 2xx
|
|
126
|
+
p headers # => { ... }
|
|
127
|
+
p data # => <StatutTache>
|
|
128
|
+
rescue FactPulse::ApiError => e
|
|
129
|
+
puts "Error when calling VrificationPDFXMLApi->obtenir_statut_verification_api_v1_verification_verifier_async_id_tache_statut_get_0_with_http_info: #{e}"
|
|
130
|
+
end
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Parameters
|
|
134
|
+
|
|
135
|
+
| Name | Type | Description | Notes |
|
|
136
|
+
| ---- | ---- | ----------- | ----- |
|
|
137
|
+
| **id_tache** | **String** | | |
|
|
138
|
+
|
|
139
|
+
### Return type
|
|
140
|
+
|
|
141
|
+
[**StatutTache**](StatutTache.md)
|
|
142
|
+
|
|
143
|
+
### Authorization
|
|
144
|
+
|
|
145
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
146
|
+
|
|
147
|
+
### HTTP request headers
|
|
148
|
+
|
|
149
|
+
- **Content-Type**: Not defined
|
|
150
|
+
- **Accept**: application/json
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## verifier_pdf_async_api_v1_verification_verifier_async_post
|
|
154
|
+
|
|
155
|
+
> <ReponseTache> verifier_pdf_async_api_v1_verification_verifier_async_post(fichier_pdf, opts)
|
|
156
|
+
|
|
157
|
+
Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
158
|
+
|
|
159
|
+
Vérifie la conformité PDF/XML Factur-X de manière asynchrone. **IMPORTANT**: Seuls les PDF Factur-X (avec XML embarqué) sont acceptés. Les PDF sans XML Factur-X retourneront une erreur `NOT_FACTURX` dans le résultat. Cette version utilise une tâche Celery et peut faire appel au service OCR si le PDF est une image ou si `forcer_ocr=true`. **Retourne immédiatement** un ID de tâche. Utilisez `/verifier-async/{id_tache}/statut` pour récupérer le résultat. **Principe de vérification (Factur-X 1.08):** - Principe n°2: Le XML ne peut contenir que des infos présentes dans le PDF - Principe n°4: Toute info XML doit être présente et conforme dans le PDF **Champs vérifiés:** - Identification: BT-1 (n° facture), BT-2 (date), BT-3 (type), BT-5 (devise), BT-23 (cadre) - Vendeur: BT-27 (nom), BT-29 (SIRET), BT-30 (SIREN), BT-31 (TVA) - Acheteur: BT-44 (nom), BT-46 (SIRET), BT-47 (SIREN), BT-48 (TVA) - Montants: BT-109 (HT), BT-110 (TVA), BT-112 (TTC), BT-115 (à payer) - Ventilation TVA: BT-116, BT-117, BT-118, BT-119 - Lignes de facture: BT-153, BT-129, BT-146, BT-131 - Notes obligatoires: PMT, PMD, AAB - Règle BR-FR-09: cohérence SIRET/SIREN **Avantages par rapport à la version synchrone:** - Support OCR pour les PDF images (via service DocTR) - Timeout plus long pour les gros documents - Ne bloque pas le serveur
|
|
160
|
+
|
|
161
|
+
### Examples
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
require 'time'
|
|
165
|
+
require 'factpulse'
|
|
166
|
+
# setup authorization
|
|
167
|
+
FactPulse.configure do |config|
|
|
168
|
+
# Configure Bearer authorization: HTTPBearer
|
|
169
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
173
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à vérifier
|
|
174
|
+
opts = {
|
|
175
|
+
forcer_ocr: true # Boolean | Forcer l'utilisation de l'OCR même si le PDF contient du texte natif
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
begin
|
|
179
|
+
# Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
180
|
+
result = api_instance.verifier_pdf_async_api_v1_verification_verifier_async_post(fichier_pdf, opts)
|
|
181
|
+
p result
|
|
182
|
+
rescue FactPulse::ApiError => e
|
|
183
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_async_api_v1_verification_verifier_async_post: #{e}"
|
|
184
|
+
end
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### Using the verifier_pdf_async_api_v1_verification_verifier_async_post_with_http_info variant
|
|
188
|
+
|
|
189
|
+
This returns an Array which contains the response data, status code and headers.
|
|
190
|
+
|
|
191
|
+
> <Array(<ReponseTache>, Integer, Hash)> verifier_pdf_async_api_v1_verification_verifier_async_post_with_http_info(fichier_pdf, opts)
|
|
192
|
+
|
|
193
|
+
```ruby
|
|
194
|
+
begin
|
|
195
|
+
# Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
196
|
+
data, status_code, headers = api_instance.verifier_pdf_async_api_v1_verification_verifier_async_post_with_http_info(fichier_pdf, opts)
|
|
197
|
+
p status_code # => 2xx
|
|
198
|
+
p headers # => { ... }
|
|
199
|
+
p data # => <ReponseTache>
|
|
200
|
+
rescue FactPulse::ApiError => e
|
|
201
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_async_api_v1_verification_verifier_async_post_with_http_info: #{e}"
|
|
202
|
+
end
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Parameters
|
|
206
|
+
|
|
207
|
+
| Name | Type | Description | Notes |
|
|
208
|
+
| ---- | ---- | ----------- | ----- |
|
|
209
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à vérifier | |
|
|
210
|
+
| **forcer_ocr** | **Boolean** | Forcer l'utilisation de l'OCR même si le PDF contient du texte natif | [optional][default to false] |
|
|
211
|
+
|
|
212
|
+
### Return type
|
|
213
|
+
|
|
214
|
+
[**ReponseTache**](ReponseTache.md)
|
|
215
|
+
|
|
216
|
+
### Authorization
|
|
217
|
+
|
|
218
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
219
|
+
|
|
220
|
+
### HTTP request headers
|
|
221
|
+
|
|
222
|
+
- **Content-Type**: multipart/form-data
|
|
223
|
+
- **Accept**: application/json
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## verifier_pdf_async_api_v1_verification_verifier_async_post_0
|
|
227
|
+
|
|
228
|
+
> <ReponseTache> verifier_pdf_async_api_v1_verification_verifier_async_post_0(fichier_pdf, opts)
|
|
229
|
+
|
|
230
|
+
Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
231
|
+
|
|
232
|
+
Vérifie la conformité PDF/XML Factur-X de manière asynchrone. **IMPORTANT**: Seuls les PDF Factur-X (avec XML embarqué) sont acceptés. Les PDF sans XML Factur-X retourneront une erreur `NOT_FACTURX` dans le résultat. Cette version utilise une tâche Celery et peut faire appel au service OCR si le PDF est une image ou si `forcer_ocr=true`. **Retourne immédiatement** un ID de tâche. Utilisez `/verifier-async/{id_tache}/statut` pour récupérer le résultat. **Principe de vérification (Factur-X 1.08):** - Principe n°2: Le XML ne peut contenir que des infos présentes dans le PDF - Principe n°4: Toute info XML doit être présente et conforme dans le PDF **Champs vérifiés:** - Identification: BT-1 (n° facture), BT-2 (date), BT-3 (type), BT-5 (devise), BT-23 (cadre) - Vendeur: BT-27 (nom), BT-29 (SIRET), BT-30 (SIREN), BT-31 (TVA) - Acheteur: BT-44 (nom), BT-46 (SIRET), BT-47 (SIREN), BT-48 (TVA) - Montants: BT-109 (HT), BT-110 (TVA), BT-112 (TTC), BT-115 (à payer) - Ventilation TVA: BT-116, BT-117, BT-118, BT-119 - Lignes de facture: BT-153, BT-129, BT-146, BT-131 - Notes obligatoires: PMT, PMD, AAB - Règle BR-FR-09: cohérence SIRET/SIREN **Avantages par rapport à la version synchrone:** - Support OCR pour les PDF images (via service DocTR) - Timeout plus long pour les gros documents - Ne bloque pas le serveur
|
|
233
|
+
|
|
234
|
+
### Examples
|
|
235
|
+
|
|
236
|
+
```ruby
|
|
237
|
+
require 'time'
|
|
238
|
+
require 'factpulse'
|
|
239
|
+
# setup authorization
|
|
240
|
+
FactPulse.configure do |config|
|
|
241
|
+
# Configure Bearer authorization: HTTPBearer
|
|
242
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
246
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à vérifier
|
|
247
|
+
opts = {
|
|
248
|
+
forcer_ocr: true # Boolean | Forcer l'utilisation de l'OCR même si le PDF contient du texte natif
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
begin
|
|
252
|
+
# Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
253
|
+
result = api_instance.verifier_pdf_async_api_v1_verification_verifier_async_post_0(fichier_pdf, opts)
|
|
254
|
+
p result
|
|
255
|
+
rescue FactPulse::ApiError => e
|
|
256
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_async_api_v1_verification_verifier_async_post_0: #{e}"
|
|
257
|
+
end
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### Using the verifier_pdf_async_api_v1_verification_verifier_async_post_0_with_http_info variant
|
|
261
|
+
|
|
262
|
+
This returns an Array which contains the response data, status code and headers.
|
|
263
|
+
|
|
264
|
+
> <Array(<ReponseTache>, Integer, Hash)> verifier_pdf_async_api_v1_verification_verifier_async_post_0_with_http_info(fichier_pdf, opts)
|
|
265
|
+
|
|
266
|
+
```ruby
|
|
267
|
+
begin
|
|
268
|
+
# Vérifier la conformité PDF/XML Factur-X (asynchrone)
|
|
269
|
+
data, status_code, headers = api_instance.verifier_pdf_async_api_v1_verification_verifier_async_post_0_with_http_info(fichier_pdf, opts)
|
|
270
|
+
p status_code # => 2xx
|
|
271
|
+
p headers # => { ... }
|
|
272
|
+
p data # => <ReponseTache>
|
|
273
|
+
rescue FactPulse::ApiError => e
|
|
274
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_async_api_v1_verification_verifier_async_post_0_with_http_info: #{e}"
|
|
275
|
+
end
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Parameters
|
|
279
|
+
|
|
280
|
+
| Name | Type | Description | Notes |
|
|
281
|
+
| ---- | ---- | ----------- | ----- |
|
|
282
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à vérifier | |
|
|
283
|
+
| **forcer_ocr** | **Boolean** | Forcer l'utilisation de l'OCR même si le PDF contient du texte natif | [optional][default to false] |
|
|
284
|
+
|
|
285
|
+
### Return type
|
|
286
|
+
|
|
287
|
+
[**ReponseTache**](ReponseTache.md)
|
|
288
|
+
|
|
289
|
+
### Authorization
|
|
290
|
+
|
|
291
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
292
|
+
|
|
293
|
+
### HTTP request headers
|
|
294
|
+
|
|
295
|
+
- **Content-Type**: multipart/form-data
|
|
296
|
+
- **Accept**: application/json
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
## verifier_pdf_sync_api_v1_verification_verifier_post
|
|
300
|
+
|
|
301
|
+
> <ReponseVerificationSucces> verifier_pdf_sync_api_v1_verification_verifier_post(fichier_pdf)
|
|
302
|
+
|
|
303
|
+
Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
304
|
+
|
|
305
|
+
Vérifie la conformité entre le PDF et son XML Factur-X embarqué. **IMPORTANT**: Seuls les PDF Factur-X (avec XML embarqué) sont acceptés. Les PDF sans XML Factur-X seront rejetés avec une erreur 400. Cette version synchrone utilise uniquement l'extraction PDF native (pdfplumber). Pour les PDF images nécessitant de l'OCR, utilisez l'endpoint `/verifier-async`. **Principe de vérification (Factur-X 1.08):** - Principe n°2: Le XML ne peut contenir que des infos présentes dans le PDF - Principe n°4: Toute info XML doit être présente et conforme dans le PDF **Champs vérifiés:** - Identification: BT-1 (n° facture), BT-2 (date), BT-3 (type), BT-5 (devise), BT-23 (cadre) - Vendeur: BT-27 (nom), BT-29 (SIRET), BT-30 (SIREN), BT-31 (TVA) - Acheteur: BT-44 (nom), BT-46 (SIRET), BT-47 (SIREN), BT-48 (TVA) - Montants: BT-109 (HT), BT-110 (TVA), BT-112 (TTC), BT-115 (à payer) - Ventilation TVA: BT-116, BT-117, BT-118, BT-119 - Lignes de facture: BT-153, BT-129, BT-146, BT-131 - Notes obligatoires: PMT, PMD, AAB - Règle BR-FR-09: cohérence SIRET/SIREN
|
|
306
|
+
|
|
307
|
+
### Examples
|
|
308
|
+
|
|
309
|
+
```ruby
|
|
310
|
+
require 'time'
|
|
311
|
+
require 'factpulse'
|
|
312
|
+
# setup authorization
|
|
313
|
+
FactPulse.configure do |config|
|
|
314
|
+
# Configure Bearer authorization: HTTPBearer
|
|
315
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
319
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à vérifier
|
|
320
|
+
|
|
321
|
+
begin
|
|
322
|
+
# Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
323
|
+
result = api_instance.verifier_pdf_sync_api_v1_verification_verifier_post(fichier_pdf)
|
|
324
|
+
p result
|
|
325
|
+
rescue FactPulse::ApiError => e
|
|
326
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_sync_api_v1_verification_verifier_post: #{e}"
|
|
327
|
+
end
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### Using the verifier_pdf_sync_api_v1_verification_verifier_post_with_http_info variant
|
|
331
|
+
|
|
332
|
+
This returns an Array which contains the response data, status code and headers.
|
|
333
|
+
|
|
334
|
+
> <Array(<ReponseVerificationSucces>, Integer, Hash)> verifier_pdf_sync_api_v1_verification_verifier_post_with_http_info(fichier_pdf)
|
|
335
|
+
|
|
336
|
+
```ruby
|
|
337
|
+
begin
|
|
338
|
+
# Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
339
|
+
data, status_code, headers = api_instance.verifier_pdf_sync_api_v1_verification_verifier_post_with_http_info(fichier_pdf)
|
|
340
|
+
p status_code # => 2xx
|
|
341
|
+
p headers # => { ... }
|
|
342
|
+
p data # => <ReponseVerificationSucces>
|
|
343
|
+
rescue FactPulse::ApiError => e
|
|
344
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_sync_api_v1_verification_verifier_post_with_http_info: #{e}"
|
|
345
|
+
end
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Parameters
|
|
349
|
+
|
|
350
|
+
| Name | Type | Description | Notes |
|
|
351
|
+
| ---- | ---- | ----------- | ----- |
|
|
352
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à vérifier | |
|
|
353
|
+
|
|
354
|
+
### Return type
|
|
355
|
+
|
|
356
|
+
[**ReponseVerificationSucces**](ReponseVerificationSucces.md)
|
|
357
|
+
|
|
358
|
+
### Authorization
|
|
359
|
+
|
|
360
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
361
|
+
|
|
362
|
+
### HTTP request headers
|
|
363
|
+
|
|
364
|
+
- **Content-Type**: multipart/form-data
|
|
365
|
+
- **Accept**: application/json
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
## verifier_pdf_sync_api_v1_verification_verifier_post_0
|
|
369
|
+
|
|
370
|
+
> <ReponseVerificationSucces> verifier_pdf_sync_api_v1_verification_verifier_post_0(fichier_pdf)
|
|
371
|
+
|
|
372
|
+
Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
373
|
+
|
|
374
|
+
Vérifie la conformité entre le PDF et son XML Factur-X embarqué. **IMPORTANT**: Seuls les PDF Factur-X (avec XML embarqué) sont acceptés. Les PDF sans XML Factur-X seront rejetés avec une erreur 400. Cette version synchrone utilise uniquement l'extraction PDF native (pdfplumber). Pour les PDF images nécessitant de l'OCR, utilisez l'endpoint `/verifier-async`. **Principe de vérification (Factur-X 1.08):** - Principe n°2: Le XML ne peut contenir que des infos présentes dans le PDF - Principe n°4: Toute info XML doit être présente et conforme dans le PDF **Champs vérifiés:** - Identification: BT-1 (n° facture), BT-2 (date), BT-3 (type), BT-5 (devise), BT-23 (cadre) - Vendeur: BT-27 (nom), BT-29 (SIRET), BT-30 (SIREN), BT-31 (TVA) - Acheteur: BT-44 (nom), BT-46 (SIRET), BT-47 (SIREN), BT-48 (TVA) - Montants: BT-109 (HT), BT-110 (TVA), BT-112 (TTC), BT-115 (à payer) - Ventilation TVA: BT-116, BT-117, BT-118, BT-119 - Lignes de facture: BT-153, BT-129, BT-146, BT-131 - Notes obligatoires: PMT, PMD, AAB - Règle BR-FR-09: cohérence SIRET/SIREN
|
|
375
|
+
|
|
376
|
+
### Examples
|
|
377
|
+
|
|
378
|
+
```ruby
|
|
379
|
+
require 'time'
|
|
380
|
+
require 'factpulse'
|
|
381
|
+
# setup authorization
|
|
382
|
+
FactPulse.configure do |config|
|
|
383
|
+
# Configure Bearer authorization: HTTPBearer
|
|
384
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
api_instance = FactPulse::VrificationPDFXMLApi.new
|
|
388
|
+
fichier_pdf = File.new('/path/to/some/file') # File | Fichier PDF Factur-X à vérifier
|
|
389
|
+
|
|
390
|
+
begin
|
|
391
|
+
# Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
392
|
+
result = api_instance.verifier_pdf_sync_api_v1_verification_verifier_post_0(fichier_pdf)
|
|
393
|
+
p result
|
|
394
|
+
rescue FactPulse::ApiError => e
|
|
395
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_sync_api_v1_verification_verifier_post_0: #{e}"
|
|
396
|
+
end
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
#### Using the verifier_pdf_sync_api_v1_verification_verifier_post_0_with_http_info variant
|
|
400
|
+
|
|
401
|
+
This returns an Array which contains the response data, status code and headers.
|
|
402
|
+
|
|
403
|
+
> <Array(<ReponseVerificationSucces>, Integer, Hash)> verifier_pdf_sync_api_v1_verification_verifier_post_0_with_http_info(fichier_pdf)
|
|
404
|
+
|
|
405
|
+
```ruby
|
|
406
|
+
begin
|
|
407
|
+
# Vérifier la conformité PDF/XML Factur-X (synchrone)
|
|
408
|
+
data, status_code, headers = api_instance.verifier_pdf_sync_api_v1_verification_verifier_post_0_with_http_info(fichier_pdf)
|
|
409
|
+
p status_code # => 2xx
|
|
410
|
+
p headers # => { ... }
|
|
411
|
+
p data # => <ReponseVerificationSucces>
|
|
412
|
+
rescue FactPulse::ApiError => e
|
|
413
|
+
puts "Error when calling VrificationPDFXMLApi->verifier_pdf_sync_api_v1_verification_verifier_post_0_with_http_info: #{e}"
|
|
414
|
+
end
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Parameters
|
|
418
|
+
|
|
419
|
+
| Name | Type | Description | Notes |
|
|
420
|
+
| ---- | ---- | ----------- | ----- |
|
|
421
|
+
| **fichier_pdf** | **File** | Fichier PDF Factur-X à vérifier | |
|
|
422
|
+
|
|
423
|
+
### Return type
|
|
424
|
+
|
|
425
|
+
[**ReponseVerificationSucces**](ReponseVerificationSucces.md)
|
|
426
|
+
|
|
427
|
+
### Authorization
|
|
428
|
+
|
|
429
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
430
|
+
|
|
431
|
+
### HTTP request headers
|
|
432
|
+
|
|
433
|
+
- **Content-Type**: multipart/form-data
|
|
434
|
+
- **Accept**: application/json
|
|
435
|
+
|
|
@@ -169,7 +169,7 @@ module FactPulse
|
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
# Obtenir le statut d'une tâche de génération
|
|
172
|
-
# Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles Le champ `statut` utilise l'enum `StatutCelery` avec les valeurs : - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** Voir la documentation du schéma `StatutCelery` pour les détails. ## Résultat métier Quand `statut=\"SUCCESS\"`, le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" (résultat métier) - `chemin_fichier` : Chemin du fichier généré (si succès) - `
|
|
172
|
+
# Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles Le champ `statut` utilise l'enum `StatutCelery` avec les valeurs : - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** Voir la documentation du schéma `StatutCelery` pour les détails. ## Résultat métier Quand `statut=\"SUCCESS\"`, le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" (résultat métier) - `chemin_fichier` : Chemin du fichier généré (si succès) - `errorCode`, `errorMessage`, `details` : Format AFNOR (si échec métier) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que `statut` soit `SUCCESS` ou `FAILURE`.
|
|
173
173
|
# @param id_tache [String]
|
|
174
174
|
# @param [Hash] opts the optional parameters
|
|
175
175
|
# @return [StatutTache]
|
|
@@ -179,7 +179,7 @@ module FactPulse
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
# Obtenir le statut d'une tâche de génération
|
|
182
|
-
# Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles Le champ `statut` utilise l'enum `StatutCelery` avec les valeurs : - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** Voir la documentation du schéma `StatutCelery` pour les détails. ## Résultat métier Quand `statut=\"SUCCESS\"`, le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" (résultat métier) - `chemin_fichier` : Chemin du fichier généré (si succès) - `
|
|
182
|
+
# Récupère l'état d'avancement d'une tâche de génération de facture. ## États possibles Le champ `statut` utilise l'enum `StatutCelery` avec les valeurs : - **PENDING, STARTED, SUCCESS, FAILURE, RETRY** Voir la documentation du schéma `StatutCelery` pour les détails. ## Résultat métier Quand `statut=\"SUCCESS\"`, le champ `resultat` contient : - `statut` : \"SUCCES\" ou \"ERREUR\" (résultat métier) - `chemin_fichier` : Chemin du fichier généré (si succès) - `errorCode`, `errorMessage`, `details` : Format AFNOR (si échec métier) ## Usage Appelez cet endpoint en boucle (polling) toutes les 2-3 secondes jusqu'à ce que `statut` soit `SUCCESS` ou `FAILURE`.
|
|
183
183
|
# @param id_tache [String]
|
|
184
184
|
# @param [Hash] opts the optional parameters
|
|
185
185
|
# @return [Array<(StatutTache, Integer, Hash)>] StatutTache data, response status code and response headers
|
|
@@ -617,7 +617,7 @@ module FactPulse
|
|
|
617
617
|
end
|
|
618
618
|
|
|
619
619
|
# Valider un PDF Factur-X (asynchrone avec polling)
|
|
620
|
-
# Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['
|
|
620
|
+
# Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['errorMessage']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
|
|
621
621
|
# @param fichier_pdf [File] Fichier PDF Factur-X à valider (format .pdf).
|
|
622
622
|
# @param [Hash] opts the optional parameters
|
|
623
623
|
# @option opts [ProfilAPI] :profil
|
|
@@ -629,7 +629,7 @@ module FactPulse
|
|
|
629
629
|
end
|
|
630
630
|
|
|
631
631
|
# Valider un PDF Factur-X (asynchrone avec polling)
|
|
632
|
-
# Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['
|
|
632
|
+
# Valide un PDF Factur-X de manière asynchrone avec système de polling. ## Fonctionnement 1. **Soumission** : Le PDF est mis en file d'attente pour validation asynchrone 2. **Retour immédiat** : Vous recevez un `id_tache` (HTTP 202) 3. **Suivi** : Utilisez l'endpoint `/taches/{id_tache}/statut` pour suivre l'avancement ## Avantages du mode asynchrone - **Pas de timeout** : Idéal pour les gros PDFs ou la validation VeraPDF (qui peut prendre plusieurs secondes) - **Scalabilité** : Les validations sont traitées par des workers Celery dédiés - **Suivi d'état** : Permet de suivre la progression de la validation - **Non-bloquant** : Votre client ne reste pas en attente pendant la validation ## Quand utiliser ce mode ? - **Validation VeraPDF activée** (`use_verapdf=True`) : La validation stricte peut prendre 2-10 secondes - **Gros fichiers PDF** : PDFs > 1 MB - **Traitement par lots** : Validation de multiples factures en parallèle - **Intégration asynchrone** : Votre système supporte le polling ## Contrôles effectués ### 1. Extraction et validation du XML Factur-X - Vérifie la présence d'un fichier XML embarqué conforme Factur-X - Détecte automatiquement le profil utilisé (MINIMUM, BASIC, EN16931, EXTENDED) - Valide le XML contre les règles Schematron du profil détecté ### 2. Conformité PDF/A - **Sans VeraPDF** : Validation basique par métadonnées (rapide, ~100ms) - **Avec VeraPDF** : Validation stricte selon ISO 19005 (146+ règles, 2-10s) - Détecte la version PDF/A (PDF/A-1, PDF/A-3, etc.) - Rapports détaillés des non-conformités ### 3. Métadonnées XMP - Vérifie la présence de métadonnées XMP dans le PDF - Valide la conformité des métadonnées Factur-X (profil, version) - Extrait toutes les métadonnées XMP disponibles ### 4. Signatures électroniques - Détecte la présence de signatures ou cachets électroniques - Extrait les informations sur chaque signature (signataire, date, raison) - Compte le nombre de signatures présentes ## Paramètres - **fichier_pdf** : Le fichier PDF Factur-X à valider - **profil** : Le profil Factur-X attendu (optionnel). Si non spécifié, le profil sera automatiquement détecté depuis le fichier XML embarqué. - **use_verapdf** : Active la validation stricte PDF/A avec VeraPDF. ⚠️ **Attention** : VeraPDF peut prendre 2-10 secondes selon la taille du PDF. Recommandé uniquement en mode asynchrone pour éviter les timeouts. ## Récupération du résultat Après soumission, utilisez l'endpoint `GET /taches/{id_tache}/statut` pour récupérer le résultat. **Exemple de polling** : ```python import requests import time # 1. Soumettre la tâche response = requests.post(\"/valider-facturx-async\", files={\"fichier_pdf\": pdf_file}) task_id = response.json()[\"id_tache\"] # 2. Polling toutes les 2 secondes while True: status_response = requests.get(f\"/taches/{task_id}/statut\") status = status_response.json() if status[\"statut\"] == \"SUCCESS\": resultat = status[\"resultat\"][\"resultat_validation\"] print(f\"Conforme: {resultat['est_conforme']}\") break elif status[\"statut\"] == \"FAILURE\": print(f\"Erreur: {status['resultat']['errorMessage']}\") break time.sleep(2) # Attendre 2 secondes avant le prochain check ``` ## Cas d'usage - Valider des factures avant envoi avec VeraPDF (validation stricte) - Traiter des lots de factures en parallèle - Intégrer la validation dans un pipeline asynchrone - Valider des PDFs volumineux sans risque de timeout
|
|
633
633
|
# @param fichier_pdf [File] Fichier PDF Factur-X à valider (format .pdf).
|
|
634
634
|
# @param [Hash] opts the optional parameters
|
|
635
635
|
# @option opts [ProfilAPI] :profil
|