factpulse 2.0.37__py3-none-any.whl → 3.0.7__py3-none-any.whl

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.

Potentially problematic release.


This version of factpulse might be problematic. Click here for more details.

Files changed (262) hide show
  1. factpulse/__init__.py +265 -197
  2. factpulse/api/__init__.py +5 -4
  3. factpulse/api/afnorpdppa_api.py +34 -34
  4. factpulse/api/afnorpdppa_directory_service_api.py +59 -59
  5. factpulse/api/afnorpdppa_flow_service_api.py +23 -23
  6. factpulse/api/chorus_pro_api.py +211 -211
  7. factpulse/api/document_conversion_api.py +1506 -0
  8. factpulse/api/{sant_api.py → health_api.py} +22 -22
  9. factpulse/api/invoice_processing_api.py +3437 -0
  10. factpulse/api/{vrification_pdfxml_api.py → pdfxml_verification_api.py} +240 -240
  11. factpulse/api/{utilisateur_api.py → user_api.py} +17 -17
  12. factpulse/api_client.py +3 -3
  13. factpulse/configuration.py +3 -3
  14. factpulse/exceptions.py +2 -2
  15. factpulse/models/__init__.py +128 -95
  16. factpulse/models/acknowledgment_status.py +38 -0
  17. factpulse/models/additional_document.py +115 -0
  18. factpulse/models/afnor_credentials.py +106 -0
  19. factpulse/models/afnor_destination.py +127 -0
  20. factpulse/models/afnor_health_check_response.py +91 -0
  21. factpulse/models/afnor_result.py +105 -0
  22. factpulse/models/allowance_charge.py +147 -0
  23. factpulse/models/allowance_reason_code.py +42 -0
  24. factpulse/models/allowance_total_amount.py +145 -0
  25. factpulse/models/amount.py +139 -0
  26. factpulse/models/amount_due.py +139 -0
  27. factpulse/models/api_error.py +5 -5
  28. factpulse/models/async_task_status.py +97 -0
  29. factpulse/models/base_amount.py +145 -0
  30. factpulse/models/bounding_box_schema.py +10 -10
  31. factpulse/models/celery_status.py +40 -0
  32. factpulse/models/certificate_info_response.py +24 -24
  33. factpulse/models/charge_total_amount.py +145 -0
  34. factpulse/models/chorus_pro_destination.py +108 -0
  35. factpulse/models/chorus_pro_result.py +101 -0
  36. factpulse/models/contact.py +113 -0
  37. factpulse/models/convert_error_response.py +105 -0
  38. factpulse/models/convert_pending_input_response.py +114 -0
  39. factpulse/models/convert_resume_request.py +87 -0
  40. factpulse/models/convert_success_response.py +126 -0
  41. factpulse/models/convert_validation_failed_response.py +120 -0
  42. factpulse/models/delivery_party.py +121 -0
  43. factpulse/models/destination.py +27 -27
  44. factpulse/models/document_type_info.py +91 -0
  45. factpulse/models/electronic_address.py +90 -0
  46. factpulse/models/enriched_invoice_info.py +133 -0
  47. factpulse/models/error_level.py +2 -2
  48. factpulse/models/error_source.py +2 -2
  49. factpulse/models/extraction_info.py +93 -0
  50. factpulse/models/factur_x_invoice.py +320 -0
  51. factpulse/models/factur_x_profile.py +39 -0
  52. factpulse/models/factur_xpdf_info.py +91 -0
  53. factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.py +95 -0
  54. factpulse/models/facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.py +115 -0
  55. factpulse/models/field_status.py +40 -0
  56. factpulse/models/file_info.py +94 -0
  57. factpulse/models/files_info.py +106 -0
  58. factpulse/models/flow_direction.py +37 -0
  59. factpulse/models/flow_profile.py +38 -0
  60. factpulse/models/flow_summary.py +131 -0
  61. factpulse/models/flow_syntax.py +40 -0
  62. factpulse/models/flow_type.py +40 -0
  63. factpulse/models/generate_certificate_request.py +26 -26
  64. factpulse/models/generate_certificate_response.py +15 -15
  65. factpulse/models/get_chorus_pro_id_request.py +100 -0
  66. factpulse/models/get_chorus_pro_id_response.py +98 -0
  67. factpulse/models/get_invoice_request.py +98 -0
  68. factpulse/models/get_invoice_response.py +142 -0
  69. factpulse/models/get_structure_request.py +100 -0
  70. factpulse/models/get_structure_response.py +142 -0
  71. factpulse/models/global_allowance_amount.py +139 -0
  72. factpulse/models/gross_unit_price.py +145 -0
  73. factpulse/models/http_validation_error.py +2 -2
  74. factpulse/models/incoming_invoice.py +196 -0
  75. factpulse/models/incoming_supplier.py +144 -0
  76. factpulse/models/invoice_format.py +38 -0
  77. factpulse/models/invoice_line.py +354 -0
  78. factpulse/models/invoice_line_allowance_amount.py +145 -0
  79. factpulse/models/invoice_note.py +94 -0
  80. factpulse/models/invoice_references.py +194 -0
  81. factpulse/models/invoice_status.py +96 -0
  82. factpulse/models/invoice_totals.py +177 -0
  83. factpulse/models/invoice_totals_prepayment.py +145 -0
  84. factpulse/models/invoice_type_code.py +51 -0
  85. factpulse/models/invoicing_framework.py +110 -0
  86. factpulse/models/invoicing_framework_code.py +39 -0
  87. factpulse/models/line_net_amount.py +145 -0
  88. factpulse/models/line_total_amount.py +145 -0
  89. factpulse/models/mandatory_note_schema.py +124 -0
  90. factpulse/models/manual_rate.py +139 -0
  91. factpulse/models/manual_vat_rate.py +139 -0
  92. factpulse/models/missing_field.py +107 -0
  93. factpulse/models/operation_nature.py +49 -0
  94. factpulse/models/output_format.py +37 -0
  95. factpulse/models/page_dimensions_schema.py +89 -0
  96. factpulse/models/payee.py +168 -0
  97. factpulse/models/payment_card.py +99 -0
  98. factpulse/models/payment_means.py +41 -0
  99. factpulse/models/pdf_validation_result_api.py +169 -0
  100. factpulse/models/pdp_credentials.py +15 -15
  101. factpulse/models/percentage.py +145 -0
  102. factpulse/models/postal_address.py +134 -0
  103. factpulse/models/price_allowance_amount.py +145 -0
  104. factpulse/models/price_basis_quantity.py +145 -0
  105. factpulse/models/processing_options.py +94 -0
  106. factpulse/models/product_characteristic.py +89 -0
  107. factpulse/models/product_classification.py +101 -0
  108. factpulse/models/quantity.py +139 -0
  109. factpulse/models/recipient.py +167 -0
  110. factpulse/models/rounding_amount.py +145 -0
  111. factpulse/models/scheme_id.py +10 -4
  112. factpulse/models/search_flow_request.py +143 -0
  113. factpulse/models/search_flow_response.py +101 -0
  114. factpulse/models/search_services_response.py +101 -0
  115. factpulse/models/search_structure_request.py +119 -0
  116. factpulse/models/search_structure_response.py +101 -0
  117. factpulse/models/signature_info.py +6 -6
  118. factpulse/models/signature_info_api.py +122 -0
  119. factpulse/models/signature_parameters.py +133 -0
  120. factpulse/models/simplified_invoice_data.py +124 -0
  121. factpulse/models/structure_info.py +14 -14
  122. factpulse/models/structure_parameters.py +91 -0
  123. factpulse/models/structure_service.py +93 -0
  124. factpulse/models/submission_mode.py +38 -0
  125. factpulse/models/submit_complete_invoice_request.py +116 -0
  126. factpulse/models/submit_complete_invoice_response.py +145 -0
  127. factpulse/models/submit_flow_request.py +123 -0
  128. factpulse/models/submit_flow_response.py +109 -0
  129. factpulse/models/submit_gross_amount.py +139 -0
  130. factpulse/models/submit_invoice_request.py +176 -0
  131. factpulse/models/submit_invoice_response.py +103 -0
  132. factpulse/models/submit_net_amount.py +139 -0
  133. factpulse/models/submit_vat_amount.py +139 -0
  134. factpulse/models/supplementary_attachment.py +95 -0
  135. factpulse/models/supplier.py +225 -0
  136. factpulse/models/task_response.py +87 -0
  137. factpulse/models/tax_representative.py +95 -0
  138. factpulse/models/taxable_amount.py +139 -0
  139. factpulse/models/total_gross_amount.py +139 -0
  140. factpulse/models/total_net_amount.py +139 -0
  141. factpulse/models/total_vat_amount.py +139 -0
  142. factpulse/models/unit_net_price.py +139 -0
  143. factpulse/models/unit_of_measure.py +41 -0
  144. factpulse/models/validation_error.py +2 -2
  145. factpulse/models/validation_error_detail.py +6 -6
  146. factpulse/models/validation_error_loc_inner.py +2 -2
  147. factpulse/models/validation_error_response.py +87 -0
  148. factpulse/models/validation_info.py +105 -0
  149. factpulse/models/validation_success_response.py +87 -0
  150. factpulse/models/vat_accounting_code.py +39 -0
  151. factpulse/models/vat_amount.py +139 -0
  152. factpulse/models/vat_category.py +44 -0
  153. factpulse/models/vat_line.py +140 -0
  154. factpulse/models/vat_point_date_code.py +38 -0
  155. factpulse/models/vat_rate.py +145 -0
  156. factpulse/models/verification_success_response.py +135 -0
  157. factpulse/models/verified_field_schema.py +129 -0
  158. factpulse/rest.py +2 -2
  159. factpulse-3.0.7.dist-info/METADATA +292 -0
  160. factpulse-3.0.7.dist-info/RECORD +168 -0
  161. factpulse_helpers/__init__.py +34 -34
  162. factpulse_helpers/client.py +1019 -795
  163. factpulse_helpers/exceptions.py +68 -68
  164. factpulse/api/traitement_facture_api.py +0 -3437
  165. factpulse/models/adresse_electronique.py +0 -90
  166. factpulse/models/adresse_postale.py +0 -120
  167. factpulse/models/cadre_de_facturation.py +0 -110
  168. factpulse/models/categorie_tva.py +0 -44
  169. factpulse/models/champ_verifie_schema.py +0 -129
  170. factpulse/models/chorus_pro_credentials.py +0 -95
  171. factpulse/models/code_cadre_facturation.py +0 -39
  172. factpulse/models/code_raison_reduction.py +0 -42
  173. factpulse/models/consulter_facture_request.py +0 -98
  174. factpulse/models/consulter_facture_response.py +0 -142
  175. factpulse/models/consulter_structure_request.py +0 -100
  176. factpulse/models/consulter_structure_response.py +0 -142
  177. factpulse/models/credentials_afnor.py +0 -106
  178. factpulse/models/credentials_chorus_pro.py +0 -115
  179. factpulse/models/destinataire.py +0 -130
  180. factpulse/models/destination_afnor.py +0 -127
  181. factpulse/models/destination_chorus_pro.py +0 -108
  182. factpulse/models/dimension_page_schema.py +0 -89
  183. factpulse/models/direction_flux.py +0 -37
  184. factpulse/models/donnees_facture_simplifiees.py +0 -124
  185. factpulse/models/facture_enrichie_info.py +0 -133
  186. factpulse/models/facture_entrante.py +0 -196
  187. factpulse/models/facture_factur_x.py +0 -183
  188. factpulse/models/flux_resume.py +0 -131
  189. factpulse/models/format_facture.py +0 -38
  190. factpulse/models/format_sortie.py +0 -37
  191. factpulse/models/fournisseur.py +0 -153
  192. factpulse/models/fournisseur_entrant.py +0 -144
  193. factpulse/models/information_signature_api.py +0 -122
  194. factpulse/models/ligne_de_poste.py +0 -183
  195. factpulse/models/ligne_de_poste_montant_remise_ht.py +0 -145
  196. factpulse/models/ligne_de_poste_taux_tva_manuel.py +0 -145
  197. factpulse/models/ligne_de_tva.py +0 -132
  198. factpulse/models/mode_depot.py +0 -38
  199. factpulse/models/mode_paiement.py +0 -41
  200. factpulse/models/montant_a_payer.py +0 -139
  201. factpulse/models/montant_base_ht.py +0 -139
  202. factpulse/models/montant_ht_total.py +0 -139
  203. factpulse/models/montant_remise_globale_ttc.py +0 -139
  204. factpulse/models/montant_total.py +0 -133
  205. factpulse/models/montant_total_acompte.py +0 -145
  206. factpulse/models/montant_total_ligne_ht.py +0 -139
  207. factpulse/models/montant_ttc_total.py +0 -139
  208. factpulse/models/montant_tva.py +0 -139
  209. factpulse/models/montant_tva_ligne.py +0 -139
  210. factpulse/models/montant_tva_total.py +0 -139
  211. factpulse/models/montant_unitaire_ht.py +0 -139
  212. factpulse/models/nature_operation.py +0 -49
  213. factpulse/models/note.py +0 -94
  214. factpulse/models/note_obligatoire_schema.py +0 -124
  215. factpulse/models/obtenir_id_chorus_pro_request.py +0 -100
  216. factpulse/models/obtenir_id_chorus_pro_response.py +0 -98
  217. factpulse/models/options_processing.py +0 -94
  218. factpulse/models/parametres_signature.py +0 -133
  219. factpulse/models/parametres_structure.py +0 -91
  220. factpulse/models/pdf_factur_x_info.py +0 -91
  221. factpulse/models/piece_jointe_complementaire.py +0 -95
  222. factpulse/models/profil_api.py +0 -39
  223. factpulse/models/profil_flux.py +0 -38
  224. factpulse/models/quantite.py +0 -139
  225. factpulse/models/rechercher_services_response.py +0 -101
  226. factpulse/models/rechercher_structure_request.py +0 -119
  227. factpulse/models/rechercher_structure_response.py +0 -101
  228. factpulse/models/references.py +0 -124
  229. factpulse/models/reponse_healthcheck_afnor.py +0 -91
  230. factpulse/models/reponse_recherche_flux.py +0 -101
  231. factpulse/models/reponse_soumission_flux.py +0 -109
  232. factpulse/models/reponse_tache.py +0 -87
  233. factpulse/models/reponse_validation_erreur.py +0 -87
  234. factpulse/models/reponse_validation_succes.py +0 -87
  235. factpulse/models/reponse_verification_succes.py +0 -135
  236. factpulse/models/requete_recherche_flux.py +0 -143
  237. factpulse/models/requete_soumission_flux.py +0 -123
  238. factpulse/models/resultat_afnor.py +0 -105
  239. factpulse/models/resultat_chorus_pro.py +0 -101
  240. factpulse/models/resultat_validation_pdfapi.py +0 -169
  241. factpulse/models/service_structure.py +0 -93
  242. factpulse/models/soumettre_facture_complete_request.py +0 -116
  243. factpulse/models/soumettre_facture_complete_response.py +0 -145
  244. factpulse/models/soumettre_facture_request.py +0 -176
  245. factpulse/models/soumettre_facture_response.py +0 -103
  246. factpulse/models/statut_acquittement.py +0 -38
  247. factpulse/models/statut_celery.py +0 -40
  248. factpulse/models/statut_champ_api.py +0 -40
  249. factpulse/models/statut_facture.py +0 -96
  250. factpulse/models/statut_tache.py +0 -97
  251. factpulse/models/syntaxe_flux.py +0 -40
  252. factpulse/models/tauxmanuel.py +0 -139
  253. factpulse/models/type_document.py +0 -40
  254. factpulse/models/type_facture.py +0 -37
  255. factpulse/models/type_flux.py +0 -40
  256. factpulse/models/type_tva.py +0 -39
  257. factpulse/models/unite.py +0 -41
  258. factpulse-2.0.37.dist-info/METADATA +0 -292
  259. factpulse-2.0.37.dist-info/RECORD +0 -134
  260. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/WHEEL +0 -0
  261. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/licenses/LICENSE +0 -0
  262. {factpulse-2.0.37.dist-info → factpulse-3.0.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,167 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FactPulse REST API
5
+
6
+ REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from factpulse.models.contact import Contact
23
+ from factpulse.models.electronic_address import ElectronicAddress
24
+ from factpulse.models.postal_address import PostalAddress
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class Recipient(BaseModel):
29
+ """
30
+ Information about the invoice recipient / buyer (BG-7).
31
+ """ # noqa: E501
32
+ electronic_address: Optional[ElectronicAddress]
33
+ executing_service_code: Optional[StrictStr] = None
34
+ name: Optional[StrictStr] = None
35
+ siren: Optional[StrictStr] = None
36
+ siret: Optional[StrictStr] = None
37
+ vat_number: Optional[StrictStr] = None
38
+ postal_address: Optional[PostalAddress] = None
39
+ contact: Optional[Contact] = None
40
+ global_ids: Optional[List[ElectronicAddress]] = None
41
+ __properties: ClassVar[List[str]] = ["electronic_address", "executing_service_code", "name", "siren", "siret", "vat_number", "postal_address", "contact", "global_ids"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of Recipient from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of electronic_address
83
+ if self.electronic_address:
84
+ _dict['electronic_address'] = self.electronic_address.to_dict()
85
+ # override the default output from pydantic by calling `to_dict()` of postal_address
86
+ if self.postal_address:
87
+ _dict['postal_address'] = self.postal_address.to_dict()
88
+ # override the default output from pydantic by calling `to_dict()` of contact
89
+ if self.contact:
90
+ _dict['contact'] = self.contact.to_dict()
91
+ # override the default output from pydantic by calling `to_dict()` of each item in global_ids (list)
92
+ _items = []
93
+ if self.global_ids:
94
+ for _item_global_ids in self.global_ids:
95
+ if _item_global_ids:
96
+ _items.append(_item_global_ids.to_dict())
97
+ _dict['global_ids'] = _items
98
+ # set to None if electronic_address (nullable) is None
99
+ # and model_fields_set contains the field
100
+ if self.electronic_address is None and "electronic_address" in self.model_fields_set:
101
+ _dict['electronic_address'] = None
102
+
103
+ # set to None if executing_service_code (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.executing_service_code is None and "executing_service_code" in self.model_fields_set:
106
+ _dict['executing_service_code'] = None
107
+
108
+ # set to None if name (nullable) is None
109
+ # and model_fields_set contains the field
110
+ if self.name is None and "name" in self.model_fields_set:
111
+ _dict['name'] = None
112
+
113
+ # set to None if siren (nullable) is None
114
+ # and model_fields_set contains the field
115
+ if self.siren is None and "siren" in self.model_fields_set:
116
+ _dict['siren'] = None
117
+
118
+ # set to None if siret (nullable) is None
119
+ # and model_fields_set contains the field
120
+ if self.siret is None and "siret" in self.model_fields_set:
121
+ _dict['siret'] = None
122
+
123
+ # set to None if vat_number (nullable) is None
124
+ # and model_fields_set contains the field
125
+ if self.vat_number is None and "vat_number" in self.model_fields_set:
126
+ _dict['vat_number'] = None
127
+
128
+ # set to None if postal_address (nullable) is None
129
+ # and model_fields_set contains the field
130
+ if self.postal_address is None and "postal_address" in self.model_fields_set:
131
+ _dict['postal_address'] = None
132
+
133
+ # set to None if contact (nullable) is None
134
+ # and model_fields_set contains the field
135
+ if self.contact is None and "contact" in self.model_fields_set:
136
+ _dict['contact'] = None
137
+
138
+ # set to None if global_ids (nullable) is None
139
+ # and model_fields_set contains the field
140
+ if self.global_ids is None and "global_ids" in self.model_fields_set:
141
+ _dict['global_ids'] = None
142
+
143
+ return _dict
144
+
145
+ @classmethod
146
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
147
+ """Create an instance of Recipient from a dict"""
148
+ if obj is None:
149
+ return None
150
+
151
+ if not isinstance(obj, dict):
152
+ return cls.model_validate(obj)
153
+
154
+ _obj = cls.model_validate({
155
+ "electronic_address": ElectronicAddress.from_dict(obj["electronic_address"]) if obj.get("electronic_address") is not None else None,
156
+ "executing_service_code": obj.get("executing_service_code"),
157
+ "name": obj.get("name"),
158
+ "siren": obj.get("siren"),
159
+ "siret": obj.get("siret"),
160
+ "vat_number": obj.get("vat_number"),
161
+ "postal_address": PostalAddress.from_dict(obj["postal_address"]) if obj.get("postal_address") is not None else None,
162
+ "contact": Contact.from_dict(obj["contact"]) if obj.get("contact") is not None else None,
163
+ "global_ids": [ElectronicAddress.from_dict(_item) for _item in obj["global_ids"]] if obj.get("global_ids") is not None else None
164
+ })
165
+ return _obj
166
+
167
+
@@ -0,0 +1,145 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FactPulse REST API
5
+
6
+ REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ from inspect import getfullargspec
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
21
+ from typing import Optional, Union
22
+ from typing_extensions import Annotated
23
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
24
+ from typing_extensions import Literal, Self
25
+ from pydantic import Field
26
+
27
+ ROUNDINGAMOUNT_ANY_OF_SCHEMAS = ["float", "str"]
28
+
29
+ class RoundingAmount(BaseModel):
30
+ """
31
+ Rounding amount added to total (BT-114).
32
+ """
33
+
34
+ # data type: float
35
+ anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
36
+ # data type: str
37
+ anyof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
38
+ if TYPE_CHECKING:
39
+ actual_instance: Optional[Union[float, str]] = None
40
+ else:
41
+ actual_instance: Any = None
42
+ any_of_schemas: Set[str] = { "float", "str" }
43
+
44
+ model_config = {
45
+ "validate_assignment": True,
46
+ "protected_namespaces": (),
47
+ }
48
+
49
+ def __init__(self, *args, **kwargs) -> None:
50
+ if args:
51
+ if len(args) > 1:
52
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
53
+ if kwargs:
54
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
55
+ super().__init__(actual_instance=args[0])
56
+ else:
57
+ super().__init__(**kwargs)
58
+
59
+ @field_validator('actual_instance')
60
+ def actual_instance_must_validate_anyof(cls, v):
61
+ if v is None:
62
+ return v
63
+
64
+ instance = RoundingAmount.model_construct()
65
+ error_messages = []
66
+ # validate data type: float
67
+ try:
68
+ instance.anyof_schema_1_validator = v
69
+ return v
70
+ except (ValidationError, ValueError) as e:
71
+ error_messages.append(str(e))
72
+ # validate data type: str
73
+ try:
74
+ instance.anyof_schema_2_validator = v
75
+ return v
76
+ except (ValidationError, ValueError) as e:
77
+ error_messages.append(str(e))
78
+ if error_messages:
79
+ # no match
80
+ raise ValueError("No match found when setting the actual_instance in RoundingAmount with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
81
+ else:
82
+ return v
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
86
+ return cls.from_json(json.dumps(obj))
87
+
88
+ @classmethod
89
+ def from_json(cls, json_str: str) -> Self:
90
+ """Returns the object represented by the json string"""
91
+ instance = cls.model_construct()
92
+ if json_str is None:
93
+ return instance
94
+
95
+ error_messages = []
96
+ # deserialize data into float
97
+ try:
98
+ # validation
99
+ instance.anyof_schema_1_validator = json.loads(json_str)
100
+ # assign value to actual_instance
101
+ instance.actual_instance = instance.anyof_schema_1_validator
102
+ return instance
103
+ except (ValidationError, ValueError) as e:
104
+ error_messages.append(str(e))
105
+ # deserialize data into str
106
+ try:
107
+ # validation
108
+ instance.anyof_schema_2_validator = json.loads(json_str)
109
+ # assign value to actual_instance
110
+ instance.actual_instance = instance.anyof_schema_2_validator
111
+ return instance
112
+ except (ValidationError, ValueError) as e:
113
+ error_messages.append(str(e))
114
+
115
+ if error_messages:
116
+ # no match
117
+ raise ValueError("No match found when deserializing the JSON string into RoundingAmount with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
118
+ else:
119
+ return instance
120
+
121
+ def to_json(self) -> str:
122
+ """Returns the JSON representation of the actual instance"""
123
+ if self.actual_instance is None:
124
+ return "null"
125
+
126
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
127
+ return self.actual_instance.to_json()
128
+ else:
129
+ return json.dumps(self.actual_instance)
130
+
131
+ def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
132
+ """Returns the dict representation of the actual instance"""
133
+ if self.actual_instance is None:
134
+ return None
135
+
136
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
137
+ return self.actual_instance.to_dict()
138
+ else:
139
+ return self.actual_instance
140
+
141
+ def to_str(self) -> str:
142
+ """Returns the string representation of the actual instance"""
143
+ return pprint.pformat(self.model_dump())
144
+
145
+
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- API REST FactPulse
4
+ FactPulse REST API
5
5
 
6
- API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Paramètre optionnel `client_uid` :** Pour sélectionner les credentials d'un client spécifique (PA/PDP, Chorus Pro, certificats de signature), ajoutez `client_uid` : ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` Le `client_uid` sera inclus dans le JWT et permettra à l'API d'utiliser automatiquement : - Les credentials AFNOR/PDP configurés pour ce client - Les credentials Chorus Pro configurés pour ce client - Les certificats de signature électronique configurés pour ce client **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
6
+ REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
7
7
 
8
8
  The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -20,17 +20,23 @@ from typing_extensions import Self
20
20
 
21
21
  class SchemeID(str, Enum):
22
22
  """
23
- Codes de schémas d'identification (Electronic Address Scheme - EAS), principalement pour l'adressage des factures électroniques. **Valeurs possibles :** - `0225` : FR_SIREN - SIREN français (le plus commun pour la France, remplace l'ancien 0002) - `0088` : GLN - Global Location Number - `0060` : DUNS - Data Universal Numbering System - `9957` : FR_TVA_INTRA - Numéro de TVA intracommunautaire français - `0199` : GLEIF - Global Legal Entity Identifier Foundation
23
+ Identification scheme codes (Electronic Address Scheme - EAS), mainly for electronic invoice addressing. **Possible values:** - `0225`: FR_SIREN - French SIREN (most common for France) - `0009`: FR_SIRET - French SIRET - `0002`: FR_SIREN_OLD - French SIREN (old code, for legal organization ID) - `0088`: GLN - Global Location Number - `0060`: DUNS - Data Universal Numbering System - `9957`: FR_VAT_INTRA - French intra-community VAT number - `0199`: GLEIF - Global Legal Entity Identifier Foundation - `0231`: DT_DIRECTORY_ID - Directory ID for tax administration - `EM`: EMAIL - Email-based electronic address (BT-34/BT-49)
24
24
  """
25
25
 
26
26
  """
27
27
  allowed enum values
28
28
  """
29
29
  FR_SIREN = '0225'
30
+ FR_SIRET = '0009'
31
+ FR_SIREN_OLD = '0002'
30
32
  GLN = '0088'
31
33
  DUNS = '0060'
32
- FR_TVA_INTRA = '9957'
34
+ FR_VAT_INTRA = '9957'
33
35
  GLEIF = '0199'
36
+ DT_DIRECTORY_ID = '0231'
37
+ EMAIL = 'EM'
38
+ ODETTE = '0177'
39
+ FR_CHORUS_PRO_ROUTING = '0224'
34
40
 
35
41
  @classmethod
36
42
  def from_json(cls, json_str: str) -> Self:
@@ -0,0 +1,143 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FactPulse REST API
5
+
6
+ REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://www.factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://www.factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://www.factpulse.fr/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://www.factpulse.fr/documentation-api/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from factpulse.models.acknowledgment_status import AcknowledgmentStatus
25
+ from factpulse.models.flow_direction import FlowDirection
26
+ from factpulse.models.flow_type import FlowType
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class SearchFlowRequest(BaseModel):
31
+ """
32
+ Request to search submitted flows.
33
+ """ # noqa: E501
34
+ updated_after: Optional[datetime] = Field(default=None, alias="updatedAfter")
35
+ updated_before: Optional[datetime] = Field(default=None, alias="updatedBefore")
36
+ flow_types: Optional[List[FlowType]] = Field(default=None, alias="flowTypes")
37
+ flow_directions: Optional[List[FlowDirection]] = Field(default=None, alias="flowDirections")
38
+ tracking_id: Optional[StrictStr] = Field(default=None, alias="trackingId")
39
+ flow_id: Optional[StrictStr] = Field(default=None, alias="flowId")
40
+ acknowledgment_status: Optional[AcknowledgmentStatus] = Field(default=None, alias="acknowledgmentStatus")
41
+ offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Offset for pagination")
42
+ limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = Field(default=25, description="Maximum number of results (max 100)")
43
+ __properties: ClassVar[List[str]] = ["updatedAfter", "updatedBefore", "flowTypes", "flowDirections", "trackingId", "flowId", "acknowledgmentStatus", "offset", "limit"]
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of SearchFlowRequest from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ # set to None if updated_after (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.updated_after is None and "updated_after" in self.model_fields_set:
87
+ _dict['updatedAfter'] = None
88
+
89
+ # set to None if updated_before (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.updated_before is None and "updated_before" in self.model_fields_set:
92
+ _dict['updatedBefore'] = None
93
+
94
+ # set to None if flow_types (nullable) is None
95
+ # and model_fields_set contains the field
96
+ if self.flow_types is None and "flow_types" in self.model_fields_set:
97
+ _dict['flowTypes'] = None
98
+
99
+ # set to None if flow_directions (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.flow_directions is None and "flow_directions" in self.model_fields_set:
102
+ _dict['flowDirections'] = None
103
+
104
+ # set to None if tracking_id (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.tracking_id is None and "tracking_id" in self.model_fields_set:
107
+ _dict['trackingId'] = None
108
+
109
+ # set to None if flow_id (nullable) is None
110
+ # and model_fields_set contains the field
111
+ if self.flow_id is None and "flow_id" in self.model_fields_set:
112
+ _dict['flowId'] = None
113
+
114
+ # set to None if acknowledgment_status (nullable) is None
115
+ # and model_fields_set contains the field
116
+ if self.acknowledgment_status is None and "acknowledgment_status" in self.model_fields_set:
117
+ _dict['acknowledgmentStatus'] = None
118
+
119
+ return _dict
120
+
121
+ @classmethod
122
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
123
+ """Create an instance of SearchFlowRequest from a dict"""
124
+ if obj is None:
125
+ return None
126
+
127
+ if not isinstance(obj, dict):
128
+ return cls.model_validate(obj)
129
+
130
+ _obj = cls.model_validate({
131
+ "updatedAfter": obj.get("updatedAfter"),
132
+ "updatedBefore": obj.get("updatedBefore"),
133
+ "flowTypes": obj.get("flowTypes"),
134
+ "flowDirections": obj.get("flowDirections"),
135
+ "trackingId": obj.get("trackingId"),
136
+ "flowId": obj.get("flowId"),
137
+ "acknowledgmentStatus": obj.get("acknowledgmentStatus"),
138
+ "offset": obj.get("offset") if obj.get("offset") is not None else 0,
139
+ "limit": obj.get("limit") if obj.get("limit") is not None else 25
140
+ })
141
+ return _obj
142
+
143
+