factpulse 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +28 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +74 -0
  5. data/LICENSE +21 -0
  6. data/README.md +207 -0
  7. data/Rakefile +10 -0
  8. data/docs/AFNORPDPPAApi.md +69 -0
  9. data/docs/AFNORPDPPADirectoryServiceApi.md +1313 -0
  10. data/docs/AFNORPDPPAFlowServiceApi.md +258 -0
  11. data/docs/APIError.md +22 -0
  12. data/docs/AdresseElectronique.md +20 -0
  13. data/docs/AdressePostale.md +26 -0
  14. data/docs/CadreDeFacturation.md +22 -0
  15. data/docs/CategorieTVA.md +15 -0
  16. data/docs/CertificateInfoResponse.md +40 -0
  17. data/docs/ChorusProApi.md +1125 -0
  18. data/docs/ChorusProCredentials.md +26 -0
  19. data/docs/CodeCadreFacturation.md +15 -0
  20. data/docs/CodeRaisonReduction.md +15 -0
  21. data/docs/ConsulterFactureRequest.md +20 -0
  22. data/docs/ConsulterFactureResponse.md +34 -0
  23. data/docs/ConsulterStructureRequest.md +22 -0
  24. data/docs/ConsulterStructureResponse.md +34 -0
  25. data/docs/CredentialsAFNOR.md +22 -0
  26. data/docs/CredentialsChorusPro.md +26 -0
  27. data/docs/Destinataire.md +28 -0
  28. data/docs/Destination.md +79 -0
  29. data/docs/DestinationAFNOR.md +24 -0
  30. data/docs/DestinationChorusPro.md +20 -0
  31. data/docs/DonneesFactureSimplifiees.md +34 -0
  32. data/docs/ErrorLevel.md +15 -0
  33. data/docs/ErrorSource.md +15 -0
  34. data/docs/FactureEnrichieInfo.md +32 -0
  35. data/docs/FactureFacturX.md +46 -0
  36. data/docs/FormatSortie.md +15 -0
  37. data/docs/Fournisseur.md +36 -0
  38. data/docs/GenerateCertificateRequest.md +38 -0
  39. data/docs/GenerateCertificateResponse.md +32 -0
  40. data/docs/HTTPValidationError.md +18 -0
  41. data/docs/InformationSignatureAPI.md +28 -0
  42. data/docs/LigneDePoste.md +46 -0
  43. data/docs/LigneDePosteMontantRemiseHt.md +15 -0
  44. data/docs/LigneDePosteTauxTvaManuel.md +15 -0
  45. data/docs/LigneDeTVA.md +26 -0
  46. data/docs/ModeDepot.md +15 -0
  47. data/docs/ModePaiement.md +15 -0
  48. data/docs/MontantAPayer.md +15 -0
  49. data/docs/MontantBaseHt.md +15 -0
  50. data/docs/MontantHtTotal.md +15 -0
  51. data/docs/MontantRemiseGlobaleTtc.md +15 -0
  52. data/docs/MontantTotal.md +30 -0
  53. data/docs/MontantTotalAcompte.md +15 -0
  54. data/docs/MontantTotalLigneHt.md +15 -0
  55. data/docs/MontantTtcTotal.md +15 -0
  56. data/docs/MontantTva.md +15 -0
  57. data/docs/MontantTvaLigne.md +15 -0
  58. data/docs/MontantTvaTotal.md +15 -0
  59. data/docs/MontantUnitaireHt.md +15 -0
  60. data/docs/Note.md +20 -0
  61. data/docs/ObtenirIdChorusProRequest.md +22 -0
  62. data/docs/ObtenirIdChorusProResponse.md +24 -0
  63. data/docs/OptionsProcessing.md +24 -0
  64. data/docs/PDFFacturXInfo.md +22 -0
  65. data/docs/ParametresSignature.md +34 -0
  66. data/docs/ParametresStructure.md +22 -0
  67. data/docs/PieceJointeComplementaire.md +26 -0
  68. data/docs/ProfilAPI.md +15 -0
  69. data/docs/Quantite.md +15 -0
  70. data/docs/RechercherServicesResponse.md +24 -0
  71. data/docs/RechercherStructureRequest.md +26 -0
  72. data/docs/RechercherStructureResponse.md +24 -0
  73. data/docs/References.md +32 -0
  74. data/docs/ReponseTache.md +18 -0
  75. data/docs/ReponseValidationErreur.md +18 -0
  76. data/docs/ReponseValidationSucces.md +18 -0
  77. data/docs/ResultatAFNOR.md +26 -0
  78. data/docs/ResultatChorusPro.md +22 -0
  79. data/docs/ResultatValidationPDFAPI.md +62 -0
  80. data/docs/SantApi.md +131 -0
  81. data/docs/SchemeID.md +15 -0
  82. data/docs/ServiceStructure.md +24 -0
  83. data/docs/SignatureInfo.md +22 -0
  84. data/docs/SoumettreFactureCompleteRequest.md +26 -0
  85. data/docs/SoumettreFactureCompleteResponse.md +34 -0
  86. data/docs/SoumettreFactureRequest.md +46 -0
  87. data/docs/SoumettreFactureResponse.md +24 -0
  88. data/docs/StatutCelery.md +15 -0
  89. data/docs/StatutFacture.md +22 -0
  90. data/docs/StatutTache.md +22 -0
  91. data/docs/StructureInfo.md +26 -0
  92. data/docs/Tauxmanuel.md +15 -0
  93. data/docs/TraitementFactureApi.md +831 -0
  94. data/docs/TypeFacture.md +15 -0
  95. data/docs/TypeTVA.md +15 -0
  96. data/docs/Unite.md +15 -0
  97. data/docs/UtilisateurApi.md +74 -0
  98. data/docs/ValidationError.md +22 -0
  99. data/docs/ValidationErrorDetail.md +26 -0
  100. data/docs/ValidationErrorLocInner.md +15 -0
  101. data/factpulse.gemspec +39 -0
  102. data/git_push.sh +57 -0
  103. data/lib/factpulse/api/afnorpdppa_api.rb +79 -0
  104. data/lib/factpulse/api/afnorpdppa_directory_service_api.rb +1183 -0
  105. data/lib/factpulse/api/afnorpdppa_flow_service_api.rb +256 -0
  106. data/lib/factpulse/api/chorus_pro_api.rb +1103 -0
  107. data/lib/factpulse/api/sant_api.rb +136 -0
  108. data/lib/factpulse/api/traitement_facture_api.rb +835 -0
  109. data/lib/factpulse/api/utilisateur_api.rb +79 -0
  110. data/lib/factpulse/api_client.rb +397 -0
  111. data/lib/factpulse/api_error.rb +58 -0
  112. data/lib/factpulse/api_model_base.rb +88 -0
  113. data/lib/factpulse/configuration.rb +308 -0
  114. data/lib/factpulse/helpers/client.rb +300 -0
  115. data/lib/factpulse/helpers/exceptions.rb +21 -0
  116. data/lib/factpulse/helpers.rb +13 -0
  117. data/lib/factpulse/models/adresse_electronique.rb +196 -0
  118. data/lib/factpulse/models/adresse_postale.rb +189 -0
  119. data/lib/factpulse/models/api_error.rb +205 -0
  120. data/lib/factpulse/models/cadre_de_facturation.rb +207 -0
  121. data/lib/factpulse/models/categorie_tva.rb +47 -0
  122. data/lib/factpulse/models/certificate_info_response.rb +446 -0
  123. data/lib/factpulse/models/chorus_pro_credentials.rb +259 -0
  124. data/lib/factpulse/models/code_cadre_facturation.rb +42 -0
  125. data/lib/factpulse/models/code_raison_reduction.rb +45 -0
  126. data/lib/factpulse/models/consulter_facture_request.rb +176 -0
  127. data/lib/factpulse/models/consulter_facture_response.rb +261 -0
  128. data/lib/factpulse/models/consulter_structure_request.rb +188 -0
  129. data/lib/factpulse/models/consulter_structure_response.rb +261 -0
  130. data/lib/factpulse/models/credentials_afnor.rb +169 -0
  131. data/lib/factpulse/models/credentials_chorus_pro.rb +191 -0
  132. data/lib/factpulse/models/destinataire.rb +215 -0
  133. data/lib/factpulse/models/destination.rb +56 -0
  134. data/lib/factpulse/models/destination_afnor.rb +228 -0
  135. data/lib/factpulse/models/destination_chorus_pro.rb +194 -0
  136. data/lib/factpulse/models/donnees_facture_simplifiees.rb +342 -0
  137. data/lib/factpulse/models/error_level.rb +40 -0
  138. data/lib/factpulse/models/error_source.rb +46 -0
  139. data/lib/factpulse/models/facture_enrichie_info.rb +348 -0
  140. data/lib/factpulse/models/facture_factur_x.rb +443 -0
  141. data/lib/factpulse/models/format_sortie.rb +40 -0
  142. data/lib/factpulse/models/fournisseur.rb +271 -0
  143. data/lib/factpulse/models/generate_certificate_request.rb +323 -0
  144. data/lib/factpulse/models/generate_certificate_response.rb +254 -0
  145. data/lib/factpulse/models/http_validation_error.rb +149 -0
  146. data/lib/factpulse/models/information_signature_api.rb +216 -0
  147. data/lib/factpulse/models/ligne_de_poste.rb +390 -0
  148. data/lib/factpulse/models/ligne_de_poste_montant_remise_ht.rb +104 -0
  149. data/lib/factpulse/models/ligne_de_poste_taux_tva_manuel.rb +104 -0
  150. data/lib/factpulse/models/ligne_de_tva.rb +242 -0
  151. data/lib/factpulse/models/mode_depot.rb +41 -0
  152. data/lib/factpulse/models/mode_paiement.rb +44 -0
  153. data/lib/factpulse/models/montant_a_payer.rb +104 -0
  154. data/lib/factpulse/models/montant_base_ht.rb +104 -0
  155. data/lib/factpulse/models/montant_ht_total.rb +104 -0
  156. data/lib/factpulse/models/montant_remise_globale_ttc.rb +104 -0
  157. data/lib/factpulse/models/montant_total.rb +272 -0
  158. data/lib/factpulse/models/montant_total_acompte.rb +104 -0
  159. data/lib/factpulse/models/montant_total_ligne_ht.rb +104 -0
  160. data/lib/factpulse/models/montant_ttc_total.rb +104 -0
  161. data/lib/factpulse/models/montant_tva.rb +104 -0
  162. data/lib/factpulse/models/montant_tva_ligne.rb +104 -0
  163. data/lib/factpulse/models/montant_tva_total.rb +104 -0
  164. data/lib/factpulse/models/montant_unitaire_ht.rb +104 -0
  165. data/lib/factpulse/models/note.rb +175 -0
  166. data/lib/factpulse/models/obtenir_id_chorus_pro_request.rb +188 -0
  167. data/lib/factpulse/models/obtenir_id_chorus_pro_response.rb +230 -0
  168. data/lib/factpulse/models/options_processing.rb +207 -0
  169. data/lib/factpulse/models/parametres_signature.rb +235 -0
  170. data/lib/factpulse/models/parametres_structure.rb +175 -0
  171. data/lib/factpulse/models/pdf_factur_x_info.rb +205 -0
  172. data/lib/factpulse/models/piece_jointe_complementaire.rb +269 -0
  173. data/lib/factpulse/models/profil_api.rb +42 -0
  174. data/lib/factpulse/models/quantite.rb +104 -0
  175. data/lib/factpulse/models/rechercher_services_response.rb +214 -0
  176. data/lib/factpulse/models/rechercher_structure_request.rb +191 -0
  177. data/lib/factpulse/models/rechercher_structure_response.rb +216 -0
  178. data/lib/factpulse/models/references.rb +290 -0
  179. data/lib/factpulse/models/reponse_tache.rb +165 -0
  180. data/lib/factpulse/models/reponse_validation_erreur.rb +167 -0
  181. data/lib/factpulse/models/reponse_validation_succes.rb +165 -0
  182. data/lib/factpulse/models/resultat_afnor.rb +240 -0
  183. data/lib/factpulse/models/resultat_chorus_pro.rb +186 -0
  184. data/lib/factpulse/models/resultat_validation_pdfapi.rb +523 -0
  185. data/lib/factpulse/models/scheme_id.rb +43 -0
  186. data/lib/factpulse/models/service_structure.rb +247 -0
  187. data/lib/factpulse/models/signature_info.rb +186 -0
  188. data/lib/factpulse/models/soumettre_facture_complete_request.rb +239 -0
  189. data/lib/factpulse/models/soumettre_facture_complete_response.rb +355 -0
  190. data/lib/factpulse/models/soumettre_facture_request.rb +388 -0
  191. data/lib/factpulse/models/soumettre_facture_response.rb +213 -0
  192. data/lib/factpulse/models/statut_celery.rb +43 -0
  193. data/lib/factpulse/models/statut_facture.rb +203 -0
  194. data/lib/factpulse/models/statut_tache.rb +226 -0
  195. data/lib/factpulse/models/structure_info.rb +274 -0
  196. data/lib/factpulse/models/tauxmanuel.rb +104 -0
  197. data/lib/factpulse/models/type_facture.rb +40 -0
  198. data/lib/factpulse/models/type_tva.rb +42 -0
  199. data/lib/factpulse/models/unite.rb +44 -0
  200. data/lib/factpulse/models/validation_error.rb +218 -0
  201. data/lib/factpulse/models/validation_error_detail.rb +245 -0
  202. data/lib/factpulse/models/validation_error_loc_inner.rb +103 -0
  203. data/lib/factpulse/version.rb +15 -0
  204. data/lib/factpulse.rb +133 -0
  205. metadata +345 -0
