conekta 6.0.3 → 6.0.5

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -5
  3. data/VERSION +1 -1
  4. data/config-ruby.json +1 -1
  5. data/docs/ChargeRequest.md +1 -1
  6. data/docs/ChargeRequestPaymentMethod.md +39 -18
  7. data/docs/ChargeResponse.md +6 -6
  8. data/docs/ChargesApi.md +79 -1
  9. data/docs/ChargesDataResponse.md +6 -6
  10. data/docs/ChargesOrderResponse.md +22 -0
  11. data/docs/ChargesOrderResponseAllOfData.md +52 -0
  12. data/docs/Checkout.md +2 -0
  13. data/docs/CheckoutRequest.md +2 -0
  14. data/docs/CreateCustomerPaymentMethodsRequest.md +4 -4
  15. data/docs/Customer.md +4 -0
  16. data/docs/CustomerPaymentMethodsRequest.md +4 -4
  17. data/docs/CustomerResponse.md +4 -0
  18. data/docs/OrderRefundRequest.md +2 -2
  19. data/docs/OrderRequest.md +1 -1
  20. data/docs/OrderResponseCheckout.md +2 -0
  21. data/docs/PaymentMethodBankTransfer.md +3 -1
  22. data/docs/PaymentMethodCard.md +12 -10
  23. data/docs/PaymentMethodCardRequest.md +12 -2
  24. data/docs/PaymentMethodCash.md +7 -1
  25. data/docs/PaymentMethodGeneralRequest.md +32 -0
  26. data/docs/PaymentMethodTokenRequest.md +20 -0
  27. data/docs/PaymentMethodsApi.md +1 -1
  28. data/docs/PayoutOrdersApi.md +74 -0
  29. data/docs/SubscriptionResponse.md +2 -0
  30. data/docs/UpdateCustomer.md +4 -0
  31. data/lib/conekta/api/charges_api.rb +84 -0
  32. data/lib/conekta/api/payout_orders_api.rb +70 -0
  33. data/lib/conekta/models/charge_request.rb +1 -0
  34. data/lib/conekta/models/charge_request_payment_method.rb +74 -239
  35. data/lib/conekta/models/charge_response.rb +4 -0
  36. data/lib/conekta/models/charges_data_response.rb +4 -0
  37. data/lib/conekta/models/charges_order_response.rb +258 -0
  38. data/lib/conekta/models/charges_order_response_all_of_data.rb +382 -0
  39. data/lib/conekta/models/checkout.rb +11 -1
  40. data/lib/conekta/models/checkout_request.rb +11 -1
  41. data/lib/conekta/models/create_customer_payment_methods_request.rb +2 -2
  42. data/lib/conekta/models/customer.rb +21 -1
  43. data/lib/conekta/models/customer_payment_methods_request.rb +2 -2
  44. data/lib/conekta/models/customer_response.rb +21 -1
  45. data/lib/conekta/models/order_refund_request.rb +2 -1
  46. data/lib/conekta/models/order_request.rb +1 -1
  47. data/lib/conekta/models/order_response_checkout.rb +12 -1
  48. data/lib/conekta/models/payment_method_bank_transfer.rb +14 -5
  49. data/lib/conekta/models/payment_method_card.rb +22 -4
  50. data/lib/conekta/models/payment_method_card_request.rb +174 -12
  51. data/lib/conekta/models/payment_method_cash.rb +33 -4
  52. data/lib/conekta/models/payment_method_general_request.rb +291 -0
  53. data/lib/conekta/models/payment_method_token_request.rb +246 -0
  54. data/lib/conekta/models/subscription_response.rb +11 -1
  55. data/lib/conekta/models/update_customer.rb +21 -1
  56. data/lib/conekta/version.rb +1 -1
  57. data/lib/conekta.rb +4 -0
  58. data/spec/api/charges_api_spec.rb +18 -10
  59. data/spec/api/customers_api_spec.rb +10 -4
  60. data/spec/api/orders_api_spec.rb +6 -6
  61. metadata +32 -24
