conekta 7.0.1 → 7.0.2

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -8
  3. data/VERSION +1 -1
  4. data/config-ruby.json +1 -1
  5. data/docs/ChargesApi.md +2 -2
  6. data/docs/CheckoutRequest.md +1 -1
  7. data/docs/CompaniesApi.md +296 -0
  8. data/docs/CompanyDocumentRequest.md +26 -0
  9. data/docs/CompanyDocumentResponse.md +22 -0
  10. data/docs/CompanyResponse.md +18 -16
  11. data/docs/CompanyResponseDocumentsInner.md +22 -0
  12. data/docs/CreateCompanyRequest.md +26 -0
  13. data/docs/CreateCompanyRequestBankAccountInfo.md +18 -0
  14. data/docs/CreateCompanyRequestComercialInfo.md +24 -0
  15. data/docs/CreateCompanyRequestFiscalInfo.md +20 -0
  16. data/docs/PaymentMethodBnplRequest.md +1 -1
  17. data/docs/PaymentMethodSpeiRecurrent.md +2 -0
  18. data/examples/README.md +15 -0
  19. data/examples/one_time_charge_bnpl.rb +46 -0
  20. data/lib/conekta/api/companies_api.rb +300 -0
  21. data/lib/conekta/models/company_document_request.rb +318 -0
  22. data/lib/conekta/models/company_document_response.rb +291 -0
  23. data/lib/conekta/models/company_response.rb +110 -74
  24. data/lib/conekta/models/company_response_documents_inner.rb +270 -0
  25. data/lib/conekta/models/create_company_request.rb +252 -0
  26. data/lib/conekta/models/create_company_request_bank_account_info.rb +216 -0
  27. data/lib/conekta/models/create_company_request_comercial_info.rb +246 -0
  28. data/lib/conekta/models/create_company_request_fiscal_info.rb +226 -0
  29. data/lib/conekta/models/payment_method_bnpl_request.rb +2 -2
  30. data/lib/conekta/models/payment_method_spei_recurrent.rb +11 -1
  31. data/lib/conekta/version.rb +1 -1
  32. data/lib/conekta.rb +7 -3
  33. data/spec/api/companies_api_spec.rb +53 -0
  34. metadata +35 -22
  35. data/docs/CompanyFiscalInfoAddressResponse.md +0 -34
  36. data/docs/CompanyFiscalInfoResponse.md +0 -30
  37. data/docs/CompanyPayoutDestinationResponse.md +0 -28
@@ -14,63 +14,46 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Conekta
17
- # Company model
18
17
  class CompanyResponse
19
- # The child company's unique identifier
18
+ # The unique identifier for the company.
20
19
  attr_accessor :id
21
20
 
22
- # The resource's creation date (unix timestamp)
23
- attr_accessor :created_at
24
-
25
- # The child company's name
21
+ # The name of the company.
26
22
  attr_accessor :name
27
23
 
28
- # The resource's type
29
- attr_accessor :object
30
-
31
- # Id of the parent company
32
- attr_accessor :parent_company_id
24
+ # Indicates if the company is active.
25
+ attr_accessor :active
33
26
 
34
- # Whether the parent company's fiscal data is to be used for liquidation and tax purposes
35
- attr_accessor :use_parent_fiscal_data
27
+ # The current status of the company's account.
28
+ attr_accessor :account_status
36
29
 
37
- attr_accessor :payout_destination
30
+ # The identifier of the parent company, if any.
31
+ attr_accessor :parent_company_id
38
32
 
39
- attr_accessor :fiscal_info
33
+ # The current status of the company's onboarding process.
34
+ attr_accessor :onboarding_status
40
35
 
41
- class EnumAttributeValidator
42
- attr_reader :datatype
43
- attr_reader :allowable_values
36
+ # A list of documents related to the company.
37
+ attr_accessor :documents
44
38
 
45
- def initialize(datatype, allowable_values)
46
- @allowable_values = allowable_values.map do |value|
47
- case datatype.to_s
48
- when /Integer/i
49
- value.to_i
50
- when /Float/i
51
- value.to_f
52
- else
53
- value
54
- end
55
- end
56
- end
39
+ # Timestamp of when the company was created.
40
+ attr_accessor :created_at
57
41
 
58
- def valid?(value)
59
- !value || allowable_values.include?(value)
60
- end
61
- end
42
+ # The type of object, typically \"company\".
43
+ attr_accessor :object
62
44
 
63
45
  # Attribute mapping from ruby-style variable name to JSON key.
64
46
  def self.attribute_map
