conekta 7.0.1 → 7.0.3

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -8
  3. data/VERSION +1 -1
  4. data/config-ruby.json +1 -1
  5. data/docs/ChargeOrderResponsePaymentMethod.md +5 -2
  6. data/docs/ChargeRequestPaymentMethod.md +3 -1
  7. data/docs/ChargeResponsePaymentMethod.md +5 -2
  8. data/docs/ChargesApi.md +2 -2
  9. data/docs/CheckoutRequest.md +1 -1
  10. data/docs/CompaniesApi.md +296 -0
  11. data/docs/CompanyDocumentRequest.md +26 -0
  12. data/docs/CompanyDocumentResponse.md +22 -0
  13. data/docs/CompanyResponse.md +18 -16
  14. data/docs/CompanyResponseDocumentsInner.md +22 -0
  15. data/docs/CreateCompanyRequest.md +26 -0
  16. data/docs/CreateCompanyRequestBankAccountInfo.md +18 -0
  17. data/docs/CreateCompanyRequestComercialInfo.md +24 -0
  18. data/docs/CreateCompanyRequestFiscalInfo.md +20 -0
  19. data/docs/CreateCustomerPaymentMethodsResponse.md +3 -2
  20. data/docs/CustomerPaymentMethodRequest.md +1 -1
  21. data/docs/CustomerPaymentMethodsData.md +3 -2
  22. data/docs/EventsResendResponse.md +1 -1
  23. data/docs/GetCustomerPaymentMethodDataResponse.md +3 -2
  24. data/docs/OrderResponseCheckout.md +1 -1
  25. data/docs/PaymentMethodBnplRequest.md +1 -1
  26. data/docs/PaymentMethodCardRequest.md +1 -1
  27. data/docs/PaymentMethodCashRecurrentResponse.md +38 -0
  28. data/docs/PaymentMethodCashRequest.md +1 -1
  29. data/docs/PaymentMethodPbbPayment.md +30 -0
  30. data/docs/PaymentMethodPbbRequest.md +22 -0
  31. data/docs/PaymentMethodSpeiRecurrent.md +2 -0
  32. data/docs/PaymentMethodSpeiRequest.md +1 -1
  33. data/docs/PaymentMethodTokenRequest.md +1 -1
  34. data/docs/PaymentMethodsApi.md +1 -1
  35. data/docs/UpdateCustomerPaymentMethodsResponse.md +3 -2
  36. data/docs/UpdatePaymentMethods.md +4 -2
  37. data/docs/WebhookLog.md +1 -1
  38. data/docs/WebhookResponse.md +1 -1
  39. data/examples/README.md +15 -0
  40. data/examples/one_time_charge_bnpl.rb +49 -0
  41. data/examples/one_time_charge_pbb.rb +47 -0
  42. data/lib/conekta/api/companies_api.rb +300 -0
  43. data/lib/conekta/models/charge_order_response_payment_method.rb +4 -2
  44. data/lib/conekta/models/charge_request_payment_method.rb +2 -1
  45. data/lib/conekta/models/charge_response_payment_method.rb +4 -2
  46. data/lib/conekta/models/company_document_request.rb +318 -0
  47. data/lib/conekta/models/company_document_response.rb +291 -0
  48. data/lib/conekta/models/company_response.rb +110 -74
  49. data/lib/conekta/models/company_response_documents_inner.rb +270 -0
  50. data/lib/conekta/models/create_company_request.rb +252 -0
  51. data/lib/conekta/models/create_company_request_bank_account_info.rb +216 -0
  52. data/lib/conekta/models/create_company_request_comercial_info.rb +246 -0
  53. data/lib/conekta/models/create_company_request_fiscal_info.rb +226 -0
  54. data/lib/conekta/models/create_customer_payment_methods_response.rb +2 -2
  55. data/lib/conekta/models/customer_payment_methods_data.rb +2 -2
  56. data/lib/conekta/models/get_customer_payment_method_data_response.rb +2 -2
  57. data/lib/conekta/models/payment_method_bnpl_request.rb +2 -2
  58. data/lib/conekta/models/payment_method_cash_recurrent_response.rb +343 -0
  59. data/lib/conekta/models/payment_method_pbb_payment.rb +341 -0
  60. data/lib/conekta/models/payment_method_pbb_request.rb +309 -0
  61. data/lib/conekta/models/payment_method_spei_recurrent.rb +11 -1
  62. data/lib/conekta/models/update_customer_payment_methods_response.rb +2 -2
  63. data/lib/conekta/models/update_payment_methods.rb +34 -4
  64. data/lib/conekta/version.rb +1 -1
  65. data/lib/conekta.rb +10 -3
  66. data/spec/api/companies_api_spec.rb +53 -0
  67. metadata +42 -22
  68. data/docs/CompanyFiscalInfoAddressResponse.md +0 -34
  69. data/docs/CompanyFiscalInfoResponse.md +0 -30
  70. data/docs/CompanyPayoutDestinationResponse.md +0 -28
