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,443 @@
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 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Modèle de données pour une facture destinée à être convertie en Factur-X.
18
+ class FactureFacturX < ApiModelBase
19
+ attr_accessor :numero_facture
20
+
21
+ attr_accessor :date_echeance_paiement
22
+
23
+ attr_accessor :date_facture
24
+
25
+ attr_accessor :mode_depot
26
+
27
+ attr_accessor :destinataire
28
+
29
+ attr_accessor :fournisseur
30
+
31
+ attr_accessor :cadre_de_facturation
32
+
33
+ attr_accessor :references
34
+
35
+ attr_accessor :montant_total
36
+
37
+ attr_accessor :lignes_de_poste
38
+
39
+ attr_accessor :lignes_de_tva
40
+
41
+ attr_accessor :notes
42
+
43
+ attr_accessor :commentaire
44
+
45
+ attr_accessor :id_utilisateur_courant
46
+
47
+ attr_accessor :pieces_jointes_complementaires
48
+
49
+ class EnumAttributeValidator
50
+ attr_reader :datatype
51
+ attr_reader :allowable_values
52
+
53
+ def initialize(datatype, allowable_values)
54
+ @allowable_values = allowable_values.map do |value|
55
+ case datatype.to_s
56
+ when /Integer/i
57
+ value.to_i
58
+ when /Float/i
59
+ value.to_f
60
+ else
61
+ value
62
+ end
63
+ end
64
+ end
65
+
66
+ def valid?(value)
67
+ !value || allowable_values.include?(value)
68
+ end
69
+ end
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'numero_facture' => :'numeroFacture',
75
+ :'date_echeance_paiement' => :'dateEcheancePaiement',
76
+ :'date_facture' => :'dateFacture',
77
+ :'mode_depot' => :'modeDepot',
78
+ :'destinataire' => :'destinataire',
79
+ :'fournisseur' => :'fournisseur',
80
+ :'cadre_de_facturation' => :'cadreDeFacturation',
81
+ :'references' => :'references',
82
+ :'montant_total' => :'montantTotal',
83
+ :'lignes_de_poste' => :'lignesDePoste',
84
+ :'lignes_de_tva' => :'lignesDeTva',
85
+ :'notes' => :'notes',
86
+ :'commentaire' => :'commentaire',
87
+ :'id_utilisateur_courant' => :'idUtilisateurCourant',
88
+ :'pieces_jointes_complementaires' => :'piecesJointesComplementaires'
89
+ }
90
+ end
91
+
92
+ # Returns attribute mapping this model knows about
93
+ def self.acceptable_attribute_map
94
+ attribute_map
95
+ end
96
+
97
+ # Returns all the JSON keys this model knows about
98
+ def self.acceptable_attributes
99
+ acceptable_attribute_map.values
100
+ end
101
+
102
+ # Attribute type mapping.
103
+ def self.openapi_types
104
+ {
105
+ :'numero_facture' => :'String',
106
+ :'date_echeance_paiement' => :'String',
107
+ :'date_facture' => :'String',
108
+ :'mode_depot' => :'ModeDepot',
109
+ :'destinataire' => :'Destinataire',
110
+ :'fournisseur' => :'Fournisseur',
111
+ :'cadre_de_facturation' => :'CadreDeFacturation',
112
+ :'references' => :'References',
113
+ :'montant_total' => :'MontantTotal',
114
+ :'lignes_de_poste' => :'Array<LigneDePoste>',
115
+ :'lignes_de_tva' => :'Array<LigneDeTVA>',
116
+ :'notes' => :'Array<Note>',
117
+ :'commentaire' => :'String',
118
+ :'id_utilisateur_courant' => :'Integer',
119
+ :'pieces_jointes_complementaires' => :'Array<PieceJointeComplementaire>'
120
+ }
121
+ end
122
+
123
+ # List of attributes with nullable: true
124
+ def self.openapi_nullable
125
+ Set.new([
126
+ :'commentaire',
127
+ :'id_utilisateur_courant',
128
+ :'pieces_jointes_complementaires'
129
+ ])
130
+ end
131
+
132
+ # Initializes the object
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ def initialize(attributes = {})
135
+ if (!attributes.is_a?(Hash))
136
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::FactureFacturX` initialize method"
137
+ end
138
+
139
+ # check to see if the attribute exists and convert string to symbol for hash key
140
+ acceptable_attribute_map = self.class.acceptable_attribute_map
141
+ attributes = attributes.each_with_object({}) { |(k, v), h|
142
+ if (!acceptable_attribute_map.key?(k.to_sym))
143
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::FactureFacturX`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
144
+ end
145
+ h[k.to_sym] = v
146
+ }
147
+
148
+ if attributes.key?(:'numero_facture')
149
+ self.numero_facture = attributes[:'numero_facture']
150
+ else
151
+ self.numero_facture = nil
152
+ end
153
+
154
+ if attributes.key?(:'date_echeance_paiement')
155
+ self.date_echeance_paiement = attributes[:'date_echeance_paiement']
156
+ else
157
+ self.date_echeance_paiement = nil
158
+ end
159
+
160
+ if attributes.key?(:'date_facture')
161
+ self.date_facture = attributes[:'date_facture']
162
+ end
163
+
164
+ if attributes.key?(:'mode_depot')
165
+ self.mode_depot = attributes[:'mode_depot']
166
+ else
167
+ self.mode_depot = nil
168
+ end
169
+
170
+ if attributes.key?(:'destinataire')
171
+ self.destinataire = attributes[:'destinataire']
172
+ else
173
+ self.destinataire = nil
174
+ end
175
+
176
+ if attributes.key?(:'fournisseur')
177
+ self.fournisseur = attributes[:'fournisseur']
178
+ else
179
+ self.fournisseur = nil
180
+ end
181
+
182
+ if attributes.key?(:'cadre_de_facturation')
183
+ self.cadre_de_facturation = attributes[:'cadre_de_facturation']
184
+ else
185
+ self.cadre_de_facturation = nil
186
+ end
187
+
188
+ if attributes.key?(:'references')
189
+ self.references = attributes[:'references']
190
+ else
191
+ self.references = nil
192
+ end
193
+
194
+ if attributes.key?(:'montant_total')
195
+ self.montant_total = attributes[:'montant_total']
196
+ else
197
+ self.montant_total = nil
198
+ end
199
+
200
+ if attributes.key?(:'lignes_de_poste')
201
+ if (value = attributes[:'lignes_de_poste']).is_a?(Array)
202
+ self.lignes_de_poste = value
203
+ end
204
+ end
205
+
206
+ if attributes.key?(:'lignes_de_tva')
207
+ if (value = attributes[:'lignes_de_tva']).is_a?(Array)
208
+ self.lignes_de_tva = value
209
+ end
210
+ end
211
+
212
+ if attributes.key?(:'notes')
213
+ if (value = attributes[:'notes']).is_a?(Array)
214
+ self.notes = value
215
+ end
216
+ end
217
+
218
+ if attributes.key?(:'commentaire')
219
+ self.commentaire = attributes[:'commentaire']
220
+ end
221
+
222
+ if attributes.key?(:'id_utilisateur_courant')
223
+ self.id_utilisateur_courant = attributes[:'id_utilisateur_courant']
224
+ end
225
+
226
+ if attributes.key?(:'pieces_jointes_complementaires')
227
+ if (value = attributes[:'pieces_jointes_complementaires']).is_a?(Array)
228
+ self.pieces_jointes_complementaires = value
229
+ end
230
+ end
231
+ end
232
+
233
+ # Show invalid properties with the reasons. Usually used together with valid?
234
+ # @return Array for valid properties with the reasons
235
+ def list_invalid_properties
236
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
237
+ invalid_properties = Array.new
238
+ if @numero_facture.nil?
239
+ invalid_properties.push('invalid value for "numero_facture", numero_facture cannot be nil.')
240
+ end
241
+
242
+ if @date_echeance_paiement.nil?
243
+ invalid_properties.push('invalid value for "date_echeance_paiement", date_echeance_paiement cannot be nil.')
244
+ end
245
+
246
+ if @mode_depot.nil?
247
+ invalid_properties.push('invalid value for "mode_depot", mode_depot cannot be nil.')
248
+ end
249
+
250
+ if @destinataire.nil?
251
+ invalid_properties.push('invalid value for "destinataire", destinataire cannot be nil.')
252
+ end
253
+
254
+ if @fournisseur.nil?
255
+ invalid_properties.push('invalid value for "fournisseur", fournisseur cannot be nil.')
256
+ end
257
+
258
+ if @cadre_de_facturation.nil?
259
+ invalid_properties.push('invalid value for "cadre_de_facturation", cadre_de_facturation cannot be nil.')
260
+ end
261
+
262
+ if @references.nil?
263
+ invalid_properties.push('invalid value for "references", references cannot be nil.')
264
+ end
265
+
266
+ if @montant_total.nil?
267
+ invalid_properties.push('invalid value for "montant_total", montant_total cannot be nil.')
268
+ end
269
+
270
+ invalid_properties
271
+ end
272
+
273
+ # Check to see if the all the properties in the model are valid
274
+ # @return true if the model is valid
275
+ def valid?
276
+ warn '[DEPRECATED] the `valid?` method is obsolete'
277
+ return false if @numero_facture.nil?
278
+ return false if @date_echeance_paiement.nil?
279
+ return false if @mode_depot.nil?
280
+ return false if @destinataire.nil?
281
+ return false if @fournisseur.nil?
282
+ return false if @cadre_de_facturation.nil?
283
+ return false if @references.nil?
284
+ return false if @montant_total.nil?
285
+ true
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] numero_facture Value to be assigned
290
+ def numero_facture=(numero_facture)
291
+ if numero_facture.nil?
292
+ fail ArgumentError, 'numero_facture cannot be nil'
293
+ end
294
+
295
+ @numero_facture = numero_facture
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] date_echeance_paiement Value to be assigned
300
+ def date_echeance_paiement=(date_echeance_paiement)
301
+ if date_echeance_paiement.nil?
302
+ fail ArgumentError, 'date_echeance_paiement cannot be nil'
303
+ end
304
+
305
+ @date_echeance_paiement = date_echeance_paiement
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] mode_depot Value to be assigned
310
+ def mode_depot=(mode_depot)
311
+ if mode_depot.nil?
312
+ fail ArgumentError, 'mode_depot cannot be nil'
313
+ end
314
+
315
+ @mode_depot = mode_depot
316
+ end
317
+
318
+ # Custom attribute writer method with validation
319
+ # @param [Object] destinataire Value to be assigned
320
+ def destinataire=(destinataire)
321
+ if destinataire.nil?
322
+ fail ArgumentError, 'destinataire cannot be nil'
323
+ end
324
+
325
+ @destinataire = destinataire
326
+ end
327
+
328
+ # Custom attribute writer method with validation
329
+ # @param [Object] fournisseur Value to be assigned
330
+ def fournisseur=(fournisseur)
331
+ if fournisseur.nil?
332
+ fail ArgumentError, 'fournisseur cannot be nil'
333
+ end
334
+
335
+ @fournisseur = fournisseur
336
+ end
337
+
338
+ # Custom attribute writer method with validation
339
+ # @param [Object] cadre_de_facturation Value to be assigned
340
+ def cadre_de_facturation=(cadre_de_facturation)
341
+ if cadre_de_facturation.nil?
342
+ fail ArgumentError, 'cadre_de_facturation cannot be nil'
343
+ end
344
+
345
+ @cadre_de_facturation = cadre_de_facturation
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] references Value to be assigned
350
+ def references=(references)
351
+ if references.nil?
352
+ fail ArgumentError, 'references cannot be nil'
353
+ end
354
+
355
+ @references = references
356
+ end
357
+
358
+ # Custom attribute writer method with validation
359
+ # @param [Object] montant_total Value to be assigned
360
+ def montant_total=(montant_total)
361
+ if montant_total.nil?
362
+ fail ArgumentError, 'montant_total cannot be nil'
363
+ end
364
+
365
+ @montant_total = montant_total
366
+ end
367
+
368
+ # Checks equality by comparing each attribute.
369
+ # @param [Object] Object to be compared
370
+ def ==(o)
371
+ return true if self.equal?(o)
372
+ self.class == o.class &&
373
+ numero_facture == o.numero_facture &&
374
+ date_echeance_paiement == o.date_echeance_paiement &&
375
+ date_facture == o.date_facture &&
376
+ mode_depot == o.mode_depot &&
377
+ destinataire == o.destinataire &&
378
+ fournisseur == o.fournisseur &&
379
+ cadre_de_facturation == o.cadre_de_facturation &&
380
+ references == o.references &&
381
+ montant_total == o.montant_total &&
382
+ lignes_de_poste == o.lignes_de_poste &&
383
+ lignes_de_tva == o.lignes_de_tva &&
384
+ notes == o.notes &&
385
+ commentaire == o.commentaire &&
386
+ id_utilisateur_courant == o.id_utilisateur_courant &&
387
+ pieces_jointes_complementaires == o.pieces_jointes_complementaires
388
+ end
389
+
390
+ # @see the `==` method
391
+ # @param [Object] Object to be compared
392
+ def eql?(o)
393
+ self == o
394
+ end
395
+
396
+ # Calculates hash code according to all attributes.
397
+ # @return [Integer] Hash code
398
+ def hash
399
+ [numero_facture, date_echeance_paiement, date_facture, mode_depot, destinataire, fournisseur, cadre_de_facturation, references, montant_total, lignes_de_poste, lignes_de_tva, notes, commentaire, id_utilisateur_courant, pieces_jointes_complementaires].hash
400
+ end
401
+
402
+ # Builds the object from hash
403
+ # @param [Hash] attributes Model attributes in the form of hash
404
+ # @return [Object] Returns the model itself
405
+ def self.build_from_hash(attributes)
406
+ return nil unless attributes.is_a?(Hash)
407
+ attributes = attributes.transform_keys(&:to_sym)
408
+ transformed_hash = {}
409
+ openapi_types.each_pair do |key, type|
410
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
411
+ transformed_hash["#{key}"] = nil
412
+ elsif type =~ /\AArray<(.*)>/i
413
+ # check to ensure the input is an array given that the attribute
414
+ # is documented as an array but the input is not
415
+ if attributes[attribute_map[key]].is_a?(Array)
416
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
417
+ end
418
+ elsif !attributes[attribute_map[key]].nil?
419
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
420
+ end
421
+ end
422
+ new(transformed_hash)
423
+ end
424
+
425
+ # Returns the object in the form of hash
426
+ # @return [Hash] Returns the object in the form of hash
427
+ def to_hash
428
+ hash = {}
429
+ self.class.attribute_map.each_pair do |attr, param|
430
+ value = self.send(attr)
431
+ if value.nil?
432
+ is_nullable = self.class.openapi_nullable.include?(attr)
433
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
434
+ end
435
+
436
+ hash[param] = _to_hash(value)
437
+ end
438
+ hash
439
+ end
440
+
441
+ end
442
+
443
+ end
@@ -0,0 +1,40 @@
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 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ class FormatSortie
18
+ XML = "xml".freeze
19
+ PDF = "pdf".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [XML, PDF].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if FormatSortie.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #FormatSortie"
38
+ end
39
+ end
40
+ end