65
47
  {
66
48
  :'id' => :'id',
67
- :'created_at' => :'created_at',
68
49
  :'name' => :'name',
69
- :'object' => :'object',
50
+ :'active' => :'active',
51
+ :'account_status' => :'account_status',
70
52
  :'parent_company_id' => :'parent_company_id',
71
- :'use_parent_fiscal_data' => :'use_parent_fiscal_data',
72
- :'payout_destination' => :'payout_destination',
73
- :'fiscal_info' => :'fiscal_info'
53
+ :'onboarding_status' => :'onboarding_status',
54
+ :'documents' => :'documents',
55
+ :'created_at' => :'created_at',
56
+ :'object' => :'object'
74
57
  }
75
58
  end
76
59
 
@@ -83,19 +66,21 @@ module Conekta
83
66
  def self.openapi_types
84
67
  {
85
68
  :'id' => :'String',
86
- :'created_at' => :'Integer',
87
69
  :'name' => :'String',
88
- :'object' => :'String',
70
+ :'active' => :'Boolean',
71
+ :'account_status' => :'String',
89
72
  :'parent_company_id' => :'String',
90
- :'use_parent_fiscal_data' => :'Boolean',
91
- :'payout_destination' => :'CompanyPayoutDestinationResponse',
92
- :'fiscal_info' => :'CompanyFiscalInfoResponse'
73
+ :'onboarding_status' => :'String',
74
+ :'documents' => :'Array<CompanyResponseDocumentsInner>',
75
+ :'created_at' => :'Integer',
76
+ :'object' => :'String'
93
77
  }
94
78
  end
95
79
 
96
80
  # List of attributes with nullable: true
97
81
  def self.openapi_nullable
98
82
  Set.new([
83
+ :'parent_company_id',
99
84
  ])
100
85
  end
101
86
 
@@ -116,34 +101,56 @@ module Conekta
116
101
 
117
102
  if attributes.key?(:'id')
118
103
  self.id = attributes[:'id']
119
- end
120
-
121
- if attributes.key?(:'created_at')
122
- self.created_at = attributes[:'created_at']
104
+ else
105
+ self.id = nil
123
106
  end
124
107
 
125
108
  if attributes.key?(:'name')
126
109
  self.name = attributes[:'name']
110
+ else
111
+ self.name = nil
127
112
  end
128
113
 
129
- if attributes.key?(:'object')
130
- self.object = attributes[:'object']
114
+ if attributes.key?(:'active')
115
+ self.active = attributes[:'active']
116
+ else
117
+ self.active = nil
118
+ end
119
+
120
+ if attributes.key?(:'account_status')
121
+ self.account_status = attributes[:'account_status']
122
+ else
123
+ self.account_status = nil
131
124
  end
132
125
 
133
126
  if attributes.key?(:'parent_company_id')
134
127
  self.parent_company_id = attributes[:'parent_company_id']
135
128
  end
136
129
 
137
- if attributes.key?(:'use_parent_fiscal_data')
138
- self.use_parent_fiscal_data = attributes[:'use_parent_fiscal_data']
130
+ if attributes.key?(:'onboarding_status')
131
+ self.onboarding_status = attributes[:'onboarding_status']
132
+ else
133
+ self.onboarding_status = nil
139
134
  end
140
135
 
141
- if attributes.key?(:'payout_destination')
142
- self.payout_destination = attributes[:'payout_destination']
136
+ if attributes.key?(:'documents')
137
+ if (value = attributes[:'documents']).is_a?(Array)
138
+ self.documents = value
139
+ end
140
+ else
141
+ self.documents = nil
143
142
  end
144
143
 
145
- if attributes.key?(:'fiscal_info')
146
- self.fiscal_info = attributes[:'fiscal_info']
144
+ if attributes.key?(:'created_at')
145
+ self.created_at = attributes[:'created_at']
146
+ else
147
+ self.created_at = nil
148
+ end
149
+
150
+ if attributes.key?(:'object')
151
+ self.object = attributes[:'object']
152
+ else
153
+ self.object = nil
147
154
  end
148
155
  end
149
156
 
@@ -152,6 +159,38 @@ module Conekta
152
159
  def list_invalid_properties
153
160
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
154
161
  invalid_properties = Array.new
162
+ if @id.nil?
163
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
164
+ end
165
+
166
+ if @name.nil?
167
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
168
+ end
169
+
170
+ if @active.nil?
171
+ invalid_properties.push('invalid value for "active", active cannot be nil.')
172
+ end
173
+
174
+ if @account_status.nil?
175
+ invalid_properties.push('invalid value for "account_status", account_status cannot be nil.')
176
+ end
177
+
178
+ if @onboarding_status.nil?
179
+ invalid_properties.push('invalid value for "onboarding_status", onboarding_status cannot be nil.')
180
+ end
181
+
182
+ if @documents.nil?
183
+ invalid_properties.push('invalid value for "documents", documents cannot be nil.')
184
+ end
185
+
186
+ if @created_at.nil?
187
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
188
+ end
189
+
190
+ if @object.nil?
191
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
192
+ end
193
+
155
194
  invalid_properties
156
195
  end
157
196
 
@@ -159,34 +198,31 @@ module Conekta
159
198
  # @return true if the model is valid