@@ -27,6 +27,9 @@ module Conekta
27
27
  # Custom reference
28
28
  attr_accessor :custom_reference
29
29
 
30
+ # It is a parameter that allows to identify the date of birth of the client.
31
+ attr_accessor :date_of_birth
32
+
30
33
  attr_accessor :default_fiscal_entity_id
31
34
 
32
35
  attr_accessor :default_shipping_contact_id
@@ -46,6 +49,9 @@ module Conekta
46
49
  # Customer's name
47
50
  attr_accessor :name
48
51
 
52
+ # It is a parameter that allows to identify the national identification number of the client.
53
+ attr_accessor :national_id
54
+
49
55
  attr_accessor :metadata
50
56
 
51
57
  attr_accessor :object
@@ -66,6 +72,7 @@ module Conekta
66
72
  :'corporate' => :'corporate',
67
73
  :'created_at' => :'created_at',
68
74
  :'custom_reference' => :'custom_reference',
75
+ :'date_of_birth' => :'date_of_birth',
69
76
  :'default_fiscal_entity_id' => :'default_fiscal_entity_id',
70
77
  :'default_shipping_contact_id' => :'default_shipping_contact_id',
71
78
  :'default_payment_source_id' => :'default_payment_source_id',
@@ -74,6 +81,7 @@ module Conekta
74
81
  :'id' => :'id',
75
82
  :'livemode' => :'livemode',
76
83
  :'name' => :'name',
84
+ :'national_id' => :'national_id',
77
85
  :'metadata' => :'metadata',
78
86
  :'object' => :'object',
79
87
  :'payment_sources' => :'payment_sources',
@@ -95,6 +103,7 @@ module Conekta
95
103
  :'corporate' => :'Boolean',
96
104
  :'created_at' => :'Integer',
97
105
  :'custom_reference' => :'String',
106
+ :'date_of_birth' => :'String',
98
107
  :'default_fiscal_entity_id' => :'String',
99
108
  :'default_shipping_contact_id' => :'String',
100
109
  :'default_payment_source_id' => :'String',
@@ -103,6 +112,7 @@ module Conekta
103
112
  :'id' => :'String',
104
113
  :'livemode' => :'Boolean',
105
114
  :'name' => :'String',
115
+ :'national_id' => :'String',
106
116
  :'metadata' => :'Hash<String, Object>',
107
117
  :'object' => :'String',
108
118
  :'payment_sources' => :'CustomerPaymentMethodsResponse',
@@ -154,6 +164,10 @@ module Conekta
154
164
  self.custom_reference = attributes[:'custom_reference']
155
165
  end
156
166
 
167
+ if attributes.key?(:'date_of_birth')
168
+ self.date_of_birth = attributes[:'date_of_birth']
169
+ end
170
+
157
171
  if attributes.key?(:'default_fiscal_entity_id')
158
172
  self.default_fiscal_entity_id = attributes[:'default_fiscal_entity_id']
159
173
  end
@@ -192,6 +206,10 @@ module Conekta
192
206
  self.name = nil
193
207
  end
194
208
 
209
+ if attributes.key?(:'national_id')
210
+ self.national_id = attributes[:'national_id']
211
+ end
212
+
195
213
  if attributes.key?(:'metadata')
196
214
  if (value = attributes[:'metadata']).is_a?(Hash)
197
215
  self.metadata = value
@@ -289,6 +307,7 @@ module Conekta
289
307
  corporate == o.corporate &&
290
308
  created_at == o.created_at &&
291
309
  custom_reference == o.custom_reference &&
310
+ date_of_birth == o.date_of_birth &&
292
311
  default_fiscal_entity_id == o.default_fiscal_entity_id &&
293
312
  default_shipping_contact_id == o.default_shipping_contact_id &&
294
313
  default_payment_source_id == o.default_payment_source_id &&
@@ -297,6 +316,7 @@ module Conekta
297
316
  id == o.id &&
298
317
  livemode == o.livemode &&
299
318
  name == o.name &&
319
+ national_id == o.national_id &&
300
320
  metadata == o.metadata &&
