conekta 6.0.3 → 6.0.4

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -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 +1 -1
  9. data/docs/ChargesDataResponse.md +6 -6
  10. data/docs/Checkout.md +2 -0
  11. data/docs/CreateCustomerPaymentMethodsRequest.md +4 -4
  12. data/docs/CustomerPaymentMethodsRequest.md +4 -4
  13. data/docs/OrderRefundRequest.md +2 -2
  14. data/docs/OrderRequest.md +1 -1
  15. data/docs/PaymentMethodBankTransfer.md +3 -1
  16. data/docs/PaymentMethodCard.md +12 -10
  17. data/docs/PaymentMethodCardRequest.md +12 -2
  18. data/docs/PaymentMethodCash.md +3 -1
  19. data/docs/PaymentMethodGeneralRequest.md +32 -0
  20. data/docs/PaymentMethodTokenRequest.md +20 -0
  21. data/docs/PaymentMethodsApi.md +1 -1
  22. data/docs/SubscriptionResponse.md +2 -0
  23. data/lib/conekta/models/charge_request.rb +1 -0
  24. data/lib/conekta/models/charge_request_payment_method.rb +74 -239
  25. data/lib/conekta/models/charge_response.rb +4 -0
  26. data/lib/conekta/models/charges_data_response.rb +4 -0
  27. data/lib/conekta/models/checkout.rb +11 -1
  28. data/lib/conekta/models/create_customer_payment_methods_request.rb +2 -2
  29. data/lib/conekta/models/customer_payment_methods_request.rb +2 -2
  30. data/lib/conekta/models/order_refund_request.rb +2 -0
  31. data/lib/conekta/models/order_request.rb +1 -1
  32. data/lib/conekta/models/payment_method_bank_transfer.rb +14 -5
  33. data/lib/conekta/models/payment_method_card.rb +22 -4
  34. data/lib/conekta/models/payment_method_card_request.rb +174 -12
  35. data/lib/conekta/models/payment_method_cash.rb +13 -4
  36. data/lib/conekta/models/payment_method_general_request.rb +291 -0
  37. data/lib/conekta/models/payment_method_token_request.rb +246 -0
  38. data/lib/conekta/models/subscription_response.rb +11 -1
  39. data/lib/conekta/version.rb +1 -1
  40. data/lib/conekta.rb +2 -0
  41. data/spec/api/charges_api_spec.rb +18 -10
  42. data/spec/api/customers_api_spec.rb +10 -4
  43. data/spec/api/orders_api_spec.rb +6 -6
  44. metadata +27 -23