160
199
  def valid?
161
200
  warn '[DEPRECATED] the `valid?` method is obsolete'
162
- object_validator = EnumAttributeValidator.new('String', ["company"])
163
- return false unless object_validator.valid?(@object)
201
+ return false if @id.nil?
202
+ return false if @name.nil?
203
+ return false if @active.nil?
204
+ return false if @account_status.nil?
205
+ return false if @onboarding_status.nil?
206
+ return false if @documents.nil?
207
+ return false if @created_at.nil?
208
+ return false if @object.nil?
164
209
  true
165
210
  end
166
211
 
167
- # Custom attribute writer method checking allowed values (enum).
168
- # @param [Object] object Object to be assigned
169
- def object=(object)
170
- validator = EnumAttributeValidator.new('String', ["company"])
171
- unless validator.valid?(object)
172
- fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
173
- end
174
- @object = object
175
- end
176
-
177
212
  # Checks equality by comparing each attribute.
178
213
  # @param [Object] Object to be compared
179
214
  def ==(o)
180
215
  return true if self.equal?(o)
181
216
  self.class == o.class &&
182
217
  id == o.id &&
183
- created_at == o.created_at &&
184
218
  name == o.name &&
185
- object == o.object &&
219
+ active == o.active &&
220
+ account_status == o.account_status &&
186
221
  parent_company_id == o.parent_company_id &&
187
- use_parent_fiscal_data == o.use_parent_fiscal_data &&
188
- payout_destination == o.payout_destination &&
189
- fiscal_info == o.fiscal_info
222
+ onboarding_status == o.onboarding_status &&
223
+ documents == o.documents &&
224
+ created_at == o.created_at &&
225
+ object == o.object
190
226
  end
191
227
 
192
228
  # @see the `==` method
@@ -198,7 +234,7 @@ module Conekta
198
234
  # Calculates hash code according to all attributes.
199
235
  # @return [Integer] Hash code
200
236
  def hash
201
- [id, created_at, name, object, parent_company_id, use_parent_fiscal_data, payout_destination, fiscal_info].hash
237
+ [id, name, active, account_status, parent_company_id, onboarding_status, documents, created_at, object].hash
202
238
  end
203
239
 
204
240
  # Builds the object from hash
@@ -0,0 +1,270 @@
1
+ =begin
2
+ #Conekta API
3
+
4
+ #Conekta sdk
5
+
6
+ The version of the OpenAPI document: 2.2.0
7
+ Contact: engineering@conekta.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Conekta
17
+ class CompanyResponseDocumentsInner
18
+ # Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) |
19
+ attr_accessor :file_classification
20
+
21
+ # The status of the document.
22
+ attr_accessor :status
23
+
24
+ # The name of the file.
25
+ attr_accessor :file_name
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'file_classification' => :'file_classification',
53
+ :'status' => :'status',
54
+ :'file_name' => :'file_name'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'file_classification' => :'String',
67
+ :'status' => :'String',
68
+ :'file_name' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :'file_name'
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CompanyResponseDocumentsInner` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CompanyResponseDocumentsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'file_classification')
95
+ self.file_classification = attributes[:'file_classification']
96
+ end
97
+
98
+ if attributes.key?(:'status')
99
+ self.status = attributes[:'status']
100
+ end
101
+
102
+ if attributes.key?(:'file_name')
103
+ self.file_name = attributes[:'file_name']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
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
+ file_classification_validator = EnumAttributeValidator.new('String', ["id_legal_representative", "id_legal_representative_back", "cfdi", "constitutive_act_basic", "proof_of_address", "power_of_attonery", "deposit_account_cover", "permit_casino", "license_sanitation", "registration_tourism"])
120
+ return false unless file_classification_validator.valid?(@file_classification)
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method checking allowed values (enum).
125
+ # @param [Object] file_classification Object to be assigned
126
+ def file_classification=(file_classification)
127
+ validator = EnumAttributeValidator.new('String', ["id_legal_representative", "id_legal_representative_back", "cfdi", "constitutive_act_basic", "proof_of_address", "power_of_attonery", "deposit_account_cover", "permit_casino", "license_sanitation", "registration_tourism"])
128
+ unless validator.valid?(file_classification)
129
+ fail ArgumentError, "invalid value for \"file_classification\", must be one of #{validator.allowable_values}."
130
+ end
131
+ @file_classification = file_classification
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ file_classification == o.file_classification &&
140
+ status == o.status &&
141
+ file_name == o.file_name
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [file_classification, status, file_name].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ transformed_hash = {}
163
+ openapi_types.each_pair do |key, type|
164
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = nil
166
+ elsif type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[attribute_map[key]].is_a?(Array)
170
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
171
+ end
172
+ elsif !attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
174
+ end
175
+ end
176
+ new(transformed_hash)
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def self._deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = Conekta.const_get(type)
218
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end