factpulse 2.0.29 → 2.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile.lock +1 -1
- data/README.md +146 -133
- data/lib/factpulse/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78ca875881399d5d04602d4298a5fee55f3f7249fa347fe10e7aeb2fcb0dfd9d
|
|
4
|
+
data.tar.gz: b6ec7a089da11bc8b23e5aa4d181c027b7195f4e1c55c7ef9c5e7c06104831e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c0ed4f46576b6b09ce2751926b947fad1a6200cb42c4c5f725df79984530b7c507761ed9fdef006671517749fce5f3f3bb327c4b0d67f1f244fb2d3f1787f93
|
|
7
|
+
data.tar.gz: e5ab5b82a5eb675daa30dbb8e129ba468616c41126ec5ee9aa17d7d907a4c17565472a86f513dfe456113de53b5adf005106200a7775348b52e045d69c74aadc
|
data/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [2.0.
|
|
10
|
+
## [2.0.30] - 2025-11-29
|
|
11
11
|
|
|
12
12
|
### Added
|
|
13
13
|
- Version initiale du SDK ruby
|
|
@@ -24,5 +24,5 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
24
24
|
- Guide d'authentification JWT
|
|
25
25
|
- Configuration avancée (timeout, proxy, debug)
|
|
26
26
|
|
|
27
|
-
[Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v2.0.
|
|
28
|
-
[2.0.
|
|
27
|
+
[Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v2.0.30...HEAD
|
|
28
|
+
[2.0.30]: https://github.com/factpulse/sdk-ruby/releases/tag/v2.0.30
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Client Ruby officiel pour l'API FactPulse - Facturation électronique française.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Fonctionnalités
|
|
6
6
|
|
|
7
7
|
- **Factur-X** : Génération et validation de factures électroniques (profils MINIMUM, BASIC, EN16931, EXTENDED)
|
|
8
8
|
- **Chorus Pro** : Intégration avec la plateforme de facturation publique française
|
|
9
9
|
- **AFNOR PDP/PA** : Soumission de flux conformes à la norme XP Z12-013
|
|
10
10
|
- **Signature électronique** : Signature PDF (PAdES-B-B, PAdES-B-T, PAdES-B-LT)
|
|
11
11
|
- **Client simplifié** : Authentification JWT et polling intégrés via `helpers`
|
|
12
|
-
- **Ruby 2.7+** : Compatible avec les versions modernes de Ruby
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## Installation
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
16
|
gem install factpulse
|
|
@@ -23,9 +22,7 @@ Ou dans votre Gemfile :
|
|
|
23
22
|
gem 'factpulse'
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
### Méthode recommandée : Client simplifié avec helpers
|
|
25
|
+
## Démarrage rapide
|
|
29
26
|
|
|
30
27
|
Le module `helpers` offre une API simplifiée avec authentification et polling automatiques :
|
|
31
28
|
|
|
@@ -33,175 +30,191 @@ Le module `helpers` offre une API simplifiée avec authentification et polling a
|
|
|
33
30
|
require 'factpulse'
|
|
34
31
|
require 'factpulse/helpers'
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
include Factpulse::Helpers
|
|
34
|
+
|
|
35
|
+
# Créer le client
|
|
36
|
+
client = FactPulseClient.new(
|
|
37
|
+
'votre_email@example.com',
|
|
38
|
+
'votre_mot_de_passe'
|
|
40
39
|
)
|
|
41
40
|
|
|
42
|
-
#
|
|
41
|
+
# Construire la facture avec les helpers
|
|
43
42
|
facture_data = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
fournisseur:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
}]
|
|
43
|
+
numeroFacture: 'FAC-2025-001',
|
|
44
|
+
dateFacture: '2025-01-15',
|
|
45
|
+
fournisseur: fournisseur(
|
|
46
|
+
'Mon Entreprise SAS',
|
|
47
|
+
'12345678901234',
|
|
48
|
+
'123 Rue Example',
|
|
49
|
+
'75001',
|
|
50
|
+
'Paris'
|
|
51
|
+
),
|
|
52
|
+
destinataire: destinataire(
|
|
53
|
+
'Client SARL',
|
|
54
|
+
'98765432109876',
|
|
55
|
+
'456 Avenue Test',
|
|
56
|
+
'69001',
|
|
57
|
+
'Lyon'
|
|
58
|
+
),
|
|
59
|
+
montantTotal: montant_total(1000.00, 200.00, 1200.00, 1200.00),
|
|
60
|
+
lignesDePoste: [
|
|
61
|
+
ligne_de_poste(1, 'Prestation de conseil', 10, 100.00, 1000.00)
|
|
62
|
+
],
|
|
63
|
+
lignesDeTva: [
|
|
64
|
+
ligne_de_tva(1000.00, 200.00)
|
|
65
|
+
]
|
|
79
66
|
}
|
|
80
67
|
|
|
81
|
-
#
|
|
82
|
-
|
|
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
|
-
)
|
|
68
|
+
# Générer le PDF Factur-X
|
|
69
|
+
pdf_bytes = client.generer_facturx(facture_data, 'facture_source.pdf', 'EN16931')
|
|
92
70
|
|
|
93
|
-
# Sauvegarder
|
|
94
71
|
File.binwrite('facture_facturx.pdf', pdf_bytes)
|
|
95
72
|
```
|
|
96
73
|
|
|
97
|
-
|
|
74
|
+
## Helpers disponibles (module Factpulse::Helpers)
|
|
98
75
|
|
|
99
|
-
|
|
76
|
+
### montant(value)
|
|
77
|
+
|
|
78
|
+
Convertit une valeur en string formaté pour les montants monétaires.
|
|
100
79
|
|
|
101
80
|
```ruby
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
#
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
|
|
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')
|
|
81
|
+
include Factpulse::Helpers
|
|
82
|
+
|
|
83
|
+
montant(1234.5) # "1234.50"
|
|
84
|
+
montant('1234.56') # "1234.56"
|
|
85
|
+
montant(nil) # "0.00"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### montant_total(ht, tva, ttc, a_payer, ...)
|
|
89
|
+
|
|
90
|
+
Crée un objet MontantTotal complet.
|
|
91
|
+
|
|
92
|
+
```ruby
|
|
93
|
+
total = montant_total(
|
|
94
|
+
1000.00, # ht
|
|
95
|
+
200.00, # tva
|
|
96
|
+
1200.00, # ttc
|
|
97
|
+
1200.00, # a_payer
|
|
98
|
+
50.00, # remise_ttc (optionnel)
|
|
99
|
+
'Fidélité', # motif_remise (optionnel)
|
|
100
|
+
100.00 # acompte (optionnel)
|
|
133
101
|
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### ligne_de_poste(numero, denomination, quantite, montant_unitaire_ht, montant_total_ligne_ht, ...)
|
|
134
105
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
106
|
+
Crée une ligne de facturation.
|
|
107
|
+
|
|
108
|
+
```ruby
|
|
109
|
+
ligne = ligne_de_poste(
|
|
110
|
+
1,
|
|
111
|
+
'Prestation de conseil',
|
|
112
|
+
5,
|
|
113
|
+
200.00,
|
|
114
|
+
1000.00, # montant_total_ligne_ht requis
|
|
115
|
+
'S', # categorie_tva: S, Z, E, AE, K
|
|
116
|
+
'HEURE', # unite: FORFAIT, PIECE, HEURE, JOUR...
|
|
117
|
+
{
|
|
118
|
+
taux_tva: 'TVA20', # Ou taux_tva_manuel: '20.00'
|
|
119
|
+
reference: 'REF-001'
|
|
120
|
+
}
|
|
121
|
+
)
|
|
138
122
|
```
|
|
139
123
|
|
|
140
|
-
|
|
124
|
+
### ligne_de_tva(montant_base_ht, montant_tva, ...)
|
|
141
125
|
|
|
142
|
-
|
|
143
|
-
|----------------|----------|---------|
|
|
144
|
-
| Authentification | Manuelle | Automatique |
|
|
145
|
-
| Refresh token | Manuel | Automatique |
|
|
146
|
-
| Polling tâches async | Manuel | Automatique (backoff) |
|
|
147
|
-
| Retry sur 401 | Manuel | Automatique |
|
|
126
|
+
Crée une ligne de ventilation TVA.
|
|
148
127
|
|
|
149
|
-
|
|
128
|
+
```ruby
|
|
129
|
+
tva = ligne_de_tva(
|
|
130
|
+
1000.00, # montant_base_ht
|
|
131
|
+
200.00, # montant_tva
|
|
132
|
+
'S', # categorie: S, Z, E, AE, K
|
|
133
|
+
{ taux: 'TVA20' } # Ou taux_manuel: '20.00'
|
|
134
|
+
)
|
|
135
|
+
```
|
|
150
136
|
|
|
151
|
-
###
|
|
137
|
+
### adresse_postale(ligne1, code_postal, ville, ...)
|
|
152
138
|
|
|
153
|
-
|
|
139
|
+
Crée une adresse postale structurée.
|
|
154
140
|
|
|
155
141
|
```ruby
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
142
|
+
adresse = adresse_postale(
|
|
143
|
+
'123 Rue de la République',
|
|
144
|
+
'75001',
|
|
145
|
+
'Paris',
|
|
146
|
+
'FR', # pays (défaut: 'FR')
|
|
147
|
+
'Bâtiment A' # ligne2 (optionnel)
|
|
160
148
|
)
|
|
161
149
|
```
|
|
162
150
|
|
|
163
|
-
###
|
|
151
|
+
### fournisseur(nom, siret, adresse_ligne1, code_postal, ville, options)
|
|
152
|
+
|
|
153
|
+
Crée un fournisseur complet avec calcul automatique du SIREN et TVA intra.
|
|
164
154
|
|
|
165
155
|
```ruby
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
f = fournisseur(
|
|
157
|
+
'Ma Société SAS',
|
|
158
|
+
'12345678901234',
|
|
159
|
+
'123 Rue Example',
|
|
160
|
+
'75001',
|
|
161
|
+
'Paris',
|
|
162
|
+
{ iban: 'FR7630006000011234567890189' }
|
|
173
163
|
)
|
|
164
|
+
# SIREN et TVA intracommunautaire calculés automatiquement
|
|
174
165
|
```
|
|
175
166
|
|
|
176
|
-
|
|
167
|
+
### destinataire(nom, siret, adresse_ligne1, code_postal, ville, options)
|
|
177
168
|
|
|
178
|
-
|
|
169
|
+
Crée un destinataire (client) avec calcul automatique du SIREN.
|
|
179
170
|
|
|
180
171
|
```ruby
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
d = destinataire(
|
|
173
|
+
'Client SARL',
|
|
174
|
+
'98765432109876',
|
|
175
|
+
'456 Avenue Test',
|
|
176
|
+
'69001',
|
|
177
|
+
'Lyon'
|
|
178
|
+
)
|
|
179
|
+
```
|
|
183
180
|
|
|
184
|
-
|
|
185
|
-
montant = 1234.56
|
|
181
|
+
## Mode Zero-Trust (Chorus Pro / AFNOR)
|
|
186
182
|
|
|
187
|
-
|
|
188
|
-
montant = 1234
|
|
183
|
+
Pour passer vos propres credentials sans stockage côté serveur :
|
|
189
184
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
```ruby
|
|
186
|
+
include Factpulse::Helpers
|
|
187
|
+
|
|
188
|
+
chorus_creds = ChorusProCredentials.new(
|
|
189
|
+
'votre_client_id',
|
|
190
|
+
'votre_client_secret',
|
|
191
|
+
'votre_login',
|
|
192
|
+
'votre_password',
|
|
193
|
+
true # sandbox
|
|
194
|
+
)
|
|
193
195
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
afnor_creds = AFNORCredentials.new(
|
|
197
|
+
'https://api.pdp.fr/flow/v1',
|
|
198
|
+
'https://auth.pdp.fr/oauth/token',
|
|
199
|
+
'votre_client_id',
|
|
200
|
+
'votre_client_secret'
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
client = FactPulseClient.new(
|
|
204
|
+
'votre_email@example.com',
|
|
205
|
+
'votre_mot_de_passe',
|
|
206
|
+
nil, # api_url
|
|
207
|
+
nil, # client_uid
|
|
208
|
+
chorus_creds,
|
|
209
|
+
afnor_creds
|
|
210
|
+
)
|
|
196
211
|
```
|
|
197
212
|
|
|
198
|
-
##
|
|
213
|
+
## Ressources
|
|
199
214
|
|
|
200
215
|
- **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
216
|
- **Support** : contact@factpulse.fr
|
|
204
217
|
|
|
205
|
-
##
|
|
218
|
+
## Licence
|
|
206
219
|
|
|
207
220
|
MIT License - Copyright (c) 2025 FactPulse
|
data/lib/factpulse/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: factpulse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.30
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|