301
321
  object == o.object &&
302
322
  payment_sources == o.payment_sources &&
@@ -314,7 +334,7 @@ module Conekta
314
334
  # Calculates hash code according to all attributes.
315
335
  # @return [Integer] Hash code
316
336
  def hash
317
- [antifraud_info, corporate, created_at, custom_reference, default_fiscal_entity_id, default_shipping_contact_id, default_payment_source_id, email, fiscal_entities, id, livemode, name, metadata, object, payment_sources, phone, shipping_contacts, subscription].hash
337
+ [antifraud_info, corporate, created_at, custom_reference, date_of_birth, default_fiscal_entity_id, default_shipping_contact_id, default_payment_source_id, email, fiscal_entities, id, livemode, name, national_id, metadata, object, payment_sources, phone, shipping_contacts, subscription].hash
318
338
  end
319
339
 
320
340
  # Builds the object from hash
@@ -15,10 +15,12 @@ require 'time'
15
15
 
16
16
  module Conekta
17
17
  class OrderRefundRequest
18
+ # Amount to be refunded in cents
18
19
  attr_accessor :amount
19
20
 
20
21
  attr_accessor :expires_at
21
22
 
23
+ # Reason for the refund
22
24
  attr_accessor :reason
23
25
 
24
26
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -47,7 +49,6 @@ module Conekta
47
49
  # List of attributes with nullable: true
48
50
  def self.openapi_nullable
49
51
  Set.new([
50
- :'expires_at',
51
52
  ])
52
53
  end
53
54
 
@@ -46,7 +46,7 @@ module Conekta
46
46
  # Indicates the processing mode for the order, either ecommerce, recurrent or validation.
47
47
  attr_accessor :processing_mode
48
48
 
49
- # Indicates the redirection callback upon completion of the 3DS2 flow.
49
+ # Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter
50
50
  attr_accessor :return_url
51
51
 
52
52
  attr_accessor :shipping_contact
@@ -35,6 +35,9 @@ module Conekta
35
35
 
36
36
  attr_accessor :livemode
37
37
 
38
+ # Number of retries allowed before the checkout is marked as failed
39
+ attr_accessor :max_failed_retries
40
+
38
41
  attr_accessor :metadata
39
42
 
40
43
  attr_accessor :monthly_installments_enabled
@@ -83,6 +86,7 @@ module Conekta
83
86
  :'id' => :'id',
84
87
  :'is_redirect_on_failure' => :'is_redirect_on_failure',
85
88
  :'livemode' => :'livemode',
89
+ :'max_failed_retries' => :'max_failed_retries',
86
90
  :'metadata' => :'metadata',
87
91
  :'monthly_installments_enabled' => :'monthly_installments_enabled',
88
92
  :'monthly_installments_options' => :'monthly_installments_options',
@@ -121,6 +125,7 @@ module Conekta
121
125
  :'id' => :'String',
122
126
  :'is_redirect_on_failure' => :'Boolean',
123
127
  :'livemode' => :'Boolean',
128
+ :'max_failed_retries' => :'Integer',
124
129
  :'metadata' => :'Hash<String, Object>',
125
130
  :'monthly_installments_enabled' => :'Boolean',
126
131
  :'monthly_installments_options' => :'Array<Integer>',
@@ -144,6 +149,7 @@ module Conekta
144
149
  # List of attributes with nullable: true
145
150
  def self.openapi_nullable
146
151
  Set.new([
152
+ :'max_failed_retries',
147
153
  :'on_demand_enabled',
148
154
  :'redirection_time',
149
155
  ])
@@ -208,6 +214,10 @@ module Conekta
208
214
  self.livemode = attributes[:'livemode']
209
215
  end
210
216
 
217
+ if attributes.key?(:'max_failed_retries')
218
+ self.max_failed_retries = attributes[:'max_failed_retries']
219
+ end
220
+
211
221
  if attributes.key?(:'metadata')
212
222
  if (value = attributes[:'metadata']).is_a?(Hash)
213
223
  self.metadata = value
