factpulse 3.0.29 → 3.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 +41 -46
- data/lib/factpulse/helpers/client.rb +11 -4
- data/lib/factpulse/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 673983cc0c0d989607d88a25c76e8a81c87acf975a6869d8b985ba3a352535b6
|
|
4
|
+
data.tar.gz: f1e84bb17377cf6bf4ccbf5e3d963ccd43c10d3c3be2a3e18640d286c3e53e61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b47cda21454ea34e0230e977577aae143df27843d31706a6042ae57bfe875a19a730de22eb45afbe7b8f6463e9ff1f09a9a15368e79ef42f1f6d26884aa2ff8
|
|
7
|
+
data.tar.gz: 57f37e3b73c29d95c087cabf36e2b2e16c191b9af5cfb73cf800f867f94aae82e887dc6ad793a9023fe0188e8e9248ec089fb87833b77700fbc6931d033510ae
|
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
|
-
## [3.0.
|
|
10
|
+
## [3.0.30] - 2026-01-16
|
|
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/v3.0.
|
|
28
|
-
[3.0.
|
|
27
|
+
[Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v3.0.30...HEAD
|
|
28
|
+
[3.0.30]: https://github.com/factpulse/sdk-ruby/releases/tag/v3.0.30
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -24,18 +24,17 @@ gem 'factpulse'
|
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
-
The `
|
|
27
|
+
The `FactPulse::Helpers` module provides a simplified API with automatic authentication and polling:
|
|
28
28
|
|
|
29
29
|
```ruby
|
|
30
30
|
require 'factpulse'
|
|
31
|
-
require 'factpulse/helpers'
|
|
32
31
|
|
|
33
|
-
include
|
|
32
|
+
include FactPulse::Helpers
|
|
34
33
|
|
|
35
34
|
# Create the client
|
|
36
35
|
client = FactPulseClient.new(
|
|
37
|
-
'your_email@example.com',
|
|
38
|
-
'your_password'
|
|
36
|
+
email: 'your_email@example.com',
|
|
37
|
+
password: 'your_password'
|
|
39
38
|
)
|
|
40
39
|
|
|
41
40
|
# Build the invoice using simplified format (auto-calculates totals)
|
|
@@ -66,18 +65,18 @@ pdf_bytes = client.generate_facturx(invoice_data, 'source_invoice.pdf')
|
|
|
66
65
|
File.binwrite('invoice_facturx.pdf', pdf_bytes)
|
|
67
66
|
```
|
|
68
67
|
|
|
69
|
-
## Available Helpers (
|
|
68
|
+
## Available Helpers (FactPulse::Helpers::AmountHelpers module)
|
|
70
69
|
|
|
71
70
|
### amount(value)
|
|
72
71
|
|
|
73
72
|
Converts a value to a formatted string for monetary amounts.
|
|
74
73
|
|
|
75
74
|
```ruby
|
|
76
|
-
include
|
|
75
|
+
include FactPulse::Helpers
|
|
77
76
|
|
|
78
|
-
amount(1234.5) # "1234.50"
|
|
79
|
-
amount('1234.56') # "1234.56"
|
|
80
|
-
amount(nil) # "0.00"
|
|
77
|
+
AmountHelpers.amount(1234.5) # "1234.50"
|
|
78
|
+
AmountHelpers.amount('1234.56') # "1234.56"
|
|
79
|
+
AmountHelpers.amount(nil) # "0.00"
|
|
81
80
|
```
|
|
82
81
|
|
|
83
82
|
### invoice_totals(excl_tax, vat, incl_tax, amount_due, ...)
|
|
@@ -85,7 +84,7 @@ amount(nil) # "0.00"
|
|
|
85
84
|
Creates a complete invoice totals object.
|
|
86
85
|
|
|
87
86
|
```ruby
|
|
88
|
-
totals = invoice_totals(
|
|
87
|
+
totals = AmountHelpers.invoice_totals(
|
|
89
88
|
1000.00, # excl_tax
|
|
90
89
|
200.00, # vat
|
|
91
90
|
1200.00, # incl_tax
|
|
@@ -96,36 +95,34 @@ totals = invoice_totals(
|
|
|
96
95
|
)
|
|
97
96
|
```
|
|
98
97
|
|
|
99
|
-
### invoice_line(
|
|
98
|
+
### invoice_line(number, description, quantity, unit_price_excl_tax, line_total_excl_tax, ...)
|
|
100
99
|
|
|
101
100
|
Creates an invoice line.
|
|
102
101
|
|
|
103
102
|
```ruby
|
|
104
|
-
line = invoice_line(
|
|
103
|
+
line = AmountHelpers.invoice_line(
|
|
105
104
|
1,
|
|
106
105
|
'Consulting services',
|
|
107
106
|
5,
|
|
108
107
|
200.00,
|
|
109
108
|
1000.00,
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
reference: 'REF-001'
|
|
115
|
-
}
|
|
109
|
+
vat_rate: '20.00', # vatRateManual
|
|
110
|
+
vat_category: 'S', # S, Z, E, AE, K
|
|
111
|
+
unit: 'LUMP_SUM', # LUMP_SUM, PIECE, HOUR, DAY...
|
|
112
|
+
reference: 'REF-001' # optional
|
|
116
113
|
)
|
|
117
114
|
```
|
|
118
115
|
|
|
119
|
-
### vat_line(
|
|
116
|
+
### vat_line(rate_manual, base_amount_excl_tax, vat_amount, category)
|
|
120
117
|
|
|
121
118
|
Creates a VAT breakdown line.
|
|
122
119
|
|
|
123
120
|
```ruby
|
|
124
|
-
vat = vat_line(
|
|
125
|
-
|
|
121
|
+
vat = AmountHelpers.vat_line(
|
|
122
|
+
'20.00', # rate_manual
|
|
123
|
+
1000.00, # base_amount_excl_tax
|
|
126
124
|
200.00, # vat_amount
|
|
127
|
-
'S'
|
|
128
|
-
{ rate: 'TVA20' } # Or manual_rate: '20.00'
|
|
125
|
+
category: 'S' # S, Z, E, AE, K
|
|
129
126
|
)
|
|
130
127
|
```
|
|
131
128
|
|
|
@@ -134,12 +131,12 @@ vat = vat_line(
|
|
|
134
131
|
Creates a structured postal address.
|
|
135
132
|
|
|
136
133
|
```ruby
|
|
137
|
-
address = postal_address(
|
|
134
|
+
address = AmountHelpers.postal_address(
|
|
138
135
|
'123 Republic Street',
|
|
139
136
|
'75001',
|
|
140
137
|
'Paris',
|
|
141
|
-
'FR',
|
|
142
|
-
'Building A'
|
|
138
|
+
country: 'FR', # default: 'FR'
|
|
139
|
+
line2: 'Building A' # optional
|
|
143
140
|
)
|
|
144
141
|
```
|
|
145
142
|
|
|
@@ -148,13 +145,13 @@ address = postal_address(
|
|
|
148
145
|
Creates a complete supplier with automatic calculation of SIREN and intra-community VAT.
|
|
149
146
|
|
|
150
147
|
```ruby
|
|
151
|
-
s = supplier(
|
|
148
|
+
s = AmountHelpers.supplier(
|
|
152
149
|
'My Company SAS',
|
|
153
150
|
'12345678901234',
|
|
154
151
|
'123 Example Street',
|
|
155
152
|
'75001',
|
|
156
153
|
'Paris',
|
|
157
|
-
|
|
154
|
+
iban: 'FR7630006000011234567890189'
|
|
158
155
|
)
|
|
159
156
|
# SIREN and intra-community VAT automatically calculated
|
|
160
157
|
```
|
|
@@ -164,7 +161,7 @@ s = supplier(
|
|
|
164
161
|
Creates a recipient (customer) with automatic calculation of SIREN.
|
|
165
162
|
|
|
166
163
|
```ruby
|
|
167
|
-
r = recipient(
|
|
164
|
+
r = AmountHelpers.recipient(
|
|
168
165
|
'Client SARL',
|
|
169
166
|
'98765432109876',
|
|
170
167
|
'456 Test Avenue',
|
|
@@ -178,30 +175,28 @@ r = recipient(
|
|
|
178
175
|
To pass your own credentials without server-side storage:
|
|
179
176
|
|
|
180
177
|
```ruby
|
|
181
|
-
include
|
|
178
|
+
include FactPulse::Helpers
|
|
182
179
|
|
|
183
180
|
chorus_creds = ChorusProCredentials.new(
|
|
184
|
-
'your_client_id',
|
|
185
|
-
'your_client_secret',
|
|
186
|
-
'your_login',
|
|
187
|
-
'your_password',
|
|
188
|
-
true
|
|
181
|
+
piste_client_id: 'your_client_id',
|
|
182
|
+
piste_client_secret: 'your_client_secret',
|
|
183
|
+
chorus_pro_login: 'your_login',
|
|
184
|
+
chorus_pro_password: 'your_password',
|
|
185
|
+
sandbox: true
|
|
189
186
|
)
|
|
190
187
|
|
|
191
188
|
afnor_creds = AFNORCredentials.new(
|
|
192
|
-
'https://api.pdp.fr/flow/v1',
|
|
193
|
-
'https://auth.pdp.fr/oauth/token',
|
|
194
|
-
'your_client_id',
|
|
195
|
-
'your_client_secret'
|
|
189
|
+
flow_service_url: 'https://api.pdp.fr/flow/v1',
|
|
190
|
+
token_url: 'https://auth.pdp.fr/oauth/token',
|
|
191
|
+
client_id: 'your_client_id',
|
|
192
|
+
client_secret: 'your_client_secret'
|
|
196
193
|
)
|
|
197
194
|
|
|
198
195
|
client = FactPulseClient.new(
|
|
199
|
-
'your_email@example.com',
|
|
200
|
-
'your_password',
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
chorus_creds,
|
|
204
|
-
afnor_creds
|
|
196
|
+
email: 'your_email@example.com',
|
|
197
|
+
password: 'your_password',
|
|
198
|
+
chorus_credentials: chorus_creds,
|
|
199
|
+
afnor_credentials: afnor_creds
|
|
205
200
|
)
|
|
206
201
|
```
|
|
207
202
|
|
|
@@ -561,14 +561,21 @@ module FactPulse
|
|
|
561
561
|
end
|
|
562
562
|
|
|
563
563
|
# Submits an invoice to Chorus Pro.
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
# @param invoice_data [Hash] Invoice data with keys: numero_facture, date_facture, date_echeance_paiement,
|
|
565
|
+
# id_structure_cpp, montant_ht_total, montant_tva, montant_ttc_total, etc.
|
|
566
|
+
# @return [Hash] Response with identifiant_facture_cpp, numero_flux_depot, code_retour, libelle
|
|
567
|
+
def submit_invoice_chorus(invoice_data)
|
|
568
|
+
make_chorus_request('POST', '/factures/soumettre', invoice_data)
|
|
566
569
|
end
|
|
570
|
+
alias soumettre_facture_chorus submit_invoice_chorus
|
|
567
571
|
|
|
568
572
|
# Gets the status of a Chorus Pro invoice.
|
|
569
|
-
|
|
570
|
-
|
|
573
|
+
# @param invoice_cpp_id [Integer] Chorus Pro invoice ID
|
|
574
|
+
# @return [Hash] Invoice status with statut_courant, numero_facture, date_facture, etc.
|
|
575
|
+
def get_invoice_status_chorus(invoice_cpp_id)
|
|
576
|
+
make_chorus_request('POST', '/factures/consulter', { 'identifiant_facture_cpp' => invoice_cpp_id })
|
|
571
577
|
end
|
|
578
|
+
alias consulter_facture_chorus get_invoice_status_chorus
|
|
572
579
|
|
|
573
580
|
# =========================================================================
|
|
574
581
|
# Validation
|
data/lib/factpulse/version.rb
CHANGED