@@ -0,0 +1,341 @@
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 PaymentMethodPbbPayment
18
+ attr_accessor :type
19
+
20
+ attr_accessor :object
21
+
22
+ # Deep link for the payment, use for mobile apps/flows
23
+ attr_accessor :deep_link
24
+
25
+ # Expiration date of the charge
26
+ attr_accessor :expires_at
27
+
28
+ # Product type of the charge
29
+ attr_accessor :product_type
30
+
31
+ # URL to redirect the customer to complete the payment
32
+ attr_accessor :redirect_url
33
+
34
+ # Reference for the payment
35
+ attr_accessor :reference
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'type' => :'type',
41
+ :'object' => :'object',
42
+ :'deep_link' => :'deep_link',
43
+ :'expires_at' => :'expires_at',
44
+ :'product_type' => :'product_type',
45
+ :'redirect_url' => :'redirect_url',
46
+ :'reference' => :'reference'
47
+ }
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'type' => :'String',
59
+ :'object' => :'String',
60
+ :'deep_link' => :'String',
61
+ :'expires_at' => :'Integer',
62
+ :'product_type' => :'String',
63
+ :'redirect_url' => :'String',
64
+ :'reference' => :'String'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # List of class defined in allOf (OpenAPI v3)
75
+ def self.openapi_all_of
76
+ [
77
+ :'PaymentMethod'
78
+ ]
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodPbbPayment` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodPbbPayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'type')
97
+ self.type = attributes[:'type']
98
+ end
99
+
100
+ if attributes.key?(:'object')
101
+ self.object = attributes[:'object']
102
+ else
103
+ self.object = nil
104
+ end
105
+
106
+ if attributes.key?(:'deep_link')
107
+ self.deep_link = attributes[:'deep_link']
108
+ else
109
+ self.deep_link = nil
110
+ end
111
+
112
+ if attributes.key?(:'expires_at')
113
+ self.expires_at = attributes[:'expires_at']
114
+ else
115
+ self.expires_at = nil
116
+ end
117
+
118
+ if attributes.key?(:'product_type')
119
+ self.product_type = attributes[:'product_type']
120
+ else
121
+ self.product_type = nil
122
+ end
123
+
124
+ if attributes.key?(:'redirect_url')
125
+ self.redirect_url = attributes[:'redirect_url']
126
+ else
127
+ self.redirect_url = nil
128
+ end
129
+
130
+ if attributes.key?(:'reference')
131
+ self.reference = attributes[:'reference']
132
+ else
133
+ self.reference = nil
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
141
+ invalid_properties = Array.new
142
+ if @object.nil?
143
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
144
+ end
145
+
146
+ if @deep_link.nil?
147
+ invalid_properties.push('invalid value for "deep_link", deep_link cannot be nil.')
148
+ end
149
+
150
+ if @expires_at.nil?
151
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
152
+ end
153
+
154
+ if @expires_at <= 0
155
+ invalid_properties.push('invalid value for "expires_at", must be greater than 0.')
156
+ end
157
+
158
+ if @product_type.nil?
159
+ invalid_properties.push('invalid value for "product_type", product_type cannot be nil.')
160
+ end
161
+
162
+ if @redirect_url.nil?
163
+ invalid_properties.push('invalid value for "redirect_url", redirect_url cannot be nil.')
164
+ end
165
+
166
+ if @reference.nil?
167
+ invalid_properties.push('invalid value for "reference", reference cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ warn '[DEPRECATED] the `valid?` method is obsolete'
177
+ return false if @object.nil?
178
+ return false if @deep_link.nil?
179
+ return false if @expires_at.nil?
180
+ return false if @expires_at <= 0
181
+ return false if @product_type.nil?
182
+ return false if @redirect_url.nil?
183
+ return false if @reference.nil?
184
+ true
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] expires_at Value to be assigned
189
+ def expires_at=(expires_at)
190
+ if expires_at.nil?
191
+ fail ArgumentError, 'expires_at cannot be nil'
192
+ end
193
+
194
+ if expires_at <= 0
195
+ fail ArgumentError, 'invalid value for "expires_at", must be greater than 0.'
196
+ end
197
+
198
+ @expires_at = expires_at
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ type == o.type &&
207
+ object == o.object &&
208
+ deep_link == o.deep_link &&
209
+ expires_at == o.expires_at &&
210
+ product_type == o.product_type &&
211
+ redirect_url == o.redirect_url &&
212
+ reference == o.reference
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [type, object, deep_link, expires_at, product_type, redirect_url, reference].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Deserializes the data based on type
251
+ # @param string type Data type
252
+ # @param string value Value to be deserialized
253
+ # @return [Object] Deserialized data
254
+ def self._deserialize(type, value)
255
+ case type.to_sym
256
+ when :Time
257
+ Time.parse(value)
258
+ when :Date
259
+ Date.parse(value)
260
+ when :String
261
+ value.to_s
262
+ when :Integer
263
+ value.to_i
264
+ when :Float
265
+ value.to_f
266
+ when :Boolean
267
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
268
+ true
269
+ else
270
+ false
271
+ end
272
+ when :Object
273
+ # generic object (usually a Hash), return directly
274
+ value
275
+ when /\AArray<(?<inner_type>.+)>\z/
276
+ inner_type = Regexp.last_match[:inner_type]
277
+ value.map { |v| _deserialize(inner_type, v) }
278
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
279
+ k_type = Regexp.last_match[:k_type]
280
+ v_type = Regexp.last_match[:v_type]
281
+ {}.tap do |hash|
282
+ value.each do |k, v|
283
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
284
+ end
285
+ end
286
+ else # model
287
+ # models (e.g. Pet) or oneOf
288
+ klass = Conekta.const_get(type)
289
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
290
+ end
291
+ end
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # to_body is an alias to to_hash (backward compatibility)
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_body
302
+ to_hash
303
+ end
304
+
305
+ # Returns the object in the form of hash
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_hash
308
+ hash = {}
309
+ self.class.attribute_map.each_pair do |attr, param|
310
+ value = self.send(attr)
311
+ if value.nil?
312
+ is_nullable = self.class.openapi_nullable.include?(attr)
313
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
314
+ end
315
+
316
+ hash[param] = _to_hash(value)
317
+ end
318
+ hash
319
+ end
320
+
321
+ # Outputs non-array value in the form of hash
322
+ # For object, use to_hash. Otherwise, just return the value
323
+ # @param [Object] value Any valid value
324
+ # @return [Hash] Returns the value in the form of hash
325
+ def _to_hash(value)
326
+ if value.is_a?(Array)
327
+ value.compact.map { |v| _to_hash(v) }
328
+ elsif value.is_a?(Hash)
329
+ {}.tap do |hash|
330
+ value.each { |k, v| hash[k] = _to_hash(v) }
331
+ end
332
+ elsif value.respond_to? :to_hash
333
+ value.to_hash
334
+ else
335
+ value
336
+ end
337
+ end
338
+
339
+ end
340
+
341
+ end
@@ -0,0 +1,309 @@
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 PaymentMethodPbbRequest
18
+ # Type of the payment method
19
+ attr_accessor :type
20
+
21
+ # Expiration date of the payment method, in Unix timestamp format
22
+ attr_accessor :expires_at
23
+
24
+ # Product type of the payment method, use for the payment method to know the product type
25
+ attr_accessor :product_type
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
+ :'type' => :'type',
53
+ :'expires_at' => :'expires_at',
54
+ :'product_type' => :'product_type'
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
+ :'type' => :'String',
67
+ :'expires_at' => :'Integer',
68
+ :'product_type' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # List of class defined in allOf (OpenAPI v3)
79
+ def self.openapi_all_of
80
+ [
81
+ :'CustomerPaymentMethodRequest'
82
+ ]
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodPbbRequest` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodPbbRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'type')
101
+ self.type = attributes[:'type']
102
+ else
103
+ self.type = nil
104
+ end
105
+
106
+ if attributes.key?(:'expires_at')
107
+ self.expires_at = attributes[:'expires_at']
108
+ end
109
+
110
+ if attributes.key?(:'product_type')
111
+ self.product_type = attributes[:'product_type']
112
+ else
113
+ self.product_type = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @type.nil?
123
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
124
+ end
125
+
126
+ if !@expires_at.nil? && @expires_at < 0
127
+ invalid_properties.push('invalid value for "expires_at", must be greater than or equal to 0.')
128
+ end
129
+
130
+ if @product_type.nil?
131
+ invalid_properties.push('invalid value for "product_type", product_type cannot be nil.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ warn '[DEPRECATED] the `valid?` method is obsolete'
141
+ return false if @type.nil?
142
+ return false if !@expires_at.nil? && @expires_at < 0
143
+ return false if @product_type.nil?
144
+ product_type_validator = EnumAttributeValidator.new('String', ["bbva_pay_by_bank"])
145
+ return false unless product_type_validator.valid?(@product_type)
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] expires_at Value to be assigned
151
+ def expires_at=(expires_at)
152
+ if expires_at.nil?
153
+ fail ArgumentError, 'expires_at cannot be nil'
154
+ end
155
+
156
+ if expires_at < 0
157
+ fail ArgumentError, 'invalid value for "expires_at", must be greater than or equal to 0.'
158
+ end
159
+
160
+ @expires_at = expires_at
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] product_type Object to be assigned
165
+ def product_type=(product_type)
166
+ validator = EnumAttributeValidator.new('String', ["bbva_pay_by_bank"])
167
+ unless validator.valid?(product_type)
168
+ fail ArgumentError, "invalid value for \"product_type\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @product_type = product_type
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ type == o.type &&
179
+ expires_at == o.expires_at &&
180
+ product_type == o.product_type
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
+ [type, expires_at, product_type].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
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def self._deserialize(type, value)
223
+ case type.to_sym
224
+ when :Time
225
+ Time.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ # models (e.g. Pet) or oneOf
256
+ klass = Conekta.const_get(type)
257
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end
@@ -25,6 +25,9 @@ module Conekta
25
25
 