@@ -330,6 +340,7 @@ module Conekta
330
340
  id == o.id &&
331
341
  is_redirect_on_failure == o.is_redirect_on_failure &&
332
342
  livemode == o.livemode &&
343
+ max_failed_retries == o.max_failed_retries &&
333
344
  metadata == o.metadata &&
334
345
  monthly_installments_enabled == o.monthly_installments_enabled &&
335
346
  monthly_installments_options == o.monthly_installments_options &&
@@ -358,7 +369,7 @@ module Conekta
358
369
  # Calculates hash code according to all attributes.
359
370
  # @return [Integer] Hash code
360
371
  def hash
361
- [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, is_redirect_on_failure, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, redirection_time, slug, sms_sent, success_url, starts_at, status, type, url].hash
372
+ [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, is_redirect_on_failure, livemode, max_failed_retries, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, redirection_time, slug, sms_sent, success_url, starts_at, status, type, url].hash
362
373
  end
363
374
 
364
375
  # Builds the object from hash
@@ -51,6 +51,8 @@ module Conekta
51
51
 
52
52
  attr_accessor :tracking_code
53
53
 
54
+ attr_accessor :customer_ip_address
55
+
54
56
  # Attribute mapping from ruby-style variable name to JSON key.
55
57
  def self.attribute_map
56
58
  {
@@ -71,7 +73,8 @@ module Conekta
71
73
  :'receiving_account_bank' => :'receiving_account_bank',
72
74
  :'receiving_account_tax_id' => :'receiving_account_tax_id',
73
75
  :'reference_number' => :'reference_number',
74
- :'tracking_code' => :'tracking_code'
76
+ :'tracking_code' => :'tracking_code',
77
+ :'customer_ip_address' => :'customer_ip_address'
75
78
  }
76
79
  end
77
80
 
@@ -100,7 +103,8 @@ module Conekta
100
103
  :'receiving_account_bank' => :'String',
101
104
  :'receiving_account_tax_id' => :'String',
102
105
  :'reference_number' => :'String',
103
- :'tracking_code' => :'String'
106
+ :'tracking_code' => :'String',
107
+ :'customer_ip_address' => :'String'
104
108
  }
105
109
  end
106
110
 
@@ -116,7 +120,7 @@ module Conekta
116
120
  :'receiving_account_holder_name',
117
121
  :'receiving_account_tax_id',
118
122
  :'reference_number',
119
- :'tracking_code'
123
+ :'tracking_code',
120
124
  ])
121
125
  end
122
126
 
@@ -217,6 +221,10 @@ module Conekta
217
221
  if attributes.key?(:'tracking_code')
218
222
  self.tracking_code = attributes[:'tracking_code']
219
223
  end
224
+
225
+ if attributes.key?(:'customer_ip_address')
226
+ self.customer_ip_address = attributes[:'customer_ip_address']
227
+ end
220
228
  end
221
229
 
222
230
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -261,7 +269,8 @@ module Conekta
261
269
  receiving_account_bank == o.receiving_account_bank &&
262
270
  receiving_account_tax_id == o.receiving_account_tax_id &&
263
271
  reference_number == o.reference_number &&
264
- tracking_code == o.tracking_code
272
+ tracking_code == o.tracking_code &&
273
+ customer_ip_address == o.customer_ip_address
265
274
  end
266
275
 
267
276
  # @see the `==` method
@@ -273,7 +282,7 @@ module Conekta
273
282
  # Calculates hash code according to all attributes.
274
283
  # @return [Integer] Hash code
275
284
  def hash
276
- [type, object, bank, clabe, description, executed_at, expires_at, issuing_account_bank, issuing_account_number, issuing_account_holder_name, issuing_account_tax_id, payment_attempts, receiving_account_holder_name, receiving_account_number, receiving_account_bank, receiving_account_tax_id, reference_number, tracking_code].hash
285
+ [type, object, bank, clabe, description, executed_at, expires_at, issuing_account_bank, issuing_account_number, issuing_account_holder_name, issuing_account_tax_id, payment_attempts, receiving_account_holder_name, receiving_account_number, receiving_account_bank, receiving_account_tax_id, reference_number, tracking_code, customer_ip_address].hash
277
286
  end
