factpulse 2.0.12 → 2.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba3dd16ff1a8ac90992b77613ab1b7d25e9e32fa36bfc5a3b62a1387eaf6d3b4
4
- data.tar.gz: 1469af13979001a1e2c72dacd7395fb5927838b253f66fd6e62acaece827121b
3
+ metadata.gz: 13f4495a8ee788cb3614bbbeb3c6b65c744f877b9abd114090c003b0230768f5
4
+ data.tar.gz: 437f910edd71aec05f4a5429c129607b9062639833f80df08200d6eccbcc68e9
5
5
  SHA512:
6
- metadata.gz: 92c4c13698315fce5be0f708275736c4c6c71c702d63d3847f5c0bc34cbd3ce83d0c92548cc7d22282a6cac5363700991cda916c68d9a6373e20d8bda471d308
7
- data.tar.gz: 869734ab1911291ff51c88490d00ef5dfdc436273b16cc40976caf86828558e9eea30343572c5d8abc3db61d112f576ca7b16320d80e853477c953597b06c0f7
6
+ metadata.gz: 376bf0dd3b86dba80279206b3551167e78e1144244fa702799eb0b99f84e9c55b48d7c50d70cba10a7edf5bc9b8181470a95fe04b665f13e2b78640d52b63281
7
+ data.tar.gz: 194e1316ca40a8e14ebab4998e2dd54a5e2157aeb040260e898d8cfe3d604ca5d728f644c1370179cd480a96801ceffafb761bd89f09d42f0a9233ed1829aedf
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.12] - 2025-11-26
10
+ ## [2.0.13] - 2025-11-26
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.12...HEAD
28
- [2.0.12]: https://github.com/factpulse/sdk-ruby/releases/tag/v2.0.12
27
+ [Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v2.0.13...HEAD
28
+ [2.0.13]: https://github.com/factpulse/sdk-ruby/releases/tag/v2.0.13
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factpulse (2.0.12)
4
+ factpulse (2.0.13)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
data/docs/APIError.md ADDED
@@ -0,0 +1,22 @@
1
+ # FactPulse::APIError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error_code** | **String** | Code alphanumérique identifiant précisément l'erreur | |
8
+ | **error_message** | **String** | Message décrivant l'erreur (non destiné à l'utilisateur final) | |
9
+ | **details** | [**Array<ValidationErrorDetail>**](ValidationErrorDetail.md) | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'factpulse'
15
+
16
+ instance = FactPulse::APIError.new(
17
+ error_code: null,
18
+ error_message: null,
19
+ details: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,15 @@
1
+ # FactPulse::ErrorLevel
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::ErrorLevel.new()
14
+ ```
15
+
@@ -0,0 +1,15 @@
1
+ # FactPulse::ErrorSource
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::ErrorSource.new()
14
+ ```
15
+
@@ -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é : 'Error' ou 'Warning' | [optional] |
8
+ | **item** | **String** | Identifiant de l'élément concerné (XPath, champ, règle BR-FR, etc.) | |
9
+ | **reason** | **String** | Description de l'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,56 @@
1
+ # frozen_string_literal: true
2
+ require 'net/http'; require 'json'; require 'base64'; require 'uri'; require 'securerandom'
3
+
4
+ module FactPulse
5
+ module Helpers
6
+ class FactPulseClient
7
+ def initialize(email:, password:, api_url: nil, client_uid: nil, polling_interval: nil, polling_timeout: nil, max_retries: nil)
8
+ @email, @password = email, password; @api_url = (api_url || 'https://factpulse.fr').chomp('/')
9
+ @client_uid, @polling_interval, @polling_timeout, @max_retries = client_uid, polling_interval || 2000, polling_timeout || 120000, max_retries || 1
10
+ @access_token = @refresh_token = @token_expires_at = nil
11
+ end
12
+
13
+ def ensure_authenticated(force_refresh: false)
14
+ now = (Time.now.to_f * 1000).to_i
15
+ if force_refresh || @access_token.nil? || (@token_expires_at && now >= @token_expires_at)
16
+ payload = { 'username' => @email, 'password' => @password }; payload['client_uid'] = @client_uid if @client_uid
17
+ response = http_post(URI("#{@api_url}/api/token/"), payload)
18
+ raise FactPulseAuthError, "Auth failed" unless response.is_a?(Net::HTTPSuccess)
19
+ tokens = JSON.parse(response.body); @access_token, @refresh_token = tokens['access'], tokens['refresh']
20
+ @token_expires_at = now + (28 * 60 * 1000)
21
+ end
22
+ end
23
+
24
+ def reset_auth; @access_token = @refresh_token = @token_expires_at = nil; end
25
+
26
+ def poll_task(task_id, timeout: nil, interval: nil)
27
+ timeout_ms, interval_ms = timeout || @polling_timeout, interval || @polling_interval
28
+ start_time, current_interval = (Time.now.to_f * 1000).to_i, interval_ms.to_f
29
+ loop do
30
+ raise FactPulsePollingTimeout.new(task_id, timeout_ms) if (Time.now.to_f * 1000).to_i - start_time > timeout_ms
31
+ ensure_authenticated; response = http_get(URI("#{@api_url}/api/facturation/v1/traitement/taches/#{task_id}/statut"))
32
+ reset_auth and next if response.code == '401'
33
+ data = JSON.parse(response.body)
34
+ return data['resultat'] || {} if data['statut'] == 'SUCCESS'
35
+ if data['statut'] == 'FAILURE'
36
+ r = data['resultat'] || {}
37
+ raise FactPulseValidationError.new("Task #{task_id} failed: #{r['message_erreur'] || '?'}", (r['erreurs'] || []).map { |e| ValidationErrorDetail.from_hash(e) })
38
+ end
39
+ sleep(current_interval / 1000.0); current_interval = [current_interval * 1.5, 10000].min
40
+ end
41
+ end
42
+
43
+ def self.format_montant(m); m.nil? ? '0.00' : (m.is_a?(Numeric) ? format('%.2f', m) : (m.is_a?(String) ? m : '0.00')); end
44
+
45
+ private
46
+ def http_post(uri, payload)
47
+ Net::HTTP.new(uri.host, uri.port).tap { |h| h.use_ssl = uri.scheme == 'https'; h.read_timeout = 30 }
48
+ .request(Net::HTTP::Post.new(uri).tap { |r| r['Content-Type'] = 'application/json'; r.body = JSON.generate(payload) })
49
+ end
50
+ def http_get(uri)
51
+ Net::HTTP.new(uri.host, uri.port).tap { |h| h.use_ssl = uri.scheme == 'https'; h.read_timeout = 30 }
52
+ .request(Net::HTTP::Get.new(uri).tap { |r| r['Authorization'] = "Bearer #{@access_token}" })
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ module FactPulse
3
+ module Helpers
4
+ class FactPulseError < StandardError; end
5
+ class FactPulseAuthError < FactPulseError; end
6
+ class FactPulsePollingTimeout < FactPulseError
7
+ attr_reader :task_id, :timeout
8
+ def initialize(task_id, timeout); @task_id, @timeout = task_id, timeout; super("Timeout (#{timeout}ms) pour #{task_id}"); end
9
+ end
10
+ class ValidationErrorDetail
11
+ attr_accessor :level, :item, :reason, :source, :code
12
+ def initialize(level: '', item: '', reason: '', source: nil, code: nil); @level, @item, @reason, @source, @code = level, item, reason, source, code; end
13
+ def to_s; "[#{@item.to_s.empty? ? 'unknown' : @item}] #{@reason.to_s.empty? ? 'Unknown error' : @reason}"; end
14
+ def self.from_hash(h); new(level: h['level']||'', item: h['item']||'', reason: h['reason']||'', source: h['source'], code: h['code']); end
15
+ end
16
+ class FactPulseValidationError < FactPulseError
17
+ attr_reader :errors
18
+ def initialize(msg, errors = []); @errors = errors; super(errors.empty? ? msg : "#{msg}\n\nDétails:\n#{errors.map{|e| " - #{e}"}.join("\n")}"); end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'helpers/exceptions'
3
+ require_relative 'helpers/client'
4
+ module FactPulse
5
+ module Helpers
6
+ def self.create_client(**opts); FactPulseClient.new(**opts); end
7
+ def self.format_montant(m); FactPulseClient.format_montant(m); end
8
+ end
9
+ end
@@ -0,0 +1,205 @@
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
+ # Erreur API standardisée (alignée sur AFNOR Error schema). Format unifié pour toutes les réponses d'erreur HTTP.
18
+ class APIError < ApiModelBase
19
+ # Code alphanumérique identifiant précisément l'erreur
20
+ attr_accessor :error_code
21
+
22
+ # Message décrivant l'erreur (non destiné à l'utilisateur final)
23
+ attr_accessor :error_message
24
+
25
+ attr_accessor :details
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'error_code' => :'errorCode',
31
+ :'error_message' => :'errorMessage',
32
+ :'details' => :'details'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'error_code' => :'String',
50
+ :'error_message' => :'String',
51
+ :'details' => :'Array<ValidationErrorDetail>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ :'details'
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::APIError` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::APIError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'error_code')
79
+ self.error_code = attributes[:'error_code']
80
+ else
81
+ self.error_code = nil
82
+ end
83
+
84
+ if attributes.key?(:'error_message')
85
+ self.error_message = attributes[:'error_message']
86
+ else
87
+ self.error_message = nil
88
+ end
89
+
90
+ if attributes.key?(:'details')
91
+ if (value = attributes[:'details']).is_a?(Array)
92
+ self.details = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @error_code.nil?
103
+ invalid_properties.push('invalid value for "error_code", error_code cannot be nil.')
104
+ end
105
+
106
+ if @error_message.nil?
107
+ invalid_properties.push('invalid value for "error_message", error_message cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @error_code.nil?
118
+ return false if @error_message.nil?
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] error_code Value to be assigned
124
+ def error_code=(error_code)
125
+ if error_code.nil?
126
+ fail ArgumentError, 'error_code cannot be nil'
127
+ end
128
+
129
+ @error_code = error_code
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] error_message Value to be assigned
134
+ def error_message=(error_message)
135
+ if error_message.nil?
136
+ fail ArgumentError, 'error_message cannot be nil'
137
+ end
138
+
139
+ @error_message = error_message
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ error_code == o.error_code &&
148
+ error_message == o.error_message &&
149
+ details == o.details
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [error_code, error_message, details].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ openapi_types.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
179
+ end
180
+ elsif !attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
+ end
183
+ end
184
+ new(transformed_hash)
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ end
204
+
205
+ 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 ErrorLevel
18
+ ERROR = "Error".freeze
19
+ WARNING = "Warning".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [ERROR, WARNING].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 ErrorLevel.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #ErrorLevel"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,46 @@
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 ErrorSource
18
+ SCHEMATRON = "schematron".freeze
19
+ PDFA = "pdfa".freeze
20
+ PYDANTIC = "pydantic".freeze
21
+ XMP = "xmp".freeze
22
+ SIGNATURE = "signature".freeze
23
+ AFNOR = "afnor".freeze
24
+ CHORUS_PRO = "chorus_pro".freeze
25
+ SYSTEM = "system".freeze
26
+
27
+ def self.all_vars
28
+ @all_vars ||= [SCHEMATRON, PDFA, PYDANTIC, XMP, SIGNATURE, AFNOR, CHORUS_PRO, SYSTEM].freeze
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def self.build_from_hash(value)
35
+ new.build_from_hash(value)
36
+ end
37
+
38
+ # Builds the enum from string
39
+ # @param [String] The enum value in the form of the string
40
+ # @return [String] The enum value
41
+ def build_from_hash(value)
42
+ return value if ErrorSource.all_vars.include?(value)
43
+ raise "Invalid ENUM value #{value} for class #ErrorSource"
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,245 @@
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
+ # Détail d'une erreur de validation (aligné sur AFNOR AcknowledgementDetail). Format unifié pour toutes les erreurs de validation Factur-X, compatible avec la norme AFNOR XP Z12-013.
18
+ class ValidationErrorDetail < ApiModelBase
19
+ # Niveau de gravité : 'Error' ou 'Warning'
20
+ attr_accessor :level
21
+
22
+ # Identifiant de l'élément concerné (XPath, champ, règle BR-FR, etc.)
23
+ attr_accessor :item
24
+
25
+ # Description de l'erreur
26
+ attr_accessor :reason
27
+
28
+ attr_accessor :source
29
+
30
+ attr_accessor :code
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'level' => :'level',
58
+ :'item' => :'item',
59
+ :'reason' => :'reason',
60
+ :'source' => :'source',
61
+ :'code' => :'code'
62
+ }
63
+ end
64
+
65
+ # Returns attribute mapping this model knows about
66
+ def self.acceptable_attribute_map
67
+ attribute_map
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ acceptable_attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'level' => :'ErrorLevel',
79
+ :'item' => :'String',
80
+ :'reason' => :'String',
81
+ :'source' => :'ErrorSource',
82
+ :'code' => :'String'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ :'source',
90
+ :'code'
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::ValidationErrorDetail` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::ValidationErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'level')
111
+ self.level = attributes[:'level']
112
+ end
113
+
114
+ if attributes.key?(:'item')
115
+ self.item = attributes[:'item']
116
+ else
117
+ self.item = nil
118
+ end
119
+
120
+ if attributes.key?(:'reason')
121
+ self.reason = attributes[:'reason']
122
+ else
123
+ self.reason = nil
124
+ end
125
+
126
+ if attributes.key?(:'source')
127
+ self.source = attributes[:'source']
128
+ end
129
+
130
+ if attributes.key?(:'code')
131
+ self.code = attributes[:'code']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ if @item.nil?
141
+ invalid_properties.push('invalid value for "item", item cannot be nil.')
142
+ end
143
+
144
+ if @reason.nil?
145
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ warn '[DEPRECATED] the `valid?` method is obsolete'
155
+ return false if @item.nil?
156
+ return false if @reason.nil?
157
+ true
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] item Value to be assigned
162
+ def item=(item)
163
+ if item.nil?
164
+ fail ArgumentError, 'item cannot be nil'
165
+ end
166
+
167
+ @item = item
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] reason Value to be assigned
172
+ def reason=(reason)
173
+ if reason.nil?
174
+ fail ArgumentError, 'reason cannot be nil'
175
+ end
176
+
177
+ @reason = reason
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ level == o.level &&
186
+ item == o.item &&
187
+ reason == o.reason &&
188
+ source == o.source &&
189
+ code == o.code
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [level, item, reason, source, code].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ attributes = attributes.transform_keys(&:to_sym)
210
+ transformed_hash = {}
211
+ openapi_types.each_pair do |key, type|
212
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = nil
214
+ elsif type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[attribute_map[key]].is_a?(Array)
218
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
219
+ end
220
+ elsif !attributes[attribute_map[key]].nil?
221
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
222
+ end
223
+ end
224
+ new(transformed_hash)
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ end
244
+
245
+ end
@@ -11,5 +11,5 @@ Generator version: 7.18.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module FactPulse
14
- VERSION = '2.0.12'
14
+ VERSION = '2.0.13'
15
15
  end