26
26
  attr_accessor :parent_id
27
27
 
28
+ # Bank name for the SPEI payment method
29
+ attr_accessor :bank
30
+
28
31
  attr_accessor :reference
29
32
 
30
33
  attr_accessor :expires_at
@@ -37,6 +40,7 @@ module Conekta
37
40
  :'object' => :'object',
38
41
  :'created_at' => :'created_at',
39
42
  :'parent_id' => :'parent_id',
43
+ :'bank' => :'bank',
40
44
  :'reference' => :'reference',
41
45
  :'expires_at' => :'expires_at'
42
46
  }
@@ -55,6 +59,7 @@ module Conekta
55
59
  :'object' => :'String',
56
60
  :'created_at' => :'Integer',
57
61
  :'parent_id' => :'String',
62
+ :'bank' => :'String',
58
63
  :'reference' => :'String',
59
64
  :'expires_at' => :'String'
60
65
  }
@@ -116,6 +121,10 @@ module Conekta
116
121
  self.parent_id = attributes[:'parent_id']
117
122
  end
118
123
 
124
+ if attributes.key?(:'bank')
125
+ self.bank = attributes[:'bank']
126
+ end
127
+
119
128
  if attributes.key?(:'reference')
120
129
  self.reference = attributes[:'reference']
121
130
  end
@@ -170,6 +179,7 @@ module Conekta
170
179
  object == o.object &&
171
180
  created_at == o.created_at &&
172
181
  parent_id == o.parent_id &&
182
+ bank == o.bank &&
173
183
  reference == o.reference &&
174
184
  expires_at == o.expires_at
175
185
  end
@@ -183,7 +193,7 @@ module Conekta
183
193
  # Calculates hash code according to all attributes.
184
194
  # @return [Integer] Hash code
185
195
  def hash
186
- [type, id, object, created_at, parent_id, reference, expires_at].hash
196
+ [type, id, object, created_at, parent_id, bank, reference, expires_at].hash
187
197
  end
188
198
 
189
199
  # Builds the object from hash