@@ -0,0 +1,15 @@
1
+ # FactPulse::TypeFacture
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::TypeFacture.new()
14
+ ```
15
+
data/docs/TypeTVA.md ADDED
@@ -0,0 +1,15 @@
1
+ # FactPulse::TypeTVA
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::TypeTVA.new()
14
+ ```
15
+
data/docs/Unite.md ADDED
@@ -0,0 +1,15 @@
1
+ # FactPulse::Unite
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::Unite.new()
14
+ ```
15
+
@@ -0,0 +1,74 @@
1
+ # FactPulse::UtilisateurApi
2
+
3
+ All URIs are relative to *http://localhost*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**obtenir_infos_utilisateur_api_v1_moi_get**](UtilisateurApi.md#obtenir_infos_utilisateur_api_v1_moi_get) | **GET** /api/v1/moi | Obtenir les informations de l'utilisateur connecté |
8
+
9
+
10
+ ## obtenir_infos_utilisateur_api_v1_moi_get
11
+
12
+ > Object obtenir_infos_utilisateur_api_v1_moi_get
13
+
14
+ Obtenir les informations de l'utilisateur connecté
15
+
16
+ Retourne les informations de l'utilisateur authentifié. Cet endpoint permet de : - Vérifier que l'authentification fonctionne - Obtenir les détails du compte connecté - Tester la validité du token JWT - Consulter son quota de consommation **Nécessite une authentification valide.**
17
+
18
+ ### Examples
19
+
20
+ ```ruby
21
+ require 'time'
22
+ require 'factpulse'
23
+ # setup authorization
24
+ FactPulse.configure do |config|
25
+ # Configure Bearer authorization: HTTPBearer
26
+ config.access_token = 'YOUR_BEARER_TOKEN'
27
+ end
28
+
29
+ api_instance = FactPulse::UtilisateurApi.new
30
+
31
+ begin
32
+ # Obtenir les informations de l'utilisateur connecté
33
+ result = api_instance.obtenir_infos_utilisateur_api_v1_moi_get
34
+ p result
35
+ rescue FactPulse::ApiError => e
36
+ puts "Error when calling UtilisateurApi->obtenir_infos_utilisateur_api_v1_moi_get: #{e}"
37
+ end
38
+ ```
39
+
40
+ #### Using the obtenir_infos_utilisateur_api_v1_moi_get_with_http_info variant
41
+
42
+ This returns an Array which contains the response data, status code and headers.
43
+
44
+ > <Array(Object, Integer, Hash)> obtenir_infos_utilisateur_api_v1_moi_get_with_http_info
45
+
46
+ ```ruby
47
+ begin
48
+ # Obtenir les informations de l'utilisateur connecté
49
+ data, status_code, headers = api_instance.obtenir_infos_utilisateur_api_v1_moi_get_with_http_info
50
+ p status_code # => 2xx
51
+ p headers # => { ... }
52
+ p data # => Object
53
+ rescue FactPulse::ApiError => e
54
+ puts "Error when calling UtilisateurApi->obtenir_infos_utilisateur_api_v1_moi_get_with_http_info: #{e}"
55
+ end
56
+ ```
57
+
58
+ ### Parameters
59
+
60
+ This endpoint does not need any parameter.
61
+
62
+ ### Return type
63
+
64
+ **Object**
65
+
66
+ ### Authorization
67
+
68
+ [HTTPBearer](../README.md#HTTPBearer)
69
+
70
+ ### HTTP request headers
71
+
72
+ - **Content-Type**: Not defined
73
+ - **Accept**: application/json
74
+
@@ -0,0 +1,22 @@
1
+ # FactPulse::ValidationError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **loc** | [**Array&lt;ValidationErrorLocInner&gt;**](ValidationErrorLocInner.md) | | |
8
+ | **msg** | **String** | | |
9
+ | **type** | **String** | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'factpulse'
15
+
16
+ instance = FactPulse::ValidationError.new(
17
+ loc: null,
18
+ msg: null,
19
+ type: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,26 @@
1
+ # FactPulse::ValidationErrorDetail
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **level** | [**ErrorLevel**](ErrorLevel.md) | Niveau de gravité : &#39;Error&#39; ou &#39;Warning&#39; | [optional] |
8
+ | **item** | **String** | Identifiant de l&#39;élément concerné (XPath, champ, règle BR-FR, etc.) | |
9
+ | **reason** | **String** | Description de l&#39;erreur | |
10
+ | **source** | [**ErrorSource**](ErrorSource.md) | | [optional] |
11
+ | **code** | **String** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'factpulse'
17
+
18
+ instance = FactPulse::ValidationErrorDetail.new(
19
+ level: null,
20
+ item: null,
21
+ reason: null,
22
+ source: null,
23
+ code: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,15 @@
1
+ # FactPulse::ValidationErrorLocInner
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::ValidationErrorLocInner.new()
14
+ ```
15
+
data/factpulse.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #API REST FactPulse
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/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+
10
+ Generated by: https://openapi-generator.tech
11
+ Generator version: 7.18.0-SNAPSHOT
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "factpulse/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "factpulse"
20
+ s.version = FactPulse::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["OpenAPI-Generator"]
23
+ s.email = [""]
24
+ s.homepage = "https://openapi-generator.tech"
25
+ s.summary = "API REST FactPulse Ruby Gem"
26
+ s.description = " 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/ "
27
+ s.license = "Unlicense"
28
+ s.required_ruby_version = ">= 2.7"
29
+ s.metadata = {}
30
+
31
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+
35
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
36
+ s.test_files = `find spec/*`.split("\n")
37
+ s.executables = []
38
+ s.require_paths = ["lib"]
39
+ end
data/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="GIT_USER_ID"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="GIT_REPO_ID"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
@@ -0,0 +1,79 @@
1
+ =begin
2
+ #API REST FactPulse
3
+
4
+ # 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/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module FactPulse
16
+ class AFNORPDPPAApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Endpoint OAuth2 pour authentification AFNOR
23
+ # Endpoint proxy OAuth2 pour obtenir un token d'accès AFNOR. Fait proxy vers le mock AFNOR (sandbox) ou la vraie PDP selon MOCK_AFNOR_BASE_URL. Cet endpoint est public (pas d'auth Django requise) car il est appelé par le SDK AFNOR.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Object]
26
+ def oauth_token_proxy_api_v1_afnor_oauth_token_post(opts = {})
27
+ data, _status_code, _headers = oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Endpoint OAuth2 pour authentification AFNOR
32
+ # Endpoint proxy OAuth2 pour obtenir un token d&#39;accès AFNOR. Fait proxy vers le mock AFNOR (sandbox) ou la vraie PDP selon MOCK_AFNOR_BASE_URL. Cet endpoint est public (pas d&#39;auth Django requise) car il est appelé par le SDK AFNOR.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
35
+ def oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: AFNORPDPPAApi.oauth_token_proxy_api_v1_afnor_oauth_token_post ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/api/v1/afnor/oauth/token'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'Object'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"AFNORPDPPAApi.oauth_token_proxy_api_v1_afnor_oauth_token_post",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: AFNORPDPPAApi#oauth_token_proxy_api_v1_afnor_oauth_token_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end