data/lib/factpulse.rb CHANGED
@@ -18,6 +18,7 @@ require 'factpulse/version'
18
18
  require 'factpulse/configuration'
19
19
 
20
20
  # Models
21
+ require 'factpulse/models/api_error'
21
22
  require 'factpulse/models/adresse_electronique'
22
23
  require 'factpulse/models/adresse_postale'
23
24
  require 'factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post'
@@ -48,6 +49,8 @@ require 'factpulse/models/destination'
48
49
  require 'factpulse/models/destination_afnor'
49
50
  require 'factpulse/models/destination_chorus_pro'
50
51
  require 'factpulse/models/donnees_facture_simplifiees'
52
+ require 'factpulse/models/error_level'
53
+ require 'factpulse/models/error_source'
51
54
  require 'factpulse/models/facture_enrichie_info'
52
55
  require 'factpulse/models/facture_factur_x'
53
56
  require 'factpulse/models/format_sortie'
@@ -112,6 +115,7 @@ require 'factpulse/models/type_tva'
112
115
  require 'factpulse/models/unite'
113
116
  require 'factpulse/models/utilisateur'
114
117
  require 'factpulse/models/validation_error'
118
+ require 'factpulse/models/validation_error_detail'
115
119
  require 'factpulse/models/validation_error_loc_inner'
