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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4b18d85cbff7b4e8aa1f678bc18acba5121fd4b5df4b160a86b785bf56f4ec35
4
+ data.tar.gz: a7205107926d1a7b97474851c10a6af637281168926dcecc037675a6d3783c2f
5
+ SHA512:
6
+ metadata.gz: 43f8765a2cb63397a997f530c8d050faf120b7bd5be88acb8261f44f4dbfbda376f3dbc472b8194d6fee113246553165d4c19a329a919deae0af54580f96aa4e
7
+ data.tar.gz: 81cca817bfa1fdbc3d743f3feb49ab8ac19543aa8a2d4cd06f13f8866ebb1330f935e2870f9ee554effcaa548c80c348be98004189961a6e751deb7c044d06f7
data/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ Toutes les modifications notables de ce projet seront documentées dans ce fichier.
4
+
5
+ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/),
6
+ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.0.0] - 2025-11-27
11
+
12
+ ### Added
13
+ - Version initiale du SDK ruby
14
+ - Support complet de l'API FactPulse v1.0.0
15
+ - Endpoints Factur-X (génération, validation)
16
+ - Endpoints AFNOR PDP/PA (Flow Service, Directory Service)
17
+ - Endpoints Chorus Pro (recherche entreprise, soumission factures)
18
+ - Endpoints Signature électronique (PAdES-B-B, PAdES-B-T, PAdES-B-LT)
19
+ - Support des deux modes d'authentification (stored credentials et zero-trust)
20
+ - Documentation complète et exemples
21
+
22
+ ### Documentation
23
+ - README.md avec quickstart et exemples
24
+ - Guide d'authentification JWT
25
+ - Configuration avancée (timeout, proxy, debug)
26
+
27
+ [Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v1.0.0...HEAD
28
+ [1.0.0]: https://github.com/factpulse/sdk-ruby/releases/tag/v1.0.0
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ factpulse (1.0.0)
5
+ typhoeus (~> 1.0, >= 1.0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.3)
11
+ byebug (11.1.3)
12
+ coderay (1.1.3)
13
+ date (3.5.0)
14
+ diff-lcs (1.6.2)
15
+ ethon (0.15.0)
16
+ ffi (>= 1.15.0)
17
+ ffi (1.17.2)
18
+ jaro_winkler (1.5.6)
19
+ method_source (1.1.0)
20
+ parallel (1.27.0)
21
+ parser (3.3.10.0)
22
+ ast (~> 2.4.1)
23
+ racc
24
+ pry (0.14.2)
25
+ coderay (~> 1.1)
26
+ method_source (~> 1.0)
27
+ pry-byebug (3.10.1)
28
+ byebug (~> 11.0)
29
+ pry (>= 0.13, < 0.15)
30
+ psych (5.2.6)
31
+ date
32
+ stringio
33
+ racc (1.8.1)
34
+ rainbow (3.1.1)
35
+ rake (13.0.6)
36
+ rspec (3.13.2)
37
+ rspec-core (~> 3.13.0)
38
+ rspec-expectations (~> 3.13.0)
39
+ rspec-mocks (~> 3.13.0)
40
+ rspec-core (3.13.6)
41
+ rspec-support (~> 3.13.0)
42
+ rspec-expectations (3.13.5)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-mocks (3.13.7)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.13.0)
48
+ rspec-support (3.13.6)
49
+ rubocop (0.66.0)
50
+ jaro_winkler (~> 1.5.1)
51
+ parallel (~> 1.10)
52
+ parser (>= 2.5, != 2.5.1.1)
53
+ psych (>= 3.1.0)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ ruby-progressbar (~> 1.7)
56
+ unicode-display_width (>= 1.4.0, < 1.6)
57
+ ruby-progressbar (1.13.0)
58
+ stringio (3.1.8)
59
+ typhoeus (1.5.0)
60
+ ethon (>= 0.9.0, < 0.16.0)
61
+ unicode-display_width (1.5.0)
62
+
63
+ PLATFORMS
64
+ x86_64-linux
65
+
66
+ DEPENDENCIES
67
+ factpulse!
68
+ pry-byebug
69
+ rake (~> 13.0.1)
70
+ rspec (~> 3.6, >= 3.6.0)
71
+ rubocop (~> 0.66.0)
72
+
73
+ BUNDLED WITH
74
+ 2.2.33
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FactPulse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # FactPulse SDK Ruby
2
+
3
+ Client Ruby officiel pour l'API FactPulse - Facturation électronique française.
4
+
5
+ ## 🎯 Fonctionnalités
6
+
7
+ - **Factur-X** : Génération et validation de factures électroniques (profils MINIMUM, BASIC, EN16931, EXTENDED)
8
+ - **Chorus Pro** : Intégration avec la plateforme de facturation publique française
9
+ - **AFNOR PDP/PA** : Soumission de flux conformes Ă  la norme XP Z12-013
10
+ - **Signature électronique** : Signature PDF (PAdES-B-B, PAdES-B-T, PAdES-B-LT)
11
+ - **Client simplifié** : Authentification JWT et polling intégrés via `helpers`
12
+ - **Ruby 2.7+** : Compatible avec les versions modernes de Ruby
13
+
14
+ ## 🚀 Installation
15
+
16
+ ```bash
17
+ gem install factpulse
18
+ ```
19
+
20
+ Ou dans votre Gemfile :
21
+
22
+ ```ruby
23
+ gem 'factpulse'
24
+ ```
25
+
26
+ ## 📖 Démarrage rapide
27
+
28
+ ### Méthode recommandée : Client simplifié avec helpers
29
+
30
+ Le module `helpers` offre une API simplifiée avec authentification et polling automatiques :
31
+
32
+ ```ruby
33
+ require 'factpulse'
34
+ require 'factpulse/helpers'
35
+
36
+ # Créer le client (authentification automatique)
37
+ client = Factpulse::Helpers::FactPulseClient.new(
38
+ email: 'votre_email@example.com',
39
+ password: 'votre_mot_de_passe'
40
+ )
41
+
42
+ # Données de la facture
43
+ facture_data = {
44
+ numero_facture: 'FAC-2025-001',
45
+ date_facture: '2025-01-15',
46
+ fournisseur: {
47
+ nom: 'Mon Entreprise SAS',
48
+ siret: '12345678901234',
49
+ adresse_postale: {
50
+ ligne_un: '123 Rue Example',
51
+ code_postal: '75001',
52
+ nom_ville: 'Paris',
53
+ pays_code_iso: 'FR'
54
+ }
55
+ },
56
+ destinataire: {
57
+ nom: 'Client SARL',
58
+ siret: '98765432109876',
59
+ adresse_postale: {
60
+ ligne_un: '456 Avenue Test',
61
+ code_postal: '69001',
62
+ nom_ville: 'Lyon',
63
+ pays_code_iso: 'FR'
64
+ }
65
+ },
66
+ montant_total: {
67
+ montant_ht_total: '1000.00',
68
+ montant_tva: '200.00',
69
+ montant_ttc_total: '1200.00',
70
+ montant_a_payer: '1200.00'
71
+ },
72
+ lignes_de_poste: [{
73
+ numero: 1,
74
+ denomination: 'Prestation de conseil',
75
+ quantite: '10.00',
76
+ unite: 'PIECE',
77
+ montant_unitaire_ht: '100.00'
78
+ }]
79
+ }
80
+
81
+ # Lire le PDF source
82
+ pdf_source = File.binread('facture_source.pdf')
83
+
84
+ # Générer le PDF Factur-X (polling automatique)
85
+ pdf_bytes = client.generer_facturx(
86
+ facture_data,
87
+ pdf_source,
88
+ profil: 'EN16931',
89
+ format_sortie: 'pdf',
90
+ sync: true # Attend le résultat automatiquement
91
+ )
92
+
93
+ # Sauvegarder
94
+ File.binwrite('facture_facturx.pdf', pdf_bytes)
95
+ ```
96
+
97
+ ### Méthode alternative : SDK brut
98
+
99
+ Pour un contrôle total, utilisez le SDK généré directement :
100
+
101
+ ```ruby
102
+ require 'factpulse'
103
+ require 'net/http'
104
+ require 'json'
105
+
106
+ # 1. Obtenir le token JWT
107
+ uri = URI('https://factpulse.fr/api/token/')
108
+ http = Net::HTTP.new(uri.host, uri.port)
109
+ http.use_ssl = true
110
+
111
+ request = Net::HTTP::Post.new(uri.path, { 'Content-Type' => 'application/json' })
112
+ request.body = {
113
+ username: 'votre_email@example.com',
114
+ password: 'votre_mot_de_passe'
115
+ }.to_json
116
+
117
+ response = http.request(request)
118
+ token = JSON.parse(response.body)['access']
119
+
120
+ # 2. Configurer le client
121
+ Factpulse.configure do |config|
122
+ config.host = 'https://factpulse.fr/api/facturation'
123
+ config.access_token = token
124
+ end
125
+
126
+ # 3. Appeler l'API
127
+ api = Factpulse::TraitementFactureApi.new
128
+ response = api.generer_facture_api_v1_traitement_generer_facture_post(
129
+ facture_data.to_json,
130
+ 'EN16931',
131
+ 'pdf',
132
+ File.open('facture_source.pdf', 'rb')
133
+ )
134
+
135
+ # 4. Polling manuel pour récupérer le résultat
136
+ task_id = response.id_tache
137
+ # ... (implémenter le polling)
138
+ ```
139
+
140
+ ## đź”§ Avantages des helpers
141
+
142
+ | Fonctionnalité | SDK brut | helpers |
143
+ |----------------|----------|---------|
144
+ | Authentification | Manuelle | Automatique |
145
+ | Refresh token | Manuel | Automatique |
146
+ | Polling tâches async | Manuel | Automatique (backoff) |
147
+ | Retry sur 401 | Manuel | Automatique |
148
+
149
+ ## 🔑 Options d'authentification
150
+
151
+ ### Client UID (multi-clients)
152
+
153
+ Si vous gérez plusieurs clients :
154
+
155
+ ```ruby
156
+ client = Factpulse::Helpers::FactPulseClient.new(
157
+ email: 'votre_email@example.com',
158
+ password: 'votre_mot_de_passe',
159
+ client_uid: 'identifiant_client' # UID du client cible
160
+ )
161
+ ```
162
+
163
+ ### Configuration avancée
164
+
165
+ ```ruby
166
+ client = Factpulse::Helpers::FactPulseClient.new(
167
+ email: 'votre_email@example.com',
168
+ password: 'votre_mot_de_passe',
169
+ api_url: 'https://factpulse.fr', # URL personnalisée
170
+ polling_interval: 2.0, # Intervalle de polling initial (secondes)
171
+ polling_timeout: 120.0, # Timeout de polling (secondes)
172
+ max_retries: 2 # Tentatives en cas de 401
173
+ )
174
+ ```
175
+
176
+ ## 💡 Formats de montants acceptés
177
+
178
+ L'API accepte plusieurs formats pour les montants :
179
+
180
+ ```ruby
181
+ # String (recommandé pour la précision)
182
+ montant = '1234.56'
183
+
184
+ # Float
185
+ montant = 1234.56
186
+
187
+ # Integer
188
+ montant = 1234
189
+
190
+ # BigDecimal
191
+ require 'bigdecimal'
192
+ montant = BigDecimal('1234.56')
193
+
194
+ # Helper de formatage
195
+ montant_formate = Factpulse::Helpers::FactPulseClient.format_montant(1234.5) # => "1234.50"
196
+ ```
197
+
198
+ ## 📚 Ressources
199
+
200
+ - **Documentation API** : https://factpulse.fr/api/facturation/documentation
201
+ - **Code source** : https://github.com/factpulse/sdk-ruby
202
+ - **Issues** : https://github.com/factpulse/sdk-ruby/issues
203
+ - **Support** : contact@factpulse.fr
204
+
205
+ ## đź“„ Licence
206
+
207
+ MIT License - Copyright (c) 2025 FactPulse
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,69 @@
1
+ # FactPulse::AFNORPDPPAApi
2
+
3
+ All URIs are relative to *http://localhost*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**oauth_token_proxy_api_v1_afnor_oauth_token_post**](AFNORPDPPAApi.md#oauth_token_proxy_api_v1_afnor_oauth_token_post) | **POST** /api/v1/afnor/oauth/token | Endpoint OAuth2 pour authentification AFNOR |
8
+
9
+
10
+ ## oauth_token_proxy_api_v1_afnor_oauth_token_post
11
+
12
+ > Object oauth_token_proxy_api_v1_afnor_oauth_token_post
13
+
14
+ Endpoint OAuth2 pour authentification AFNOR
15
+
16
+ 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.
17
+
18
+ ### Examples
19
+
20
+ ```ruby
21
+ require 'time'
22
+ require 'factpulse'
23
+
24
+ api_instance = FactPulse::AFNORPDPPAApi.new
25
+
26
+ begin
27
+ # Endpoint OAuth2 pour authentification AFNOR
28
+ result = api_instance.oauth_token_proxy_api_v1_afnor_oauth_token_post
29
+ p result
30
+ rescue FactPulse::ApiError => e
31
+ puts "Error when calling AFNORPDPPAApi->oauth_token_proxy_api_v1_afnor_oauth_token_post: #{e}"
32
+ end
33
+ ```
34
+
35
+ #### Using the oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info variant
36
+
37
+ This returns an Array which contains the response data, status code and headers.
38
+
39
+ > <Array(Object, Integer, Hash)> oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info
40
+
41
+ ```ruby
42
+ begin
43
+ # Endpoint OAuth2 pour authentification AFNOR
44
+ data, status_code, headers = api_instance.oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info
45
+ p status_code # => 2xx
46
+ p headers # => { ... }
47
+ p data # => Object
48
+ rescue FactPulse::ApiError => e
49
+ puts "Error when calling AFNORPDPPAApi->oauth_token_proxy_api_v1_afnor_oauth_token_post_with_http_info: #{e}"
50
+ end
51
+ ```
52
+
53
+ ### Parameters
54
+
55
+ This endpoint does not need any parameter.
56
+
57
+ ### Return type
58
+
59
+ **Object**
60
+
61
+ ### Authorization
62
+
63
+ No authorization required
64
+
65
+ ### HTTP request headers
66
+
67
+ - **Content-Type**: Not defined
68
+ - **Accept**: application/json
69
+