278
287
 
279
288
  # Builds the object from hash
@@ -19,29 +19,40 @@ module Conekta
19
19
 
20
20
  attr_accessor :object
21
21
 
22
+ # Account type of the card
22
23
  attr_accessor :account_type
23
24
 
24
25
  attr_accessor :auth_code
25
26
 
27
+ # Brand of the card
26
28
  attr_accessor :brand
27
29
 
28
30
  # Id sent for recurrent charges.
29
31
  attr_accessor :contract_id
30
32
 
33
+ # Country of the card
31
34
  attr_accessor :country
32
35
 
36
+ # Expiration month of the card
33
37
  attr_accessor :exp_month
34
38
 
39
+ # Expiration year of the card
35
40
  attr_accessor :exp_year
36
41
 
37
42
  attr_accessor :fraud_indicators
38
43
 
44
+ # Issuer of the card
39
45
  attr_accessor :issuer
40
46
 
47
+ # Last 4 digits of the card
41
48
  attr_accessor :last4
42
49
 
50
+ # Name of the cardholder
43
51
  attr_accessor :name
44
52
 
53
+ # Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes
54
+ attr_accessor :customer_ip_address
55
+
45
56
  # Attribute mapping from ruby-style variable name to JSON key.
46
57
  def self.attribute_map
47
58
  {
@@ -57,7 +68,8 @@ module Conekta
57
68
  :'fraud_indicators' => :'fraud_indicators',
58
69
  :'issuer' => :'issuer',
59
70
  :'last4' => :'last4',
60
- :'name' => :'name'
71
+ :'name' => :'name',
72
+ :'customer_ip_address' => :'customer_ip_address'
61
73
  }
62
74
  end
63
75
 
@@ -81,7 +93,8 @@ module Conekta
81
93
  :'fraud_indicators' => :'Array<Object>',
82
94
  :'issuer' => :'String',
83
95
  :'last4' => :'String',
84
- :'name' => :'String'
96
+ :'name' => :'String',
97
+ :'customer_ip_address' => :'String'
85
98
  }
86
99
  end
87
100
 
@@ -168,6 +181,10 @@ module Conekta
168
181
  if attributes.key?(:'name')
169
182
  self.name = attributes[:'name']
170
183
  end
184
+
185
+ if attributes.key?(:'customer_ip_address')
186
+ self.customer_ip_address = attributes[:'customer_ip_address']
187
+ end
171
188
  end
172
189
 
173
190
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -207,7 +224,8 @@ module Conekta
207
224
  fraud_indicators == o.fraud_indicators &&
208
225
  issuer == o.issuer &&
209
226
  last4 == o.last4 &&
210
- name == o.name
227
+ name == o.name &&
228
+ customer_ip_address == o.customer_ip_address
211
229
  end
212
230
 
213
231
  # @see the `==` method
@@ -219,7 +237,7 @@ module Conekta
219
237
  # Calculates hash code according to all attributes.
220
238
  # @return [Integer] Hash code
221
239
  def hash
222
- [type, object, account_type, auth_code, brand, contract_id, country, exp_month, exp_year, fraud_indicators, issuer, last4, name].hash
240
+ [type, object, account_type, auth_code, brand, contract_id, country, exp_month, exp_year, fraud_indicators, issuer, last4, name, customer_ip_address].hash
223
241
  end
224
242
 
225
243
  # Builds the object from hash
@@ -18,14 +18,34 @@ module Conekta
18
18
  # Type of payment method
19
19
  attr_accessor :type
20
20
 
21
- # Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards.
22
- attr_accessor :token_id
21
+ # Card security code
22
+ attr_accessor :cvc
23
+
24
+ # Card expiration month
25
+ attr_accessor :exp_month
26
+
27
+ # Card expiration year
28
+ attr_accessor :exp_year
29
+
30
+ # Cardholder name
31
+ attr_accessor :name
32
+
33
+ # Card number
34
+ attr_accessor :number
35
+
36
+ # Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes
37
+ attr_accessor :customer_ip_address
23
38
 