116
120
 
117
121
  # APIs
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factpulse
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.12
4
+ version: 2.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
@@ -125,6 +125,7 @@ files:
125
125
  - docs/AFNORPDPPAApi.md
126
126
  - docs/AFNORPDPPADirectoryServiceApi.md
127
127
  - docs/AFNORPDPPAFlowServiceApi.md
128
+ - docs/APIError.md
128
129
  - docs/AdresseElectronique.md
129
130
  - docs/AdressePostale.md
130
131
  - docs/BodyAjouterFichierApiV1ChorusProTransversesAjouterFichierPost.md
@@ -156,6 +157,8 @@ files:
156
157
  - docs/DestinationAFNOR.md
157
158
  - docs/DestinationChorusPro.md
158
159
  - docs/DonneesFactureSimplifiees.md
160
+ - docs/ErrorLevel.md
161
+ - docs/ErrorSource.md
159
162
  - docs/FactureEnrichieInfo.md
160
163
  - docs/FactureFacturX.md
161
164
  - docs/FormatSortie.md
@@ -223,6 +226,7 @@ files:
223
226
  - docs/Utilisateur.md
224
227
  - docs/UtilisateurApi.md
225
228
  - docs/ValidationError.md
229
+ - docs/ValidationErrorDetail.md
226
230
  - docs/ValidationErrorLocInner.md