@@ -14,257 +14,92 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Conekta
17
- # Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details
18
- class ChargeRequestPaymentMethod
19
- # Method expiration date as unix timestamp
20
- attr_accessor :expires_at
21
-
22
- # How many months without interest to apply, it can be 3, 6, 9, 12 or 18
23
- attr_accessor :monthly_installments
24
-
25
- attr_accessor :type
26
-
27
- attr_accessor :token_id
28
-
29
- attr_accessor :payment_source_id
30
-
31
- # Optional id sent to indicate the bank contract for recurrent card charges.
32
- attr_accessor :contract_id
33
-
34
- # Attribute mapping from ruby-style variable name to JSON key.
35
- def self.attribute_map
36
- {
37
- :'expires_at' => :'expires_at',
38
- :'monthly_installments' => :'monthly_installments',
39
- :'type' => :'type',
40
- :'token_id' => :'token_id',
41
- :'payment_source_id' => :'payment_source_id',
42
- :'contract_id' => :'contract_id'
43
- }
44
- end
45
-
46
- # Returns all the JSON keys this model knows about
47
- def self.acceptable_attributes
48
- attribute_map.values
49
- end
50
-
51
- # Attribute type mapping.
52
- def self.openapi_types
53
- {
54
- :'expires_at' => :'Integer',
55
- :'monthly_installments' => :'Integer',
56
- :'type' => :'String',
57
- :'token_id' => :'String',
58
- :'payment_source_id' => :'String',
59
- :'contract_id' => :'String'
60
- }
61
- end
62
-
63
- # List of attributes with nullable: true
64
- def self.openapi_nullable
65
- Set.new([
66
- ])
67
- end
68
-
69
- # Initializes the object
70
- # @param [Hash] attributes Model attributes in the form of hash
71
- def initialize(attributes = {})
72
- if (!attributes.is_a?(Hash))
73
- fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeRequestPaymentMethod` initialize method"
17
+ module ChargeRequestPaymentMethod
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'PaymentMethodCardRequest',
23
+ :'PaymentMethodGeneralRequest'
24
+ ]
74
25
  end
75
26
 
76
- # check to see if the attribute exists and convert string to symbol for hash key
77
- attributes = attributes.each_with_object({}) { |(k, v), h|
78
- if (!self.class.attribute_map.key?(k.to_sym))
79
- fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeRequestPaymentMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
80
45
  end
81
- h[k.to_sym] = v
82
- }
83
46
 
84
- if attributes.key?(:'expires_at')
85
- self.expires_at = attributes[:'expires_at']
47
+ openapi_one_of.include?(:AnyType) ? data : nil
86
48
  end
87
49
 
88
- if attributes.key?(:'monthly_installments')
89
- self.monthly_installments = attributes[:'monthly_installments']
90
- end
91
-
92
- if attributes.key?(:'type')
93
- self.type = attributes[:'type']
94
- else
95
- self.type = nil
96
- end
97
-
98
- if attributes.key?(:'token_id')
99
- self.token_id = attributes[:'token_id']
100
- end
101
-
102
- if attributes.key?(:'payment_source_id')
103
- self.payment_source_id = attributes[:'payment_source_id']
104
- end
105
-
106
- if attributes.key?(:'contract_id')
107
- self.contract_id = attributes[:'contract_id']
108
- end
109
- end
110
-
111
- # Show invalid properties with the reasons. Usually used together with valid?
112
- # @return Array for valid properties with the reasons
113
- def list_invalid_properties
114
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
- invalid_properties = Array.new
116
- if @type.nil?
117
- invalid_properties.push('invalid value for "type", type cannot be nil.')
118
- end
119
-
120
- invalid_properties
121
- end
122
-
123
- # Check to see if the all the properties in the model are valid
124
- # @return true if the model is valid
125
- def valid?
126
- warn '[DEPRECATED] the `valid?` method is obsolete'
127
- return false if @type.nil?
128
- true
129
- end
130
-
131
- # Checks equality by comparing each attribute.
132
- # @param [Object] Object to be compared
133
- def ==(o)
134
- return true if self.equal?(o)
135
- self.class == o.class &&
136
- expires_at == o.expires_at &&
137
- monthly_installments == o.monthly_installments &&
138
- type == o.type &&
139
- token_id == o.token_id &&
140
- payment_source_id == o.payment_source_id &&
141
- contract_id == o.contract_id
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
- [expires_at, monthly_installments, type, token_id, payment_source_id, contract_id].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) }
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
171
77
  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)
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = Conekta.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
213
95
  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
96
  end
244
97
 
245
- hash[param] = _to_hash(value)
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
246
101
  end
247
- hash
248
102
  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
103
  end
269
104
 
270
105
  end
@@ -33,14 +33,18 @@ module Conekta
33
33
 
34
34
  attr_accessor :failure_message
35
35
 
36
+ # Charge ID
36
37
  attr_accessor :id
37
38
 
39
+ # Whether the charge was made in live mode or not
38
40
  attr_accessor :livemode
39
41
 
40
42
  attr_accessor :object
41
43
 
44
+ # Order ID
42
45
  attr_accessor :order_id
43
46
 
47
+ # Payment date
44
48
  attr_accessor :paid_at
45
49
 
46
50
  attr_accessor :payment_method
@@ -33,14 +33,18 @@ module Conekta
33
33
 
34
34
  attr_accessor :failure_message
35
35
 
36
+ # Charge ID
36
37
  attr_accessor :id
37
38
 
39
+ # Whether the charge was made in live mode or not
38
40
  attr_accessor :livemode
39
41
 
40
42
  attr_accessor :object
41
43
 
44
+ # Order ID
42
45
  attr_accessor :order_id
43
46
 
47
+ # Payment date
44
48
  attr_accessor :paid_at
45
49
 
46
50
  attr_accessor :payment_method
@@ -28,6 +28,9 @@ module Conekta
28
28
  # This field allows you to specify the number of months without interest.
29
29
  attr_accessor :monthly_installments_options
30
30
 
31
+ # Indicates the 3DS2 mode for the order, either smart or strict.
32
+ attr_accessor :three_ds_mode
33
+
31
34
  # Reason for charge
32
35
  attr_accessor :name
33
36
 
@@ -55,6 +58,7 @@ module Conekta
55
58
  :'expires_at' => :'expires_at',
56
59
  :'monthly_installments_enabled' => :'monthly_installments_enabled',
57
60
  :'monthly_installments_options' => :'monthly_installments_options',
61
+ :'three_ds_mode' => :'three_ds_mode',
58
62
  :'name' => :'name',
59
63
  :'needs_shipping_contact' => :'needs_shipping_contact',
60
64
  :'on_demand_enabled' => :'on_demand_enabled',
@@ -77,6 +81,7 @@ module Conekta
77
81
  :'expires_at' => :'Integer',
78
82
  :'monthly_installments_enabled' => :'Boolean',
79
83
  :'monthly_installments_options' => :'Array<Integer>',
84
+ :'three_ds_mode' => :'String',
80
85
  :'name' => :'String',
81
86
  :'needs_shipping_contact' => :'Boolean',
82
87
  :'on_demand_enabled' => :'Boolean',
@@ -133,6 +138,10 @@ module Conekta
133
138
  end
134
139
  end
135
140
 
141
+ if attributes.key?(:'three_ds_mode')
142
+ self.three_ds_mode = attributes[:'three_ds_mode']
143
+ end
144
+
136
145
  if attributes.key?(:'name')
137
146
  self.name = attributes[:'name']
138
147
  else
@@ -224,6 +233,7 @@ module Conekta
224
233
  expires_at == o.expires_at &&
225
234
  monthly_installments_enabled == o.monthly_installments_enabled &&
226
235
  monthly_installments_options == o.monthly_installments_options &&
236
+ three_ds_mode == o.three_ds_mode &&
227
237
  name == o.name &&
228
238
  needs_shipping_contact == o.needs_shipping_contact &&
229
239
  on_demand_enabled == o.on_demand_enabled &&
@@ -242,7 +252,7 @@ module Conekta
242
252
  # Calculates hash code according to all attributes.
243
253
  # @return [Integer] Hash code
244
254
  def hash
245
- [allowed_payment_methods, expires_at, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, on_demand_enabled, order_template, payments_limit_count, recurrent, type].hash
255
+ [allowed_payment_methods, expires_at, monthly_installments_enabled, monthly_installments_options, three_ds_mode, name, needs_shipping_contact, on_demand_enabled, order_template, payments_limit_count, recurrent, type].hash
246
256
  end
247
257
 
248
258
  # Builds the object from hash
@@ -20,9 +20,9 @@ module Conekta
20
20
  # List of class defined in oneOf (OpenAPI v3)
21
21
  def openapi_one_of
22
22
  [
23
- :'PaymentMethodCardRequest',
24
23
  :'PaymentMethodCashRequest',
25
- :'PaymentMethodSpeiRequest'
24
+ :'PaymentMethodSpeiRequest',
25
+ :'PaymentMethodTokenRequest'
26
26
  ]
27
27
  end
28
28
 
@@ -19,9 +19,9 @@ module Conekta
19
19
  # List of class defined in oneOf (OpenAPI v3)
20
20
  def openapi_one_of
21
21
  [
22
- :'PaymentMethodCardRequest',
23
22
  :'PaymentMethodCashRequest',
24
- :'PaymentMethodSpeiRequest'
23
+ :'PaymentMethodSpeiRequest',
24
+ :'PaymentMethodTokenRequest'
25
25
  ]
26
26
  end
27
27
 
@@ -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.
@@ -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
@@ -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