24
39
  # Attribute mapping from ruby-style variable name to JSON key.
25
40
  def self.attribute_map
26
41
  {
27
42
  :'type' => :'type',
28
- :'token_id' => :'token_id'
43
+ :'cvc' => :'cvc',
44
+ :'exp_month' => :'exp_month',
45
+ :'exp_year' => :'exp_year',
46
+ :'name' => :'name',
47
+ :'number' => :'number',
48
+ :'customer_ip_address' => :'customer_ip_address'
29
49
  }
30
50
  end
31
51
 
@@ -38,7 +58,12 @@ module Conekta
38
58
  def self.openapi_types
39
59
  {
40
60
  :'type' => :'String',
41
- :'token_id' => :'String'
61
+ :'cvc' => :'String',
62
+ :'exp_month' => :'String',
63
+ :'exp_year' => :'String',
64
+ :'name' => :'String',
65
+ :'number' => :'String',
66
+ :'customer_ip_address' => :'String'
42
67
  }
43
68
  end
44
69
 
@@ -76,10 +101,38 @@ module Conekta
76
101
  self.type = nil
77
102
  end
78
103
 
79
- if attributes.key?(:'token_id')
80
- self.token_id = attributes[:'token_id']
104
+ if attributes.key?(:'cvc')
105
+ self.cvc = attributes[:'cvc']
106
+ else
107
+ self.cvc = nil
108
+ end
109
+
110
+ if attributes.key?(:'exp_month')
111
+ self.exp_month = attributes[:'exp_month']
112
+ else
113
+ self.exp_month = nil
114
+ end
115
+
116
+ if attributes.key?(:'exp_year')
117
+ self.exp_year = attributes[:'exp_year']
118
+ else
119
+ self.exp_year = nil
120
+ end
121
+
122
+ if attributes.key?(:'name')
123
+ self.name = attributes[:'name']
124
+ else
125
+ self.name = nil
126
+ end
127
+
128
+ if attributes.key?(:'number')
129
+ self.number = attributes[:'number']
81
130
  else
82
- self.token_id = nil
131
+ self.number = nil
132
+ end
133
+
134
+ if attributes.key?(:'customer_ip_address')
135
+ self.customer_ip_address = attributes[:'customer_ip_address']
83
136
  end
84
137
  end
85
138
 
@@ -92,8 +145,48 @@ module Conekta
92
145
  invalid_properties.push('invalid value for "type", type cannot be nil.')
93
146
  end
94
147
 
95
- if @token_id.nil?
96
- invalid_properties.push('invalid value for "token_id", token_id cannot be nil.')
148
+ if @cvc.nil?
149
+ invalid_properties.push('invalid value for "cvc", cvc cannot be nil.')
150
+ end
151
+
152
+ if @cvc.to_s.length > 4
153
+ invalid_properties.push('invalid value for "cvc", the character length must be smaller than or equal to 4.')
154
+ end
155
+
156
+ if @cvc.to_s.length < 3
157
+ invalid_properties.push('invalid value for "cvc", the character length must be great than or equal to 3.')
158
+ end
159
+
160
+ if @exp_month.nil?
161
+ invalid_properties.push('invalid value for "exp_month", exp_month cannot be nil.')
162
+ end
163
+
164
+ if @exp_month.to_s.length > 2
165
+ invalid_properties.push('invalid value for "exp_month", the character length must be smaller than or equal to 2.')
166
+ end
167
+
168
+ if @exp_month.to_s.length < 2
169
+ invalid_properties.push('invalid value for "exp_month", the character length must be great than or equal to 2.')
170
+ end
171
+
172
+ if @exp_year.nil?
173
+ invalid_properties.push('invalid value for "exp_year", exp_year cannot be nil.')
174
+ end
175
+
176
+ if @exp_year.to_s.length > 4
177
+ invalid_properties.push('invalid value for "exp_year", the character length must be smaller than or equal to 4.')
178
+ end
179
+
180
+ if @exp_year.to_s.length < 4
181
+ invalid_properties.push('invalid value for "exp_year", the character length must be great than or equal to 4.')
182
+ end
183
+
184
+ if @name.nil?
185
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
186
+ end
187
+
188
+ if @number.nil?
189
+ invalid_properties.push('invalid value for "number", number cannot be nil.')
97
190
  end