227
231
  - factpulse.gemspec
228
232
  - git_push.sh
@@ -238,8 +242,12 @@ files:
238
242
  - lib/factpulse/api_error.rb
239
243
  - lib/factpulse/api_model_base.rb
240
244
  - lib/factpulse/configuration.rb
245
+ - lib/factpulse/helpers.rb
246
+ - lib/factpulse/helpers/client.rb
247
+ - lib/factpulse/helpers/exceptions.rb
241
248
  - lib/factpulse/models/adresse_electronique.rb
242
249
  - lib/factpulse/models/adresse_postale.rb
250
+ - lib/factpulse/models/api_error.rb
243
251
  - lib/factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post.rb
244
252
  - lib/factpulse/models/body_completer_facture_api_v1_chorus_pro_factures_completer_post.rb
245
253
  - lib/factpulse/models/body_lister_services_structure_api_v1_chorus_pro_structures_id_structure_cpp_services_get.rb
@@ -268,6 +276,8 @@ files:
268
276
  - lib/factpulse/models/destination_afnor.rb
269
277
  - lib/factpulse/models/destination_chorus_pro.rb
270
278
  - lib/factpulse/models/donnees_facture_simplifiees.rb
279
+ - lib/factpulse/models/error_level.rb
280
+ - lib/factpulse/models/error_source.rb
271
281
  - lib/factpulse/models/facture_enrichie_info.rb
272
282
  - lib/factpulse/models/facture_factur_x.rb
273
283
  - lib/factpulse/models/format_sortie.rb
@@ -332,6 +342,7 @@ files:
332
342
  - lib/factpulse/models/unite.rb
333
343
  - lib/factpulse/models/utilisateur.rb
334
344
  - lib/factpulse/models/validation_error.rb
345
+ - lib/factpulse/models/validation_error_detail.rb
335
346
  - lib/factpulse/models/validation_error_loc_inner.rb
336
347
  - lib/factpulse/version.rb
337
348
  homepage: https://openapi-generator.tech