factpulse 3.0.32 → 3.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -17
  3. data/Gemfile.lock +1 -1
  4. data/docs/ActionCodeInfo.md +22 -0
  5. data/docs/ActionCodesResponse.md +22 -0
  6. data/docs/BodySubmitCdarApiV1CdarSubmitPost.md +20 -0
  7. data/docs/BodySubmitCdarXmlApiV1CdarSubmitXmlPost.md +20 -0
  8. data/docs/CDARCycleDeVieApi.md +489 -0
  9. data/docs/ChorusProCredentials.md +8 -8
  10. data/docs/ChorusProDestination.md +1 -1
  11. data/docs/CreateCDARRequest.md +52 -0
  12. data/docs/Encaisseamount.md +15 -0
  13. data/docs/Encaisseamount1.md +15 -0
  14. data/docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md +26 -0
  15. data/docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md +18 -0
  16. data/docs/GenerateCDARResponse.md +26 -0
  17. data/docs/GetChorusProIdRequest.md +1 -1
  18. data/docs/GetInvoiceRequest.md +1 -1
  19. data/docs/GetStructureRequest.md +1 -1
  20. data/docs/ReasonCodeInfo.md +22 -0
  21. data/docs/ReasonCodesResponse.md +22 -0
  22. data/docs/RecipientInput.md +26 -0
  23. data/docs/SearchStructureRequest.md +1 -1
  24. data/docs/StatusCodeInfo.md +22 -0
  25. data/docs/StatusCodesResponse.md +22 -0
  26. data/docs/SubmitCDARRequest.md +54 -0
  27. data/docs/SubmitCDARResponse.md +24 -0
  28. data/docs/SubmitCDARXMLRequest.md +22 -0
  29. data/docs/SubmitInvoiceRequest.md +1 -1
  30. data/docs/ValidateCDARRequest.md +32 -0
  31. data/docs/ValidateCDARResponse.md +22 -0
  32. data/docs/ValidationErrorResponse.md +8 -2
  33. data/lib/factpulse/api/cdar_cycle_de_vie_api.rb +491 -0
  34. data/lib/factpulse/helpers/client.rb +1 -1
  35. data/lib/factpulse/models/action_code_info.rb +220 -0
  36. data/lib/factpulse/models/action_codes_response.rb +207 -0
  37. data/lib/factpulse/models/body_submit_cdar_api_v1_cdar_submit_post.rb +174 -0
  38. data/lib/factpulse/models/body_submit_cdar_xml_api_v1_cdar_submit_xml_post.rb +174 -0
  39. data/lib/factpulse/models/chorus_pro_credentials.rb +26 -94
  40. data/lib/factpulse/models/chorus_pro_destination.rb +1 -1
  41. data/lib/factpulse/models/create_cdar_request.rb +414 -0
  42. data/lib/factpulse/models/encaisseamount.rb +104 -0
  43. data/lib/factpulse/models/encaisseamount1.rb +103 -0
  44. data/lib/factpulse/models/facture_electronique_rest_api_schemas_chorus_pro_chorus_pro_credentials.rb +259 -0
  45. data/lib/factpulse/models/facture_electronique_rest_api_schemas_validation_validation_error_response.rb +168 -0
  46. data/lib/factpulse/models/generate_cdar_response.rb +273 -0
  47. data/lib/factpulse/models/get_chorus_pro_id_request.rb +1 -1
  48. data/lib/factpulse/models/get_invoice_request.rb +1 -1
  49. data/lib/factpulse/models/get_structure_request.rb +1 -1
  50. data/lib/factpulse/models/reason_code_info.rb +220 -0
  51. data/lib/factpulse/models/reason_codes_response.rb +207 -0
  52. data/lib/factpulse/models/recipient_input.rb +191 -0
  53. data/lib/factpulse/models/search_structure_request.rb +1 -1
  54. data/lib/factpulse/models/status_code_info.rb +220 -0
  55. data/lib/factpulse/models/status_codes_response.rb +207 -0
  56. data/lib/factpulse/models/submit_cdar_request.rb +426 -0
  57. data/lib/factpulse/models/submit_cdar_response.rb +213 -0
  58. data/lib/factpulse/models/submit_cdarxml_request.rb +188 -0
  59. data/lib/factpulse/models/submit_invoice_request.rb +1 -1
  60. data/lib/factpulse/models/validate_cdar_request.rb +219 -0
  61. data/lib/factpulse/models/{facture_electronique_rest_api_schemas_processing_chorus_pro_credentials.rb → validate_cdar_response.rb} +47 -48
  62. data/lib/factpulse/models/validation_error_response.rb +67 -20
  63. data/lib/factpulse/version.rb +1 -1
  64. data/lib/factpulse.rb +21 -1
  65. metadata +44 -4
  66. data/docs/FactureElectroniqueRestApiSchemasProcessingChorusProCredentials.md +0 -26
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Liste des codes statut disponibles.
18
+ class StatusCodesResponse < ApiModelBase
19
+ # Liste des codes statut
20
+ attr_accessor :codes
21
+
22
+ # Nombre de codes
23
+ attr_accessor :count
24
+
25
+ # Règle source
26
+ attr_accessor :source
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'codes' => :'codes',
32
+ :'count' => :'count',
33
+ :'source' => :'source'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'codes' => :'Array<StatusCodeInfo>',
51
+ :'count' => :'Integer',
52
+ :'source' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
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::StatusCodesResponse` 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::StatusCodesResponse`. 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?(:'codes')
79
+ if (value = attributes[:'codes']).is_a?(Array)
80
+ self.codes = value
81
+ end
82
+ else
83
+ self.codes = nil
84
+ end
85
+
86
+ if attributes.key?(:'count')
87
+ self.count = attributes[:'count']
88
+ else
89
+ self.count = nil
90
+ end
91
+
92
+ if attributes.key?(:'source')
93
+ self.source = attributes[:'source']
94
+ else
95
+ self.source = 'BR-FR-CDV-CL-06'
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @codes.nil?
105
+ invalid_properties.push('invalid value for "codes", codes cannot be nil.')
106
+ end
107
+
108
+ if @count.nil?
109
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ warn '[DEPRECATED] the `valid?` method is obsolete'
119
+ return false if @codes.nil?
120
+ return false if @count.nil?
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method with validation
125
+ # @param [Object] codes Value to be assigned
126
+ def codes=(codes)
127
+ if codes.nil?
128
+ fail ArgumentError, 'codes cannot be nil'
129
+ end
130
+
131
+ @codes = codes
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] count Value to be assigned
136
+ def count=(count)
137
+ if count.nil?
138
+ fail ArgumentError, 'count cannot be nil'
139
+ end
140
+
141
+ @count = count
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ codes == o.codes &&
150
+ count == o.count &&
151
+ source == o.source
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [codes, count, source].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ transformed_hash = {}
173
+ openapi_types.each_pair do |key, type|
174
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = nil
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[attribute_map[key]].is_a?(Array)
180
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
181
+ end
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
184
+ end
185
+ end
186
+ new(transformed_hash)
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,426 @@
1
+ =begin
2
+ #FactPulse REST API
3
+
4
+ # REST API for electronic invoicing in France: Factur-X, AFNOR PDP/PA, electronic signatures. ## 🎯 Main Features ### 📄 Factur-X Invoice Generation - **Formats**: XML only or PDF/A-3 with embedded XML - **Profiles**: MINIMUM, BASIC, EN16931, EXTENDED - **Standards**: EN 16931 (EU directive 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Simplified Format**: Generation from SIRET + auto-enrichment (Chorus Pro API + Business Search) ### ✅ Validation and Compliance - **XML Validation**: Schematron (45 to 210+ rules depending on profile) - **PDF Validation**: PDF/A-3, Factur-X XMP metadata, electronic signatures - **VeraPDF**: Strict PDF/A validation (146+ ISO 19005-3 rules) - **Asynchronous Processing**: Celery support for heavy validations (VeraPDF) ### 📡 AFNOR PDP/PA Integration (XP Z12-013) - **Flow Submission**: Send invoices to Partner Dematerialization Platforms - **Flow Search**: View submitted invoices - **Download**: Retrieve PDF/A-3 with XML - **Directory Service**: Company search (SIREN/SIRET) - **Multi-client**: Support for multiple PDP configs per user (stored credentials or zero-storage) ### ✍️ PDF Electronic Signature - **Standards**: PAdES-B-B, PAdES-B-T (RFC 3161 timestamping), PAdES-B-LT (long-term archival) - **eIDAS Levels**: SES (self-signed), AdES (commercial CA), QES (QTSP) - **Validation**: Cryptographic integrity and certificate verification - **Certificate Generation**: Self-signed X.509 certificates for testing ### 🔄 Asynchronous Processing - **Celery**: Asynchronous generation, validation and signing - **Polling**: Status tracking via `/tasks/{task_id}/status` - **No timeout**: Ideal for large files or heavy validations ## 🔒 Authentication All requests require a **JWT token** in the Authorization header: ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### How to obtain a JWT token? #### 🔑 Method 1: `/api/token/` API (Recommended) **URL:** `https://factpulse.fr/api/token/` This method is **recommended** for integration in your applications and CI/CD workflows. **Prerequisites:** Having set a password on your account **For users registered via email/password:** - You already have a password, use it directly **For users registered via OAuth (Google/GitHub):** - You must first set a password at: https://factpulse.fr/accounts/password/set/ - Once the password is created, you can use the API **Request example:** ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\" }' ``` **Optional `client_uid` parameter:** To select credentials for a specific client (PA/PDP, Chorus Pro, signing certificates), add `client_uid`: ```bash curl -X POST https://factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"your_email@example.com\", \"password\": \"your_password\", \"client_uid\": \"550e8400-e29b-41d4-a716-446655440000\" }' ``` The `client_uid` will be included in the JWT and allow the API to automatically use: - AFNOR/PDP credentials configured for this client - Chorus Pro credentials configured for this client - Electronic signature certificates configured for this client **Response:** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Access token (validity: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Refresh token (validity: 7 days) } ``` **Advantages:** - ✅ Full automation (CI/CD, scripts) - ✅ Programmatic token management - ✅ Refresh token support for automatic access renewal - ✅ Easy integration in any language/tool #### 🖥️ Method 2: Dashboard Generation (Alternative) **URL:** https://factpulse.fr/api/dashboard/ This method is suitable for quick tests or occasional use via the graphical interface. **How it works:** - Log in to the dashboard - Use the \"Generate Test Token\" or \"Generate Production Token\" buttons - Works for **all** users (OAuth and email/password), without requiring a password **Token types:** - **Test Token**: 24h validity, 1000 calls/day quota (free) - **Production Token**: 7 days validity, quota based on your plan **Advantages:** - ✅ Quick for API testing - ✅ No password required - ✅ Simple visual interface **Disadvantages:** - ❌ Requires manual action - ❌ No refresh token - ❌ Less suited for automation ### 📚 Full Documentation For more information on authentication and API usage: https://factpulse.fr/documentation-api/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: contact@factpulse.fr
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FactPulse
17
+ # Requête de soumission CDAR (génération + envoi).
18
+ class SubmitCDARRequest < ApiModelBase
19
+ # Identifiant unique du message CDAR
20
+ attr_accessor :document_id
21
+
22
+ # Code processus métier (REGULATED, B2C, B2BINT, etc.)
23
+ attr_accessor :business_process
24
+
25
+ # Type de message (23=Traitement, 305=Transmission)
26
+ attr_accessor :type_code
27
+
28
+ # SIREN de l'émetteur (9 chiffres)
29
+ attr_accessor :sender_siren
30
+
31
+ # Rôle de l'émetteur (WK, SE, BY, etc.)
32
+ attr_accessor :sender_role
33
+
34
+ attr_accessor :sender_name
35
+
36
+ attr_accessor :sender_email
37
+
38
+ # Liste des destinataires
39
+ attr_accessor :recipients
40
+
41
+ # Identifiant de la facture (BT-1)
42
+ attr_accessor :invoice_id
43
+
44
+ # Date d'émission de la facture (YYYY-MM-DD)
45
+ attr_accessor :invoice_issue_date
46
+
47
+ # Type de document (380=Facture, 381=Avoir)
48
+ attr_accessor :invoice_type_code
49
+
50
+ attr_accessor :invoice_seller_siren
51
+
52
+ attr_accessor :invoice_buyer_siren
53
+
54
+ # Code statut de la facture (200-601)
55
+ attr_accessor :status
56
+
57
+ attr_accessor :reason_code
58
+
59
+ attr_accessor :reason_text
60
+
61
+ attr_accessor :action_code
62
+
63
+ attr_accessor :encaisse_amount
64
+
65
+ # Type de flux AFNOR (CustomerInvoiceLC, SupplierInvoiceLC, etc.)
66
+ attr_accessor :flow_type
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'document_id' => :'documentId',
72
+ :'business_process' => :'businessProcess',
73
+ :'type_code' => :'typeCode',
74
+ :'sender_siren' => :'senderSiren',
75
+ :'sender_role' => :'senderRole',
76
+ :'sender_name' => :'senderName',
77
+ :'sender_email' => :'senderEmail',
78
+ :'recipients' => :'recipients',
79
+ :'invoice_id' => :'invoiceId',
80
+ :'invoice_issue_date' => :'invoiceIssueDate',
81
+ :'invoice_type_code' => :'invoiceTypeCode',
82
+ :'invoice_seller_siren' => :'invoiceSellerSiren',
83
+ :'invoice_buyer_siren' => :'invoiceBuyerSiren',
84
+ :'status' => :'status',
85
+ :'reason_code' => :'reasonCode',
86
+ :'reason_text' => :'reasonText',
87
+ :'action_code' => :'actionCode',
88
+ :'encaisse_amount' => :'encaisseAmount',
89
+ :'flow_type' => :'flowType'
90
+ }
91
+ end
92
+
93
+ # Returns attribute mapping this model knows about
94
+ def self.acceptable_attribute_map
95
+ attribute_map
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ acceptable_attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'document_id' => :'String',
107
+ :'business_process' => :'String',
108
+ :'type_code' => :'String',
109
+ :'sender_siren' => :'String',
110
+ :'sender_role' => :'String',
111
+ :'sender_name' => :'String',
112
+ :'sender_email' => :'String',
113
+ :'recipients' => :'Array<RecipientInput>',
114
+ :'invoice_id' => :'String',
115
+ :'invoice_issue_date' => :'Date',
116
+ :'invoice_type_code' => :'String',
117
+ :'invoice_seller_siren' => :'String',
118
+ :'invoice_buyer_siren' => :'String',
119
+ :'status' => :'String',
120
+ :'reason_code' => :'String',
121
+ :'reason_text' => :'String',
122
+ :'action_code' => :'String',
123
+ :'encaisse_amount' => :'Encaisseamount',
124
+ :'flow_type' => :'String'
125
+ }
126
+ end
127
+
128
+ # List of attributes with nullable: true
129
+ def self.openapi_nullable
130
+ Set.new([
131
+ :'sender_name',
132
+ :'sender_email',
133
+ :'invoice_seller_siren',
134
+ :'invoice_buyer_siren',
135
+ :'reason_code',
136
+ :'reason_text',
137
+ :'action_code',
138
+ :'encaisse_amount',
139
+ ])
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::SubmitCDARRequest` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ acceptable_attribute_map = self.class.acceptable_attribute_map
151
+ attributes = attributes.each_with_object({}) { |(k, v), h|
152
+ if (!acceptable_attribute_map.key?(k.to_sym))
153
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::SubmitCDARRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
154
+ end
155
+ h[k.to_sym] = v
156
+ }
157
+
158
+ if attributes.key?(:'document_id')
159
+ self.document_id = attributes[:'document_id']
160
+ else
161
+ self.document_id = nil
162
+ end
163
+
164
+ if attributes.key?(:'business_process')
165
+ self.business_process = attributes[:'business_process']
166
+ else
167
+ self.business_process = 'REGULATED'
168
+ end
169
+
170
+ if attributes.key?(:'type_code')
171
+ self.type_code = attributes[:'type_code']
172
+ else
173
+ self.type_code = '23'
174
+ end
175
+
176
+ if attributes.key?(:'sender_siren')
177
+ self.sender_siren = attributes[:'sender_siren']
178
+ else
179
+ self.sender_siren = nil
180
+ end
181
+
182
+ if attributes.key?(:'sender_role')
183
+ self.sender_role = attributes[:'sender_role']
184
+ else
185
+ self.sender_role = 'WK'
186
+ end
187
+
188
+ if attributes.key?(:'sender_name')
189
+ self.sender_name = attributes[:'sender_name']
190
+ end
191
+
192
+ if attributes.key?(:'sender_email')
193
+ self.sender_email = attributes[:'sender_email']
194
+ end
195
+
196
+ if attributes.key?(:'recipients')
197
+ if (value = attributes[:'recipients']).is_a?(Array)
198
+ self.recipients = value
199
+ end
200
+ end
201
+
202
+ if attributes.key?(:'invoice_id')
203
+ self.invoice_id = attributes[:'invoice_id']
204
+ else
205
+ self.invoice_id = nil
206
+ end
207
+
208
+ if attributes.key?(:'invoice_issue_date')
209
+ self.invoice_issue_date = attributes[:'invoice_issue_date']
210
+ else
211
+ self.invoice_issue_date = nil
212
+ end
213
+
214
+ if attributes.key?(:'invoice_type_code')
215
+ self.invoice_type_code = attributes[:'invoice_type_code']
216
+ else
217
+ self.invoice_type_code = '380'
218
+ end
219
+
220
+ if attributes.key?(:'invoice_seller_siren')
221
+ self.invoice_seller_siren = attributes[:'invoice_seller_siren']
222
+ end
223
+
224
+ if attributes.key?(:'invoice_buyer_siren')
225
+ self.invoice_buyer_siren = attributes[:'invoice_buyer_siren']
226
+ end
227
+
228
+ if attributes.key?(:'status')
229
+ self.status = attributes[:'status']
230
+ else
231
+ self.status = nil
232
+ end
233
+
234
+ if attributes.key?(:'reason_code')
235
+ self.reason_code = attributes[:'reason_code']
236
+ end
237
+
238
+ if attributes.key?(:'reason_text')
239
+ self.reason_text = attributes[:'reason_text']
240
+ end
241
+
242
+ if attributes.key?(:'action_code')
243
+ self.action_code = attributes[:'action_code']
244
+ end
245
+
246
+ if attributes.key?(:'encaisse_amount')
247
+ self.encaisse_amount = attributes[:'encaisse_amount']
248
+ end
249
+
250
+ if attributes.key?(:'flow_type')
251
+ self.flow_type = attributes[:'flow_type']
252
+ else
253
+ self.flow_type = 'CustomerInvoiceLC'
254
+ end
255
+ end
256
+
257
+ # Show invalid properties with the reasons. Usually used together with valid?
258
+ # @return Array for valid properties with the reasons
259
+ def list_invalid_properties
260
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
261
+ invalid_properties = Array.new
262
+ if @document_id.nil?
263
+ invalid_properties.push('invalid value for "document_id", document_id cannot be nil.')
264
+ end
265
+
266
+ if @sender_siren.nil?
267
+ invalid_properties.push('invalid value for "sender_siren", sender_siren cannot be nil.')
268
+ end
269
+
270
+ if @invoice_id.nil?
271
+ invalid_properties.push('invalid value for "invoice_id", invoice_id cannot be nil.')
272
+ end
273
+
274
+ if @invoice_issue_date.nil?
275
+ invalid_properties.push('invalid value for "invoice_issue_date", invoice_issue_date cannot be nil.')
276
+ end
277
+
278
+ if @status.nil?
279
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
280
+ end
281
+
282
+ invalid_properties
283
+ end
284
+
285
+ # Check to see if the all the properties in the model are valid
286
+ # @return true if the model is valid
287
+ def valid?
288
+ warn '[DEPRECATED] the `valid?` method is obsolete'
289
+ return false if @document_id.nil?
290
+ return false if @sender_siren.nil?
291
+ return false if @invoice_id.nil?
292
+ return false if @invoice_issue_date.nil?
293
+ return false if @status.nil?
294
+ true
295
+ end
296
+
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] document_id Value to be assigned
299
+ def document_id=(document_id)
300
+ if document_id.nil?
301
+ fail ArgumentError, 'document_id cannot be nil'
302
+ end
303
+
304
+ @document_id = document_id
305
+ end
306
+
307
+ # Custom attribute writer method with validation
308
+ # @param [Object] sender_siren Value to be assigned
309
+ def sender_siren=(sender_siren)
310
+ if sender_siren.nil?
311
+ fail ArgumentError, 'sender_siren cannot be nil'
312
+ end
313
+
314
+ @sender_siren = sender_siren
315
+ end
316
+
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] invoice_id Value to be assigned
319
+ def invoice_id=(invoice_id)
320
+ if invoice_id.nil?
321
+ fail ArgumentError, 'invoice_id cannot be nil'
322
+ end
323
+
324
+ @invoice_id = invoice_id
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] invoice_issue_date Value to be assigned
329
+ def invoice_issue_date=(invoice_issue_date)
330
+ if invoice_issue_date.nil?
331
+ fail ArgumentError, 'invoice_issue_date cannot be nil'
332
+ end
333
+
334
+ @invoice_issue_date = invoice_issue_date
335
+ end
336
+
337
+ # Custom attribute writer method with validation
338
+ # @param [Object] status Value to be assigned
339
+ def status=(status)
340
+ if status.nil?
341
+ fail ArgumentError, 'status cannot be nil'
342
+ end
343
+
344
+ @status = status
345
+ end
346
+
347
+ # Checks equality by comparing each attribute.
348
+ # @param [Object] Object to be compared
349
+ def ==(o)
350
+ return true if self.equal?(o)
351
+ self.class == o.class &&
352
+ document_id == o.document_id &&
353
+ business_process == o.business_process &&
354
+ type_code == o.type_code &&
355
+ sender_siren == o.sender_siren &&
356
+ sender_role == o.sender_role &&
357
+ sender_name == o.sender_name &&
358
+ sender_email == o.sender_email &&
359
+ recipients == o.recipients &&
360
+ invoice_id == o.invoice_id &&
361
+ invoice_issue_date == o.invoice_issue_date &&
362
+ invoice_type_code == o.invoice_type_code &&
363
+ invoice_seller_siren == o.invoice_seller_siren &&
364
+ invoice_buyer_siren == o.invoice_buyer_siren &&
365
+ status == o.status &&
366
+ reason_code == o.reason_code &&
367
+ reason_text == o.reason_text &&
368
+ action_code == o.action_code &&
369
+ encaisse_amount == o.encaisse_amount &&
370
+ flow_type == o.flow_type
371
+ end
372
+
373
+ # @see the `==` method
374
+ # @param [Object] Object to be compared
375
+ def eql?(o)
376
+ self == o
377
+ end
378
+
379
+ # Calculates hash code according to all attributes.
380
+ # @return [Integer] Hash code
381
+ def hash
382
+ [document_id, business_process, type_code, sender_siren, sender_role, sender_name, sender_email, recipients, invoice_id, invoice_issue_date, invoice_type_code, invoice_seller_siren, invoice_buyer_siren, status, reason_code, reason_text, action_code, encaisse_amount, flow_type].hash
383
+ end
384
+
385
+ # Builds the object from hash
386
+ # @param [Hash] attributes Model attributes in the form of hash
387
+ # @return [Object] Returns the model itself
388
+ def self.build_from_hash(attributes)
389
+ return nil unless attributes.is_a?(Hash)
390
+ attributes = attributes.transform_keys(&:to_sym)
391
+ transformed_hash = {}
392
+ openapi_types.each_pair do |key, type|
393
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
394
+ transformed_hash["#{key}"] = nil
395
+ elsif type =~ /\AArray<(.*)>/i
396
+ # check to ensure the input is an array given that the attribute
397
+ # is documented as an array but the input is not
398
+ if attributes[attribute_map[key]].is_a?(Array)
399
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
400
+ end
401
+ elsif !attributes[attribute_map[key]].nil?
402
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
403
+ end
404
+ end
405
+ new(transformed_hash)
406
+ end
407
+
408
+ # Returns the object in the form of hash
409
+ # @return [Hash] Returns the object in the form of hash
410
+ def to_hash
411
+ hash = {}
412
+ self.class.attribute_map.each_pair do |attr, param|
413
+ value = self.send(attr)
414
+ if value.nil?
415
+ is_nullable = self.class.openapi_nullable.include?(attr)
416
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
417
+ end
418
+
419
+ hash[param] = _to_hash(value)
420
+ end
421
+ hash
422
+ end
423
+
424
+ end
425
+
426
+ end