factpulse 2.0.30 → 2.0.32

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: 78ca875881399d5d04602d4298a5fee55f3f7249fa347fe10e7aeb2fcb0dfd9d
4
- data.tar.gz: b6ec7a089da11bc8b23e5aa4d181c027b7195f4e1c55c7ef9c5e7c06104831e4
3
+ metadata.gz: 5f7bfa53096933d072237b9fbd6bb3ac69e4ec2ede132c5062740fbd38ec3737
4
+ data.tar.gz: 987effb4f3d2f0757e99e7f3fa12070a3d2ce55d5f38d9e2964007bae8de79c7
5
5
  SHA512:
6
- metadata.gz: 1c0ed4f46576b6b09ce2751926b947fad1a6200cb42c4c5f725df79984530b7c507761ed9fdef006671517749fce5f3f3bb327c4b0d67f1f244fb2d3f1787f93
7
- data.tar.gz: e5ab5b82a5eb675daa30dbb8e129ba468616c41126ec5ee9aa17d7d907a4c17565472a86f513dfe456113de53b5adf005106200a7775348b52e045d69c74aadc
6
+ metadata.gz: 33a4436db9e893809635e129201162558d0b2c9c1e8ff8780880865700c34e40bbea3fbb174f0ebe7ee46137e0ebcd7e095674efef6e1665d51262c80386586b
7
+ data.tar.gz: 1913c9977dbe7f2284d79fdd504adfd329c0fd051fac3f90e55dcb2edc89cc9725f109d9068d5eb34b2924cf2a363d9440dc89b7923c3a90c2146faf34bdc63e
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.30] - 2025-11-29
10
+ ## [2.0.32] - 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.30...HEAD
28
- [2.0.30]: https://github.com/factpulse/sdk-ruby/releases/tag/v2.0.30
27
+ [Unreleased]: https://github.com/factpulse/sdk-ruby/compare/v2.0.32...HEAD
28
+ [2.0.32]: https://github.com/factpulse/sdk-ruby/releases/tag/v2.0.32
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factpulse (2.0.30)
4
+ factpulse (2.0.32)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost*
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
7
  | [**get_afnor_credentials_api_v1_afnor_credentials_get**](AFNORPDPPAApi.md#get_afnor_credentials_api_v1_afnor_credentials_get) | **GET** /api/v1/afnor/credentials | Récupérer les credentials AFNOR stockés |
8
+ | [**get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get**](AFNORPDPPAApi.md#get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get) | **GET** /api/v1/afnor/flux-entrants/{flow_id} | Récupérer et extraire une facture entrante |
8
9
  | [**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 |
9
10
 
10
11
 
@@ -74,6 +75,79 @@ This endpoint does not need any parameter.
74
75
  - **Accept**: application/json
75
76
 
76
77
 
78
+ ## get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get
79
+
80
+ > <FactureEntrante> get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get(flow_id, opts)
81
+
82
+ Récupérer et extraire une facture entrante
83
+
84
+ Télécharge un flux entrant depuis la PDP AFNOR et extrait les métadonnées de la facture vers un format JSON unifié. Supporte les formats Factur-X, CII et UBL.
85
+
86
+ ### Examples
87
+
88
+ ```ruby
89
+ require 'time'
90
+ require 'factpulse'
91
+ # setup authorization
92
+ FactPulse.configure do |config|
93
+ # Configure Bearer authorization: HTTPBearer
94
+ config.access_token = 'YOUR_BEARER_TOKEN'
95
+ end
96
+
97
+ api_instance = FactPulse::AFNORPDPPAApi.new
98
+ flow_id = 'flow_id_example' # String |
99
+ opts = {
100
+ include_document: true # Boolean |
101
+ }
102
+
103
+ begin
104
+ # Récupérer et extraire une facture entrante
105
+ result = api_instance.get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get(flow_id, opts)
106
+ p result
107
+ rescue FactPulse::ApiError => e
108
+ puts "Error when calling AFNORPDPPAApi->get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get: #{e}"
109
+ end
110
+ ```
111
+
112
+ #### Using the get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info variant
113
+
114
+ This returns an Array which contains the response data, status code and headers.
115
+
116
+ > <Array(<FactureEntrante>, Integer, Hash)> get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info(flow_id, opts)
117
+
118
+ ```ruby
119
+ begin
120
+ # Récupérer et extraire une facture entrante
121
+ data, status_code, headers = api_instance.get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info(flow_id, opts)
122
+ p status_code # => 2xx
123
+ p headers # => { ... }
124
+ p data # => <FactureEntrante>
125
+ rescue FactPulse::ApiError => e
126
+ puts "Error when calling AFNORPDPPAApi->get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info: #{e}"
127
+ end
128
+ ```
129
+
130
+ ### Parameters
131
+
132
+ | Name | Type | Description | Notes |
133
+ | ---- | ---- | ----------- | ----- |
134
+ | **flow_id** | **String** | | |
135
+ | **include_document** | **Boolean** | | [optional][default to false] |
136
+
137
+ ### Return type
138
+
139
+ [**FactureEntrante**](FactureEntrante.md)
140
+
141
+ ### Authorization
142
+
143
+ [HTTPBearer](../README.md#HTTPBearer)
144
+
145
+ ### HTTP request headers
146
+
147
+ - **Content-Type**: Not defined
148
+ - **Accept**: application/json
149
+
150
+
77
151
  ## oauth_token_proxy_api_v1_afnor_oauth_token_post
78
152
 
79
153
  > Object oauth_token_proxy_api_v1_afnor_oauth_token_post
@@ -0,0 +1,54 @@
1
+ # FactPulse::FactureEntrante
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **flow_id** | **String** | | [optional] |
8
+ | **format_source** | [**FormatFacture**](FormatFacture.md) | Format source de la facture | |
9
+ | **ref_fournisseur** | **String** | Numéro de facture émis par le fournisseur (BT-1) | |
10
+ | **type_document** | [**TypeDocument**](TypeDocument.md) | Type de document (BT-3) | [optional] |
11
+ | **fournisseur** | [**FournisseurEntrant**](FournisseurEntrant.md) | Émetteur de la facture (SellerTradeParty) | |
12
+ | **site_facturation_nom** | **String** | Nom du destinataire / votre entreprise (BT-44) | |
13
+ | **site_facturation_siret** | **String** | | [optional] |
14
+ | **date_de_piece** | **String** | Date de la facture (BT-2) - YYYY-MM-DD | |
15
+ | **date_reglement** | **String** | | [optional] |
16
+ | **devise** | **String** | Code devise ISO (BT-5) | [optional][default to &#39;EUR&#39;] |
17
+ | **montant_ht** | **String** | Montant HT total (BT-109) | |
18
+ | **montant_tva** | **String** | Montant TVA total (BT-110) | |
19
+ | **montant_ttc** | **String** | Montant TTC total (BT-112) | |
20
+ | **numero_bon_commande** | **String** | | [optional] |
21
+ | **reference_contrat** | **String** | | [optional] |
22
+ | **objet_facture** | **String** | | [optional] |
23
+ | **document_base64** | **String** | | [optional] |
24
+ | **document_content_type** | **String** | | [optional] |
25
+ | **document_filename** | **String** | | [optional] |
26
+
27
+ ## Example
28
+
29
+ ```ruby
30
+ require 'factpulse'
31
+
32
+ instance = FactPulse::FactureEntrante.new(
33
+ flow_id: null,
34
+ format_source: null,
35
+ ref_fournisseur: null,
36
+ type_document: null,
37
+ fournisseur: null,
38
+ site_facturation_nom: null,
39
+ site_facturation_siret: null,
40
+ date_de_piece: null,
41
+ date_reglement: null,
42
+ devise: null,
43
+ montant_ht: null,
44
+ montant_tva: null,
45
+ montant_ttc: null,
46
+ numero_bon_commande: null,
47
+ reference_contrat: null,
48
+ objet_facture: null,
49
+ document_base64: null,
50
+ document_content_type: null,
51
+ document_filename: null
52
+ )
53
+ ```
54
+
@@ -0,0 +1,15 @@
1
+ # FactPulse::FormatFacture
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::FormatFacture.new()
14
+ ```
15
+
@@ -0,0 +1,32 @@
1
+ # FactPulse::FournisseurEntrant
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **nom** | **String** | Raison sociale du fournisseur (BT-27) | |
8
+ | **siren** | **String** | | [optional] |
9
+ | **siret** | **String** | | [optional] |
10
+ | **numero_tva_intra** | **String** | | [optional] |
11
+ | **adresse_postale** | [**AdressePostale**](AdressePostale.md) | | [optional] |
12
+ | **adresse_electronique** | [**AdresseElectronique**](AdresseElectronique.md) | | [optional] |
13
+ | **email** | **String** | | [optional] |
14
+ | **telephone** | **String** | | [optional] |
15
+
16
+ ## Example
17
+
18
+ ```ruby
19
+ require 'factpulse'
20
+
21
+ instance = FactPulse::FournisseurEntrant.new(
22
+ nom: null,
23
+ siren: null,
24
+ siret: null,
25
+ numero_tva_intra: null,
26
+ adresse_postale: null,
27
+ adresse_electronique: null,
28
+ email: null,
29
+ telephone: null
30
+ )
31
+ ```
32
+
@@ -0,0 +1,15 @@
1
+ # FactPulse::TypeDocument
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'factpulse'
12
+
13
+ instance = FactPulse::TypeDocument.new()
14
+ ```
15
+
@@ -76,6 +76,72 @@ module FactPulse
76
76
  return data, status_code, headers
77
77
  end
78
78
 
79
+ # Récupérer et extraire une facture entrante
80
+ # Télécharge un flux entrant depuis la PDP AFNOR et extrait les métadonnées de la facture vers un format JSON unifié. Supporte les formats Factur-X, CII et UBL.
81
+ # @param flow_id [String]
82
+ # @param [Hash] opts the optional parameters
83
+ # @option opts [Boolean] :include_document (default to false)
84
+ # @return [FactureEntrante]
85
+ def get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get(flow_id, opts = {})
86
+ data, _status_code, _headers = get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info(flow_id, opts)
87
+ data
88
+ end
89
+
90
+ # Récupérer et extraire une facture entrante
91
+ # Télécharge un flux entrant depuis la PDP AFNOR et extrait les métadonnées de la facture vers un format JSON unifié. Supporte les formats Factur-X, CII et UBL.
92
+ # @param flow_id [String]
93
+ # @param [Hash] opts the optional parameters
94
+ # @option opts [Boolean] :include_document (default to false)
95
+ # @return [Array<(FactureEntrante, Integer, Hash)>] FactureEntrante data, response status code and response headers
96
+ def get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get_with_http_info(flow_id, opts = {})
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug 'Calling API: AFNORPDPPAApi.get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get ...'
99
+ end
100
+ # verify the required parameter 'flow_id' is set
101
+ if @api_client.config.client_side_validation && flow_id.nil?
102
+ fail ArgumentError, "Missing the required parameter 'flow_id' when calling AFNORPDPPAApi.get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get"
103
+ end
104
+ # resource path
105
+ local_var_path = '/api/v1/afnor/flux-entrants/{flow_id}'.sub('{' + 'flow_id' + '}', CGI.escape(flow_id.to_s))
106
+
107
+ # query parameters
108
+ query_params = opts[:query_params] || {}
109
+ query_params[:'include_document'] = opts[:'include_document'] if !opts[:'include_document'].nil?
110
+
111
+ # header parameters
112
+ header_params = opts[:header_params] || {}
113
+ # HTTP header 'Accept' (if needed)
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
115
+
116
+ # form parameters
117
+ form_params = opts[:form_params] || {}
118
+
119
+ # http body (model)
120
+ post_body = opts[:debug_body]
121
+
122
+ # return_type
123
+ return_type = opts[:debug_return_type] || 'FactureEntrante'
124
+
125
+ # auth_names
126
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
127
+
128
+ new_options = opts.merge(
129
+ :operation => :"AFNORPDPPAApi.get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get",
130
+ :header_params => header_params,
131
+ :query_params => query_params,
132
+ :form_params => form_params,
133
+ :body => post_body,
134
+ :auth_names => auth_names,
135
+ :return_type => return_type
136
+ )
137
+
138
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug "API called: AFNORPDPPAApi#get_flux_entrant_api_v1_afnor_flux_entrants_flow_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ return data, status_code, headers
143
+ end
144
+
79
145
  # Endpoint OAuth2 pour authentification AFNOR
80
146
  # 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.
81
147
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,522 @@
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
+ # Facture reçue d'un fournisseur via PDP/PA. Ce modèle contient les métadonnées essentielles extraites des factures entrantes, quel que soit leur format source (CII, UBL, Factur-X). Les montants sont en Decimal en Python mais seront sérialisés en string dans le JSON pour préserver la précision monétaire.
18
+ class FactureEntrante < ApiModelBase
19
+ attr_accessor :flow_id
20
+
21
+ # Format source de la facture
22
+ attr_accessor :format_source
23
+
24
+ # Numéro de facture émis par le fournisseur (BT-1)
25
+ attr_accessor :ref_fournisseur
26
+
27
+ # Type de document (BT-3)
28
+ attr_accessor :type_document
29
+
30
+ # Émetteur de la facture (SellerTradeParty)
31
+ attr_accessor :fournisseur
32
+
33
+ # Nom du destinataire / votre entreprise (BT-44)
34
+ attr_accessor :site_facturation_nom
35
+
36
+ attr_accessor :site_facturation_siret
37
+
38
+ # Date de la facture (BT-2) - YYYY-MM-DD
39
+ attr_accessor :date_de_piece
40
+
41
+ attr_accessor :date_reglement
42
+
43
+ # Code devise ISO (BT-5)
44
+ attr_accessor :devise
45
+
46
+ # Montant HT total (BT-109)
47
+ attr_accessor :montant_ht
48
+
49
+ # Montant TVA total (BT-110)
50
+ attr_accessor :montant_tva
51
+
52
+ # Montant TTC total (BT-112)
53
+ attr_accessor :montant_ttc
54
+
55
+ attr_accessor :numero_bon_commande
56
+
57
+ attr_accessor :reference_contrat
58
+
59
+ attr_accessor :objet_facture
60
+
61
+ attr_accessor :document_base64
62
+
63
+ attr_accessor :document_content_type
64
+
65
+ attr_accessor :document_filename
66
+
67
+ class EnumAttributeValidator
68
+ attr_reader :datatype
69
+ attr_reader :allowable_values
70
+
71
+ def initialize(datatype, allowable_values)
72
+ @allowable_values = allowable_values.map do |value|
73
+ case datatype.to_s
74
+ when /Integer/i
75
+ value.to_i
76
+ when /Float/i
77
+ value.to_f
78
+ else
79
+ value
80
+ end
81
+ end
82
+ end
83
+
84
+ def valid?(value)
85
+ !value || allowable_values.include?(value)
86
+ end
87
+ end
88
+
89
+ # Attribute mapping from ruby-style variable name to JSON key.
90
+ def self.attribute_map
91
+ {
92
+ :'flow_id' => :'flow_id',
93
+ :'format_source' => :'format_source',
94
+ :'ref_fournisseur' => :'ref_fournisseur',
95
+ :'type_document' => :'type_document',
96
+ :'fournisseur' => :'fournisseur',
97
+ :'site_facturation_nom' => :'site_facturation_nom',
98
+ :'site_facturation_siret' => :'site_facturation_siret',
99
+ :'date_de_piece' => :'date_de_piece',
100
+ :'date_reglement' => :'date_reglement',
101
+ :'devise' => :'devise',
102
+ :'montant_ht' => :'montant_ht',
103
+ :'montant_tva' => :'montant_tva',
104
+ :'montant_ttc' => :'montant_ttc',
105
+ :'numero_bon_commande' => :'numero_bon_commande',
106
+ :'reference_contrat' => :'reference_contrat',
107
+ :'objet_facture' => :'objet_facture',
108
+ :'document_base64' => :'document_base64',
109
+ :'document_content_type' => :'document_content_type',
110
+ :'document_filename' => :'document_filename'
111
+ }
112
+ end
113
+
114
+ # Returns attribute mapping this model knows about
115
+ def self.acceptable_attribute_map
116
+ attribute_map
117
+ end
118
+
119
+ # Returns all the JSON keys this model knows about
120
+ def self.acceptable_attributes
121
+ acceptable_attribute_map.values
122
+ end
123
+
124
+ # Attribute type mapping.
125
+ def self.openapi_types
126
+ {
127
+ :'flow_id' => :'String',
128
+ :'format_source' => :'FormatFacture',
129
+ :'ref_fournisseur' => :'String',
130
+ :'type_document' => :'TypeDocument',
131
+ :'fournisseur' => :'FournisseurEntrant',
132
+ :'site_facturation_nom' => :'String',
133
+ :'site_facturation_siret' => :'String',
134
+ :'date_de_piece' => :'String',
135
+ :'date_reglement' => :'String',
136
+ :'devise' => :'String',
137
+ :'montant_ht' => :'String',
138
+ :'montant_tva' => :'String',
139
+ :'montant_ttc' => :'String',
140
+ :'numero_bon_commande' => :'String',
141
+ :'reference_contrat' => :'String',
142
+ :'objet_facture' => :'String',
143
+ :'document_base64' => :'String',
144
+ :'document_content_type' => :'String',
145
+ :'document_filename' => :'String'
146
+ }
147
+ end
148
+
149
+ # List of attributes with nullable: true
150
+ def self.openapi_nullable
151
+ Set.new([
152
+ :'flow_id',
153
+ :'site_facturation_siret',
154
+ :'date_reglement',
155
+ :'numero_bon_commande',
156
+ :'reference_contrat',
157
+ :'objet_facture',
158
+ :'document_base64',
159
+ :'document_content_type',
160
+ :'document_filename'
161
+ ])
162
+ end
163
+
164
+ # Initializes the object
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ def initialize(attributes = {})
167
+ if (!attributes.is_a?(Hash))
168
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::FactureEntrante` initialize method"
169
+ end
170
+
171
+ # check to see if the attribute exists and convert string to symbol for hash key
172
+ acceptable_attribute_map = self.class.acceptable_attribute_map
173
+ attributes = attributes.each_with_object({}) { |(k, v), h|
174
+ if (!acceptable_attribute_map.key?(k.to_sym))
175
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::FactureEntrante`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
176
+ end
177
+ h[k.to_sym] = v
178
+ }
179
+
180
+ if attributes.key?(:'flow_id')
181
+ self.flow_id = attributes[:'flow_id']
182
+ end
183
+
184
+ if attributes.key?(:'format_source')
185
+ self.format_source = attributes[:'format_source']
186
+ else
187
+ self.format_source = nil
188
+ end
189
+
190
+ if attributes.key?(:'ref_fournisseur')
191
+ self.ref_fournisseur = attributes[:'ref_fournisseur']
192
+ else
193
+ self.ref_fournisseur = nil
194
+ end
195
+
196
+ if attributes.key?(:'type_document')
197
+ self.type_document = attributes[:'type_document']
198
+ end
199
+
200
+ if attributes.key?(:'fournisseur')
201
+ self.fournisseur = attributes[:'fournisseur']
202
+ else
203
+ self.fournisseur = nil
204
+ end
205
+
206
+ if attributes.key?(:'site_facturation_nom')
207
+ self.site_facturation_nom = attributes[:'site_facturation_nom']
208
+ else
209
+ self.site_facturation_nom = nil
210
+ end
211
+
212
+ if attributes.key?(:'site_facturation_siret')
213
+ self.site_facturation_siret = attributes[:'site_facturation_siret']
214
+ end
215
+
216
+ if attributes.key?(:'date_de_piece')
217
+ self.date_de_piece = attributes[:'date_de_piece']
218
+ else
219
+ self.date_de_piece = nil
220
+ end
221
+
222
+ if attributes.key?(:'date_reglement')
223
+ self.date_reglement = attributes[:'date_reglement']
224
+ end
225
+
226
+ if attributes.key?(:'devise')
227
+ self.devise = attributes[:'devise']
228
+ else
229
+ self.devise = 'EUR'
230
+ end
231
+
232
+ if attributes.key?(:'montant_ht')
233
+ self.montant_ht = attributes[:'montant_ht']
234
+ else
235
+ self.montant_ht = nil
236
+ end
237
+
238
+ if attributes.key?(:'montant_tva')
239
+ self.montant_tva = attributes[:'montant_tva']
240
+ else
241
+ self.montant_tva = nil
242
+ end
243
+
244
+ if attributes.key?(:'montant_ttc')
245
+ self.montant_ttc = attributes[:'montant_ttc']
246
+ else
247
+ self.montant_ttc = nil
248
+ end
249
+
250
+ if attributes.key?(:'numero_bon_commande')
251
+ self.numero_bon_commande = attributes[:'numero_bon_commande']
252
+ end
253
+
254
+ if attributes.key?(:'reference_contrat')
255
+ self.reference_contrat = attributes[:'reference_contrat']
256
+ end
257
+
258
+ if attributes.key?(:'objet_facture')
259
+ self.objet_facture = attributes[:'objet_facture']
260
+ end
261
+
262
+ if attributes.key?(:'document_base64')
263
+ self.document_base64 = attributes[:'document_base64']
264
+ end
265
+
266
+ if attributes.key?(:'document_content_type')
267
+ self.document_content_type = attributes[:'document_content_type']
268
+ end
269
+
270
+ if attributes.key?(:'document_filename')
271
+ self.document_filename = attributes[:'document_filename']
272
+ end
273
+ end
274
+
275
+ # Show invalid properties with the reasons. Usually used together with valid?
276
+ # @return Array for valid properties with the reasons
277
+ def list_invalid_properties
278
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
279
+ invalid_properties = Array.new
280
+ if @format_source.nil?
281
+ invalid_properties.push('invalid value for "format_source", format_source cannot be nil.')
282
+ end
283
+
284
+ if @ref_fournisseur.nil?
285
+ invalid_properties.push('invalid value for "ref_fournisseur", ref_fournisseur cannot be nil.')
286
+ end
287
+
288
+ if @fournisseur.nil?
289
+ invalid_properties.push('invalid value for "fournisseur", fournisseur cannot be nil.')
290
+ end
291
+
292
+ if @site_facturation_nom.nil?
293
+ invalid_properties.push('invalid value for "site_facturation_nom", site_facturation_nom cannot be nil.')
294
+ end
295
+
296
+ if @date_de_piece.nil?
297
+ invalid_properties.push('invalid value for "date_de_piece", date_de_piece cannot be nil.')
298
+ end
299
+
300
+ if @montant_ht.nil?
301
+ invalid_properties.push('invalid value for "montant_ht", montant_ht cannot be nil.')
302
+ end
303
+
304
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
305
+ if @montant_ht !~ pattern
306
+ invalid_properties.push("invalid value for \"montant_ht\", must conform to the pattern #{pattern}.")
307
+ end
308
+
309
+ if @montant_tva.nil?
310
+ invalid_properties.push('invalid value for "montant_tva", montant_tva cannot be nil.')
311
+ end
312
+
313
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
314
+ if @montant_tva !~ pattern
315
+ invalid_properties.push("invalid value for \"montant_tva\", must conform to the pattern #{pattern}.")
316
+ end
317
+
318
+ if @montant_ttc.nil?
319
+ invalid_properties.push('invalid value for "montant_ttc", montant_ttc cannot be nil.')
320
+ end
321
+
322
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
323
+ if @montant_ttc !~ pattern
324
+ invalid_properties.push("invalid value for \"montant_ttc\", must conform to the pattern #{pattern}.")
325
+ end
326
+
327
+ invalid_properties
328
+ end
329
+
330
+ # Check to see if the all the properties in the model are valid
331
+ # @return true if the model is valid
332
+ def valid?
333
+ warn '[DEPRECATED] the `valid?` method is obsolete'
334
+ return false if @format_source.nil?
335
+ return false if @ref_fournisseur.nil?
336
+ return false if @fournisseur.nil?
337
+ return false if @site_facturation_nom.nil?
338
+ return false if @date_de_piece.nil?
339
+ return false if @montant_ht.nil?
340
+ return false if @montant_ht !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
341
+ return false if @montant_tva.nil?
342
+ return false if @montant_tva !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
343
+ return false if @montant_ttc.nil?
344
+ return false if @montant_ttc !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
345
+ true
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] format_source Value to be assigned
350
+ def format_source=(format_source)
351
+ if format_source.nil?
352
+ fail ArgumentError, 'format_source cannot be nil'
353
+ end
354
+
355
+ @format_source = format_source
356
+ end
357
+
358
+ # Custom attribute writer method with validation
359
+ # @param [Object] ref_fournisseur Value to be assigned
360
+ def ref_fournisseur=(ref_fournisseur)
361
+ if ref_fournisseur.nil?
362
+ fail ArgumentError, 'ref_fournisseur cannot be nil'
363
+ end
364
+
365
+ @ref_fournisseur = ref_fournisseur
366
+ end
367
+
368
+ # Custom attribute writer method with validation
369
+ # @param [Object] fournisseur Value to be assigned
370
+ def fournisseur=(fournisseur)
371
+ if fournisseur.nil?
372
+ fail ArgumentError, 'fournisseur cannot be nil'
373
+ end
374
+
375
+ @fournisseur = fournisseur
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] site_facturation_nom Value to be assigned
380
+ def site_facturation_nom=(site_facturation_nom)
381
+ if site_facturation_nom.nil?
382
+ fail ArgumentError, 'site_facturation_nom cannot be nil'
383
+ end
384
+
385
+ @site_facturation_nom = site_facturation_nom
386
+ end
387
+
388
+ # Custom attribute writer method with validation
389
+ # @param [Object] date_de_piece Value to be assigned
390
+ def date_de_piece=(date_de_piece)
391
+ if date_de_piece.nil?
392
+ fail ArgumentError, 'date_de_piece cannot be nil'
393
+ end
394
+
395
+ @date_de_piece = date_de_piece
396
+ end
397
+
398
+ # Custom attribute writer method with validation
399
+ # @param [Object] montant_ht Value to be assigned
400
+ def montant_ht=(montant_ht)
401
+ if montant_ht.nil?
402
+ fail ArgumentError, 'montant_ht cannot be nil'
403
+ end
404
+
405
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
406
+ if montant_ht !~ pattern
407
+ fail ArgumentError, "invalid value for \"montant_ht\", must conform to the pattern #{pattern}."
408
+ end
409
+
410
+ @montant_ht = montant_ht
411
+ end
412
+
413
+ # Custom attribute writer method with validation
414
+ # @param [Object] montant_tva Value to be assigned
415
+ def montant_tva=(montant_tva)
416
+ if montant_tva.nil?
417
+ fail ArgumentError, 'montant_tva cannot be nil'
418
+ end
419
+
420
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
421
+ if montant_tva !~ pattern
422
+ fail ArgumentError, "invalid value for \"montant_tva\", must conform to the pattern #{pattern}."
423
+ end
424
+
425
+ @montant_tva = montant_tva
426
+ end
427
+
428
+ # Custom attribute writer method with validation
429
+ # @param [Object] montant_ttc Value to be assigned
430
+ def montant_ttc=(montant_ttc)
431
+ if montant_ttc.nil?
432
+ fail ArgumentError, 'montant_ttc cannot be nil'
433
+ end
434
+
435
+ pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
436
+ if montant_ttc !~ pattern
437
+ fail ArgumentError, "invalid value for \"montant_ttc\", must conform to the pattern #{pattern}."
438
+ end
439
+
440
+ @montant_ttc = montant_ttc
441
+ end
442
+
443
+ # Checks equality by comparing each attribute.
444
+ # @param [Object] Object to be compared
445
+ def ==(o)
446
+ return true if self.equal?(o)
447
+ self.class == o.class &&
448
+ flow_id == o.flow_id &&
449
+ format_source == o.format_source &&
450
+ ref_fournisseur == o.ref_fournisseur &&
451
+ type_document == o.type_document &&
452
+ fournisseur == o.fournisseur &&
453
+ site_facturation_nom == o.site_facturation_nom &&
454
+ site_facturation_siret == o.site_facturation_siret &&
455
+ date_de_piece == o.date_de_piece &&
456
+ date_reglement == o.date_reglement &&
457
+ devise == o.devise &&
458
+ montant_ht == o.montant_ht &&
459
+ montant_tva == o.montant_tva &&
460
+ montant_ttc == o.montant_ttc &&
461
+ numero_bon_commande == o.numero_bon_commande &&
462
+ reference_contrat == o.reference_contrat &&
463
+ objet_facture == o.objet_facture &&
464
+ document_base64 == o.document_base64 &&
465
+ document_content_type == o.document_content_type &&
466
+ document_filename == o.document_filename
467
+ end
468
+
469
+ # @see the `==` method
470
+ # @param [Object] Object to be compared
471
+ def eql?(o)
472
+ self == o
473
+ end
474
+
475
+ # Calculates hash code according to all attributes.
476
+ # @return [Integer] Hash code
477
+ def hash
478
+ [flow_id, format_source, ref_fournisseur, type_document, fournisseur, site_facturation_nom, site_facturation_siret, date_de_piece, date_reglement, devise, montant_ht, montant_tva, montant_ttc, numero_bon_commande, reference_contrat, objet_facture, document_base64, document_content_type, document_filename].hash
479
+ end
480
+
481
+ # Builds the object from hash
482
+ # @param [Hash] attributes Model attributes in the form of hash
483
+ # @return [Object] Returns the model itself
484
+ def self.build_from_hash(attributes)
485
+ return nil unless attributes.is_a?(Hash)
486
+ attributes = attributes.transform_keys(&:to_sym)
487
+ transformed_hash = {}
488
+ openapi_types.each_pair do |key, type|
489
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
490
+ transformed_hash["#{key}"] = nil
491
+ elsif type =~ /\AArray<(.*)>/i
492
+ # check to ensure the input is an array given that the attribute
493
+ # is documented as an array but the input is not
494
+ if attributes[attribute_map[key]].is_a?(Array)
495
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
496
+ end
497
+ elsif !attributes[attribute_map[key]].nil?
498
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
499
+ end
500
+ end
501
+ new(transformed_hash)
502
+ end
503
+
504
+ # Returns the object in the form of hash
505
+ # @return [Hash] Returns the object in the form of hash
506
+ def to_hash
507
+ hash = {}
508
+ self.class.attribute_map.each_pair do |attr, param|
509
+ value = self.send(attr)
510
+ if value.nil?
511
+ is_nullable = self.class.openapi_nullable.include?(attr)
512
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
513
+ end
514
+
515
+ hash[param] = _to_hash(value)
516
+ end
517
+ hash
518
+ end
519
+
520
+ end
521
+
522
+ end
@@ -0,0 +1,41 @@
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 FormatFacture
18
+ CII = "CII".freeze
19
+ UBL = "UBL".freeze
20
+ FACTUR_X = "Factur-X".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [CII, UBL, FACTUR_X].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if FormatFacture.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #FormatFacture"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,236 @@
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
+ # Fournisseur extrait d'une facture entrante. Contrairement au modèle Fournisseur de models.py, ce modèle n'a pas de champ id_fournisseur car cette information n'est pas disponible dans les XML Factur-X/CII/UBL.
18
+ class FournisseurEntrant < ApiModelBase
19
+ # Raison sociale du fournisseur (BT-27)
20
+ attr_accessor :nom
21
+
22
+ attr_accessor :siren
23
+
24
+ attr_accessor :siret
25
+
26
+ attr_accessor :numero_tva_intra
27
+
28
+ attr_accessor :adresse_postale
29
+
30
+ attr_accessor :adresse_electronique
31
+
32
+ attr_accessor :email
33
+
34
+ attr_accessor :telephone
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'nom' => :'nom',
40
+ :'siren' => :'siren',
41
+ :'siret' => :'siret',
42
+ :'numero_tva_intra' => :'numero_tva_intra',
43
+ :'adresse_postale' => :'adresse_postale',
44
+ :'adresse_electronique' => :'adresse_electronique',
45
+ :'email' => :'email',
46
+ :'telephone' => :'telephone'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'nom' => :'String',
64
+ :'siren' => :'String',
65
+ :'siret' => :'String',
66
+ :'numero_tva_intra' => :'String',
67
+ :'adresse_postale' => :'AdressePostale',
68
+ :'adresse_electronique' => :'AdresseElectronique',
69
+ :'email' => :'String',
70
+ :'telephone' => :'String'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ :'siren',
78
+ :'siret',
79
+ :'numero_tva_intra',
80
+ :'adresse_postale',
81
+ :'adresse_electronique',
82
+ :'email',
83
+ :'telephone'
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::FournisseurEntrant` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::FournisseurEntrant`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'nom')
104
+ self.nom = attributes[:'nom']
105
+ else
106
+ self.nom = nil
107
+ end
108
+
109
+ if attributes.key?(:'siren')
110
+ self.siren = attributes[:'siren']
111
+ end
112
+
113
+ if attributes.key?(:'siret')
114
+ self.siret = attributes[:'siret']
115
+ end
116
+
117
+ if attributes.key?(:'numero_tva_intra')
118
+ self.numero_tva_intra = attributes[:'numero_tva_intra']
119
+ end
120
+
121
+ if attributes.key?(:'adresse_postale')
122
+ self.adresse_postale = attributes[:'adresse_postale']
123
+ end
124
+
125
+ if attributes.key?(:'adresse_electronique')
126
+ self.adresse_electronique = attributes[:'adresse_electronique']
127
+ end
128
+
129
+ if attributes.key?(:'email')
130
+ self.email = attributes[:'email']
131
+ end
132
+
133
+ if attributes.key?(:'telephone')
134
+ self.telephone = attributes[:'telephone']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ invalid_properties = Array.new
143
+ if @nom.nil?
144
+ invalid_properties.push('invalid value for "nom", nom cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @nom.nil?
155
+ true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] nom Value to be assigned
160
+ def nom=(nom)
161
+ if nom.nil?
162
+ fail ArgumentError, 'nom cannot be nil'
163
+ end
164
+
165
+ @nom = nom
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ nom == o.nom &&
174
+ siren == o.siren &&
175
+ siret == o.siret &&
176
+ numero_tva_intra == o.numero_tva_intra &&
177
+ adresse_postale == o.adresse_postale &&
178
+ adresse_electronique == o.adresse_electronique &&
179
+ email == o.email &&
180
+ telephone == o.telephone
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [nom, siren, siret, numero_tva_intra, adresse_postale, adresse_electronique, email, telephone].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ transformed_hash = {}
202
+ openapi_types.each_pair do |key, type|
203
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = nil
205
+ elsif type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[attribute_map[key]].is_a?(Array)
209
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
210
+ end
211
+ elsif !attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
213
+ end
214
+ end
215
+ new(transformed_hash)
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,43 @@
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 TypeDocument
18
+ N380 = "380".freeze
19
+ N381 = "381".freeze
20
+ N384 = "384".freeze
21
+ N386 = "386".freeze
22
+ N389 = "389".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [N380, N381, N384, N386, N389].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if TypeDocument.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #TypeDocument"
41
+ end
42
+ end
43
+ end
@@ -11,5 +11,5 @@ Generator version: 7.18.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module FactPulse
14
- VERSION = '2.0.30'
14
+ VERSION = '2.0.32'
15
15
  end
data/lib/factpulse.rb CHANGED
@@ -41,9 +41,12 @@ require 'factpulse/models/donnees_facture_simplifiees'
41
41
  require 'factpulse/models/error_level'
42
42
  require 'factpulse/models/error_source'
43
43
  require 'factpulse/models/facture_enrichie_info'
44
+ require 'factpulse/models/facture_entrante'
44
45
  require 'factpulse/models/facture_factur_x'
46
+ require 'factpulse/models/format_facture'
45
47
  require 'factpulse/models/format_sortie'
46
48
  require 'factpulse/models/fournisseur'
49
+ require 'factpulse/models/fournisseur_entrant'
47
50
  require 'factpulse/models/generate_certificate_request'
48
51
  require 'factpulse/models/generate_certificate_response'
49
52
  require 'factpulse/models/http_validation_error'
@@ -98,6 +101,7 @@ require 'factpulse/models/statut_facture'
98
101
  require 'factpulse/models/statut_tache'
99
102
  require 'factpulse/models/structure_info'
100
103
  require 'factpulse/models/tauxmanuel'
104
+ require 'factpulse/models/type_document'
101
105
  require 'factpulse/models/type_facture'
102
106
  require 'factpulse/models/type_tva'
103
107
  require 'factpulse/models/unite'
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.30
4
+ version: 2.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
@@ -149,9 +149,12 @@ files:
149
149
  - docs/ErrorLevel.md
150
150
  - docs/ErrorSource.md
151
151
  - docs/FactureEnrichieInfo.md
152
+ - docs/FactureEntrante.md
152
153
  - docs/FactureFacturX.md
154
+ - docs/FormatFacture.md
153
155
  - docs/FormatSortie.md
154
156
  - docs/Fournisseur.md
157
+ - docs/FournisseurEntrant.md
155
158
  - docs/GenerateCertificateRequest.md
156
159
  - docs/GenerateCertificateResponse.md
157
160
  - docs/HTTPValidationError.md
@@ -208,6 +211,7 @@ files:
208
211
  - docs/StructureInfo.md
209
212
  - docs/Tauxmanuel.md
210
213
  - docs/TraitementFactureApi.md
214
+ - docs/TypeDocument.md
211
215
  - docs/TypeFacture.md
212
216
  - docs/TypeTVA.md
213
217
  - docs/Unite.md
@@ -255,9 +259,12 @@ files:
255
259
  - lib/factpulse/models/error_level.rb
256
260
  - lib/factpulse/models/error_source.rb
257
261
  - lib/factpulse/models/facture_enrichie_info.rb
262
+ - lib/factpulse/models/facture_entrante.rb
258
263
  - lib/factpulse/models/facture_factur_x.rb
264
+ - lib/factpulse/models/format_facture.rb
259
265
  - lib/factpulse/models/format_sortie.rb
260
266
  - lib/factpulse/models/fournisseur.rb
267
+ - lib/factpulse/models/fournisseur_entrant.rb
261
268
  - lib/factpulse/models/generate_certificate_request.rb
262
269
  - lib/factpulse/models/generate_certificate_response.rb
263
270
  - lib/factpulse/models/http_validation_error.rb
@@ -312,6 +319,7 @@ files:
312
319
  - lib/factpulse/models/statut_tache.rb
313
320
  - lib/factpulse/models/structure_info.rb
314
321
  - lib/factpulse/models/tauxmanuel.rb
322
+ - lib/factpulse/models/type_document.rb
315
323
  - lib/factpulse/models/type_facture.rb
316
324
  - lib/factpulse/models/type_tva.rb
317
325
  - lib/factpulse/models/unite.rb