98
191
 
99
192
  invalid_properties
@@ -104,17 +197,86 @@ module Conekta
104
197
  def valid?
105
198
  warn '[DEPRECATED] the `valid?` method is obsolete'
106
199
  return false if @type.nil?
107
- return false if @token_id.nil?
200
+ return false if @cvc.nil?
201
+ return false if @cvc.to_s.length > 4
202
+ return false if @cvc.to_s.length < 3
203
+ return false if @exp_month.nil?
204
+ return false if @exp_month.to_s.length > 2
205
+ return false if @exp_month.to_s.length < 2
206
+ return false if @exp_year.nil?
207
+ return false if @exp_year.to_s.length > 4
208
+ return false if @exp_year.to_s.length < 4
209
+ return false if @name.nil?
210
+ return false if @number.nil?
108
211
  true
109
212
  end
110
213
 
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] cvc Value to be assigned
216
+ def cvc=(cvc)
217
+ if cvc.nil?
218
+ fail ArgumentError, 'cvc cannot be nil'
219
+ end
220
+
221
+ if cvc.to_s.length > 4
222
+ fail ArgumentError, 'invalid value for "cvc", the character length must be smaller than or equal to 4.'
223
+ end
224
+
225
+ if cvc.to_s.length < 3
226
+ fail ArgumentError, 'invalid value for "cvc", the character length must be great than or equal to 3.'
227
+ end
228
+
229
+ @cvc = cvc
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] exp_month Value to be assigned
234
+ def exp_month=(exp_month)
235
+ if exp_month.nil?
236
+ fail ArgumentError, 'exp_month cannot be nil'
237
+ end
238
+
239
+ if exp_month.to_s.length > 2
240
+ fail ArgumentError, 'invalid value for "exp_month", the character length must be smaller than or equal to 2.'
241
+ end
242
+
243
+ if exp_month.to_s.length < 2
244
+ fail ArgumentError, 'invalid value for "exp_month", the character length must be great than or equal to 2.'
245
+ end
246
+
247
+ @exp_month = exp_month
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] exp_year Value to be assigned
252
+ def exp_year=(exp_year)
253
+ if exp_year.nil?
254
+ fail ArgumentError, 'exp_year cannot be nil'
255
+ end
256
+
257
+ if exp_year.to_s.length > 4
258
+ fail ArgumentError, 'invalid value for "exp_year", the character length must be smaller than or equal to 4.'
259
+ end
260
+
261
+ if exp_year.to_s.length < 4
262
+ fail ArgumentError, 'invalid value for "exp_year", the character length must be great than or equal to 4.'
263
+ end
264
+
265
+ @exp_year = exp_year
266
+ end
267
+
111
268
  # Checks equality by comparing each attribute.
112
269
  # @param [Object] Object to be compared
113
270
  def ==(o)
114
271
  return true if self.equal?(o)
115
272
  self.class == o.class &&
116
273
  type == o.type &&
117
- token_id == o.token_id
274
+ cvc == o.cvc &&
275
+ exp_month == o.exp_month &&
276
+ exp_year == o.exp_year &&
277
+ name == o.name &&
278
+ number == o.number &&
279
+ customer_ip_address == o.customer_ip_address
118
280
  end
119
281
 
120
282
  # @see the `==` method
@@ -126,7 +288,7 @@ module Conekta
126
288
  # Calculates hash code according to all attributes.
127
289
  # @return [Integer] Hash code
128
290
  def hash
129
- [type, token_id].hash
291
+ [type, cvc, exp_month, exp_year, name, number, customer_ip_address].hash
130
292
  end
131
293
 
132
294
  # Builds the object from hash