digital_femsa 1.0.0 → 1.1.0

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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +14 -0
  3. data/README.md +28 -33
  4. data/VERSION +1 -1
  5. data/config-ruby.json +1 -1
  6. data/docs/ApiKeyCreateResponse.md +1 -1
  7. data/docs/ApiKeyRequest.md +2 -2
  8. data/docs/ApiKeyResponseOnDelete.md +2 -2
  9. data/docs/ApiKeysApi.md +10 -10
  10. data/docs/BalanceResponse.md +8 -8
  11. data/docs/BalancesApi.md +1 -1
  12. data/docs/ChargeOrderResponse.md +1 -1
  13. data/docs/ChargeOrderResponseChannel.md +24 -0
  14. data/docs/ChargeRequest.md +1 -1
  15. data/docs/ChargeRequestPaymentMethod.md +3 -3
  16. data/docs/ChargeResponse.md +9 -7
  17. data/docs/ChargeResponseChannel.md +3 -3
  18. data/docs/ChargeResponseRefundsData.md +5 -1
  19. data/docs/ChargesApi.md +16 -12
  20. data/docs/ChargesDataResponse.md +9 -7
  21. data/docs/Checkout.md +17 -15
  22. data/docs/CheckoutOrderTemplate.md +3 -3
  23. data/docs/CheckoutResponse.md +1 -1
  24. data/docs/CreateCustomerFiscalEntitiesResponse.md +2 -2
  25. data/docs/Customer.md +13 -19
  26. data/docs/CustomerAddress.md +2 -2
  27. data/docs/CustomerFiscalEntitiesDataResponse.md +2 -2
  28. data/docs/CustomerFiscalEntitiesRequest.md +3 -3
  29. data/docs/CustomerInfo.md +4 -4
  30. data/docs/CustomerPaymentMethodRequest.md +1 -1
  31. data/docs/CustomerResponse.md +17 -21
  32. data/docs/CustomerShippingContactsResponse.md +5 -5
  33. data/docs/CustomersApi.md +15 -15
  34. data/docs/CustomersResponse.md +1 -1
  35. data/docs/DeleteApiKeysResponse.md +1 -1
  36. data/docs/DiscountsApi.md +9 -9
  37. data/docs/EventsApi.md +2 -2
  38. data/docs/EventsResendResponse.md +1 -1
  39. data/docs/GetChargesResponse.md +4 -4
  40. data/docs/GetTransactionsResponse.md +1 -1
  41. data/docs/LogsApi.md +1 -1
  42. data/docs/OrderFiscalEntityRequest.md +4 -4
  43. data/docs/OrderRefundRequest.md +7 -5
  44. data/docs/OrderRequest.md +17 -19
  45. data/docs/OrderResponse.md +37 -35
  46. data/docs/OrderResponseChannel.md +24 -0
  47. data/docs/OrderResponseShippingContact.md +4 -4
  48. data/docs/OrderUpdateFiscalEntityRequest.md +1 -1
  49. data/docs/OrderUpdateRequest.md +19 -15
  50. data/docs/OrdersApi.md +16 -16
  51. data/docs/PaymentLinkApi.md +12 -82
  52. data/docs/PaymentMethodCash.md +4 -4
  53. data/docs/PaymentMethodCashRequest.md +2 -2
  54. data/docs/PaymentMethodsApi.md +5 -5
  55. data/docs/Product.md +10 -12
  56. data/docs/ProductDataResponse.md +9 -11
  57. data/docs/ProductOrderResponse.md +9 -11
  58. data/docs/ProductsApi.md +7 -7
  59. data/docs/ShippingContactsApi.md +9 -9
  60. data/docs/ShippingOrderResponse.md +5 -3
  61. data/docs/ShippingRequest.md +2 -0
  62. data/docs/ShippingsApi.md +7 -7
  63. data/docs/TaxesApi.md +7 -7
  64. data/docs/TransactionResponse.md +20 -14
  65. data/docs/TransactionsApi.md +6 -6
  66. data/docs/TransfersApi.md +10 -10
  67. data/docs/UpdateCustomer.md +17 -21
  68. data/docs/UpdateCustomerFiscalEntitiesResponse.md +2 -2
  69. data/docs/UpdateOrderTaxRequest.md +2 -2
  70. data/docs/UpdateProduct.md +7 -9
  71. data/docs/WebhookKeysApi.md +18 -14
  72. data/docs/WebhooksApi.md +28 -22
  73. data/lib/digital_femsa/api/api_keys_api.rb +8 -8
  74. data/lib/digital_femsa/api/balances_api.rb +2 -2
  75. data/lib/digital_femsa/api/charges_api.rb +13 -9
  76. data/lib/digital_femsa/api/customers_api.rb +12 -12
  77. data/lib/digital_femsa/api/discounts_api.rb +12 -12
  78. data/lib/digital_femsa/api/events_api.rb +4 -4
  79. data/lib/digital_femsa/api/logs_api.rb +2 -2
  80. data/lib/digital_femsa/api/orders_api.rb +20 -20
  81. data/lib/digital_femsa/api/payment_link_api.rb +10 -86
  82. data/lib/digital_femsa/api/payment_methods_api.rb +8 -8
  83. data/lib/digital_femsa/api/products_api.rb +10 -10
  84. data/lib/digital_femsa/api/shipping_contacts_api.rb +8 -8
  85. data/lib/digital_femsa/api/shippings_api.rb +10 -10
  86. data/lib/digital_femsa/api/taxes_api.rb +10 -10
  87. data/lib/digital_femsa/api/transactions_api.rb +6 -6
  88. data/lib/digital_femsa/api/transfers_api.rb +8 -8
  89. data/lib/digital_femsa/api/webhook_keys_api.rb +14 -10
  90. data/lib/digital_femsa/api/webhooks_api.rb +23 -16
  91. data/lib/digital_femsa/api_client.rb +9 -5
  92. data/lib/digital_femsa/models/api_key_create_response.rb +1 -1
  93. data/lib/digital_femsa/models/api_key_request.rb +36 -1
  94. data/lib/digital_femsa/models/balance_response.rb +9 -9
  95. data/lib/digital_femsa/models/charge_order_response.rb +1 -1
  96. data/lib/digital_femsa/models/{order_next_action_response.rb → charge_order_response_channel.rb} +34 -18
  97. data/lib/digital_femsa/models/charge_request_payment_method.rb +3 -2
  98. data/lib/digital_femsa/models/charge_response.rb +15 -4
  99. data/lib/digital_femsa/models/charge_response_refunds_data.rb +23 -4
  100. data/lib/digital_femsa/models/charge_update_request.rb +1 -1
  101. data/lib/digital_femsa/models/charges_data_response.rb +15 -4
  102. data/lib/digital_femsa/models/checkout.rb +97 -81
  103. data/lib/digital_femsa/models/checkout_order_template.rb +4 -4
  104. data/lib/digital_femsa/models/checkout_order_template_customer_info.rb +1 -1
  105. data/lib/digital_femsa/models/checkout_request.rb +1 -1
  106. data/lib/digital_femsa/models/checkout_response.rb +1 -1
  107. data/lib/digital_femsa/models/create_customer_fiscal_entities_response.rb +10 -10
  108. data/lib/digital_femsa/models/customer.rb +57 -95
  109. data/lib/digital_femsa/models/customer_address.rb +7 -0
  110. data/lib/digital_femsa/models/customer_fiscal_entities_data_response.rb +10 -10
  111. data/lib/digital_femsa/models/customer_fiscal_entities_request.rb +13 -13
  112. data/lib/digital_femsa/models/customer_info.rb +13 -20
  113. data/lib/digital_femsa/models/customer_payment_method_request.rb +2 -2
  114. data/lib/digital_femsa/models/customer_payment_sources_inner.rb +104 -0
  115. data/lib/digital_femsa/models/customer_response.rb +122 -113
  116. data/lib/digital_femsa/models/customer_shipping_contacts_response.rb +2 -0
  117. data/lib/digital_femsa/models/customers_response.rb +1 -0
  118. data/lib/digital_femsa/models/events_resend_response.rb +1 -1
  119. data/lib/digital_femsa/models/get_charges_response.rb +21 -21
  120. data/lib/digital_femsa/models/get_transactions_response.rb +1 -1
  121. data/lib/digital_femsa/models/log_response.rb +1 -1
  122. data/lib/digital_femsa/models/logs_response.rb +1 -1
  123. data/lib/digital_femsa/models/order_fiscal_entity_response.rb +1 -1
  124. data/lib/digital_femsa/models/order_refund_request.rb +59 -11
  125. data/lib/digital_femsa/models/order_request.rb +69 -79
  126. data/lib/digital_femsa/models/order_response.rb +187 -119
  127. data/lib/digital_femsa/models/{order_next_action_response_redirect_to_url.rb → order_response_channel.rb} +35 -19
  128. data/lib/digital_femsa/models/order_response_charges.rb +1 -1
  129. data/lib/digital_femsa/models/order_response_checkout.rb +1 -0
  130. data/lib/digital_femsa/models/order_response_customer_info.rb +1 -0
  131. data/lib/digital_femsa/models/order_response_shipping_contact.rb +3 -0
  132. data/lib/digital_femsa/models/order_update_fiscal_entity_request.rb +1 -1
  133. data/lib/digital_femsa/models/order_update_request.rb +106 -65
  134. data/lib/digital_femsa/models/payment_method_cash.rb +1 -1
  135. data/lib/digital_femsa/models/payment_method_cash_request.rb +2 -1
  136. data/lib/digital_femsa/models/product.rb +103 -95
  137. data/lib/digital_femsa/models/product_data_response.rb +103 -95
  138. data/lib/digital_femsa/models/product_order_response.rb +103 -95
  139. data/lib/digital_femsa/models/shipping_order_response.rb +11 -1
  140. data/lib/digital_femsa/models/shipping_request.rb +12 -1
  141. data/lib/digital_femsa/models/transaction_response.rb +172 -99
  142. data/lib/digital_femsa/models/transfers_response.rb +1 -1
  143. data/lib/digital_femsa/models/transfers_response_destination.rb +312 -0
  144. data/lib/digital_femsa/models/update_customer.rb +42 -85
  145. data/lib/digital_femsa/models/update_customer_fiscal_entities_response.rb +10 -10
  146. data/lib/digital_femsa/models/update_order_discount_lines_request.rb +34 -0
  147. data/lib/digital_femsa/models/update_order_tax_request.rb +2 -2
  148. data/lib/digital_femsa/models/update_payment_methods_amount.rb +105 -0
  149. data/lib/digital_femsa/models/update_payment_methods_expires_at.rb +105 -0
  150. data/lib/digital_femsa/models/update_product.rb +85 -58
  151. data/lib/digital_femsa/models/webhook_key_delete_response.rb +1 -1
  152. data/lib/digital_femsa/models/webhook_key_request.rb +1 -0
  153. data/lib/digital_femsa/models/webhook_key_response.rb +1 -1
  154. data/lib/digital_femsa/models/webhook_request.rb +1 -1
  155. data/lib/digital_femsa/models/webhook_response.rb +1 -1
  156. data/lib/digital_femsa/models/webhook_update_request.rb +1 -1
  157. data/lib/digital_femsa/version.rb +1 -1
  158. data/lib/digital_femsa.rb +2 -6
  159. data/templates/ruby/api_client.mustache +8 -4
  160. metadata +26 -26
  161. data/docs/CustomerAntifraudInfo.md +0 -20
  162. data/docs/CustomerAntifraudInfoResponse.md +0 -20
  163. data/docs/OrderNextActionResponse.md +0 -20
  164. data/docs/OrderNextActionResponseRedirectToUrl.md +0 -20
  165. data/docs/SmsCheckoutRequest.md +0 -18
  166. data/docs/UpdateCustomerAntifraudInfo.md +0 -20
@@ -0,0 +1,312 @@
1
+ =begin
2
+ #Femsa API
3
+
4
+ #Femsa sdk
5
+
6
+ The version of the OpenAPI document: 2.1.0
7
+ Contact: engineering@femsa.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 DigitalFemsa
17
+ # Destination payout method used to make the transfer.
18
+ class TransfersResponseDestination
19
+ # Unique identifier of the payee.
20
+ attr_accessor :payee_id
21
+
22
+ # Unique identifier of the payout method.
23
+ attr_accessor :id
24
+
25
+ # Date and time of creation of the payout method in Unix format.
26
+ attr_accessor :created_at
27
+
28
+ # Object name, present for bank transfer destination.
29
+ attr_accessor :object
30
+
31
+ # Destination type.
32
+ attr_accessor :type
33
+
34
+ # Last 4 digits of the destination account number.
35
+ attr_accessor :last4
36
+
37
+ # Name of the account holder.
38
+ attr_accessor :account_holder_name
39
+
40
+ # Name of the bank.
41
+ attr_accessor :bank
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'payee_id' => :'payee_id',
47
+ :'id' => :'id',
48
+ :'created_at' => :'created_at',
49
+ :'object' => :'object',
50
+ :'type' => :'type',
51
+ :'last4' => :'last4',
52
+ :'account_holder_name' => :'account_holder_name',
53
+ :'bank' => :'bank'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'payee_id' => :'String',
66
+ :'id' => :'String',
67
+ :'created_at' => :'Integer',
68
+ :'object' => :'String',
69
+ :'type' => :'String',
70
+ :'last4' => :'String',
71
+ :'account_holder_name' => :'String',
72
+ :'bank' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'object',
80
+ :'type',
81
+ :'last4',
82
+ :'account_holder_name',
83
+ :'bank'
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DigitalFemsa::TransfersResponseDestination` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!self.class.attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DigitalFemsa::TransfersResponseDestination`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'payee_id')
103
+ self.payee_id = attributes[:'payee_id']
104
+ else
105
+ self.payee_id = nil
106
+ end
107
+
108
+ if attributes.key?(:'id')
109
+ self.id = attributes[:'id']
110
+ else
111
+ self.id = nil
112
+ end
113
+
114
+ if attributes.key?(:'created_at')
115
+ self.created_at = attributes[:'created_at']
116
+ else
117
+ self.created_at = nil
118
+ end
119
+
120
+ if attributes.key?(:'object')
121
+ self.object = attributes[:'object']
122
+ end
123
+
124
+ if attributes.key?(:'type')
125
+ self.type = attributes[:'type']
126
+ end
127
+
128
+ if attributes.key?(:'last4')
129
+ self.last4 = attributes[:'last4']
130
+ end
131
+
132
+ if attributes.key?(:'account_holder_name')
133
+ self.account_holder_name = attributes[:'account_holder_name']
134
+ end
135
+
136
+ if attributes.key?(:'bank')
137
+ self.bank = attributes[:'bank']
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
+ invalid_properties = Array.new
146
+ if @payee_id.nil?
147
+ invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
148
+ end
149
+
150
+ if @id.nil?
151
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
152
+ end
153
+
154
+ if @created_at.nil?
155
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
156
+ end
157
+
158
+ invalid_properties
159
+ end
160
+
161
+ # Check to see if the all the properties in the model are valid
162
+ # @return true if the model is valid
163
+ def valid?
164
+ warn '[DEPRECATED] the `valid?` method is obsolete'
165
+ return false if @payee_id.nil?
166
+ return false if @id.nil?
167
+ return false if @created_at.nil?
168
+ true
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ payee_id == o.payee_id &&
177
+ id == o.id &&
178
+ created_at == o.created_at &&
179
+ object == o.object &&
180
+ type == o.type &&
181
+ last4 == o.last4 &&
182
+ account_holder_name == o.account_holder_name &&
183
+ bank == o.bank
184
+ end
185
+
186
+ # @see the `==` method
187
+ # @param [Object] Object to be compared
188
+ def eql?(o)
189
+ self == o
190
+ end
191
+
192
+ # Calculates hash code according to all attributes.
193
+ # @return [Integer] Hash code
194
+ def hash
195
+ [payee_id, id, created_at, object, type, last4, account_holder_name, bank].hash
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def self.build_from_hash(attributes)
202
+ return nil unless attributes.is_a?(Hash)
203
+ attributes = attributes.transform_keys(&:to_sym)
204
+ transformed_hash = {}
205
+ openapi_types.each_pair do |key, type|
206
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
207
+ transformed_hash["#{key}"] = nil
208
+ elsif type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[attribute_map[key]].is_a?(Array)
212
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
213
+ end
214
+ elsif !attributes[attribute_map[key]].nil?
215
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
216
+ end
217
+ end
218
+ new(transformed_hash)
219
+ end
220
+
221
+ # Deserializes the data based on type
222
+ # @param string type Data type
223
+ # @param string value Value to be deserialized
224
+ # @return [Object] Deserialized data
225
+ def self._deserialize(type, value)
226
+ case type.to_sym
227
+ when :Time
228
+ Time.parse(value)
229
+ when :Date
230
+ Date.parse(value)
231
+ when :String
232
+ value.to_s
233
+ when :Integer
234
+ value.to_i
235
+ when :Float
236
+ value.to_f
237
+ when :Boolean
238
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
+ true
240
+ else
241
+ false
242
+ end
243
+ when :Object
244
+ # generic object (usually a Hash), return directly
245
+ value
246
+ when /\AArray<(?<inner_type>.+)>\z/
247
+ inner_type = Regexp.last_match[:inner_type]
248
+ value.map { |v| _deserialize(inner_type, v) }
249
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
+ k_type = Regexp.last_match[:k_type]
251
+ v_type = Regexp.last_match[:v_type]
252
+ {}.tap do |hash|
253
+ value.each do |k, v|
254
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
+ end
256
+ end
257
+ else # model
258
+ # models (e.g. Pet) or oneOf
259
+ klass = DigitalFemsa.const_get(type)
260
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+
310
+ end
311
+
312
+ end
@@ -14,56 +14,51 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module DigitalFemsa
17
- # update customer
17
+ # Request body to update a customer.
18
18
  class UpdateCustomer
19
- attr_accessor :antifraud_info
20
-
21
- # It is a parameter that allows to identify in the response, the Femsa ID of a payment method (payment_id)
22
- attr_accessor :default_payment_source_id
19
+ # Customer's name.
20
+ attr_accessor :name
23
21
 
24
- # An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc).
22
+ # Customer email address.
25
23
  attr_accessor :email
26
24
 
27
- # Client's name
28
- attr_accessor :name
29
-
30
- # Is the customer's phone number
25
+ # Customer phone number.
31
26
  attr_accessor :phone
32
27
 
33
- # It is a parameter that allows to identify in the response, the Femsa ID of the shipping address (shipping_contact)
34
- attr_accessor :default_shipping_contact_id
35
-
36
- # It is a value that allows identifying if the email is corporate or not.
28
+ # True if the customer represents a company.
37
29
  attr_accessor :corporate
38
30
 
39
- # It is an undefined value.
31
+ # Merchant-defined reference used to identify the customer in your system.
40
32
  attr_accessor :custom_reference
41
33
 
42
- attr_accessor :fiscal_entities
43
-
34
+ # Arbitrary metadata associated with the customer.
44
35
  attr_accessor :metadata
45
36
 
46
- # Contains details of the payment methods that the customer has active or has used in Femsa
37
+ # Customer payment sources to create/attach (offline recurrent references).
47
38
  attr_accessor :payment_sources
48
39
 
49
- # Contains the detail of the shipping addresses that the client has active or has used in Femsa
50
- attr_accessor :shipping_contacts
40
+ # Sets the default payment source for the customer (must be an existing payment source on the customer).
41
+ attr_accessor :default_payment_source_id
42
+
43
+ # Sets the default fiscal entity for the customer (must be an existing fiscal entity on the customer).
44
+ attr_accessor :default_fiscal_entity_id
45
+
46
+ # Sets the default shipping contact for the customer (must be an existing shipping contact on the customer).
47
+ attr_accessor :default_shipping_contact_id
51
48
 
52
49
  # Attribute mapping from ruby-style variable name to JSON key.
53
50
  def self.attribute_map
54
51
  {
55
- :'antifraud_info' => :'antifraud_info',
56
- :'default_payment_source_id' => :'default_payment_source_id',
57
- :'email' => :'email',
58
52
  :'name' => :'name',
53
+ :'email' => :'email',
59
54
  :'phone' => :'phone',
60
- :'default_shipping_contact_id' => :'default_shipping_contact_id',
61
55
  :'corporate' => :'corporate',
62
56
  :'custom_reference' => :'custom_reference',
63
- :'fiscal_entities' => :'fiscal_entities',
64
57
  :'metadata' => :'metadata',
65
58
  :'payment_sources' => :'payment_sources',
66
- :'shipping_contacts' => :'shipping_contacts'
59
+ :'default_payment_source_id' => :'default_payment_source_id',
60
+ :'default_fiscal_entity_id' => :'default_fiscal_entity_id',
61
+ :'default_shipping_contact_id' => :'default_shipping_contact_id'
67
62
  }
68
63
  end
69
64
 
@@ -75,25 +70,22 @@ module DigitalFemsa
75
70
  # Attribute type mapping.
76
71
  def self.openapi_types
77
72
  {
78
- :'antifraud_info' => :'UpdateCustomerAntifraudInfo',
79
- :'default_payment_source_id' => :'String',
80
- :'email' => :'String',
81
73
  :'name' => :'String',
74
+ :'email' => :'String',
82
75
  :'phone' => :'String',
83
- :'default_shipping_contact_id' => :'String',
84
76
  :'corporate' => :'Boolean',
85
77
  :'custom_reference' => :'String',
86
- :'fiscal_entities' => :'Array<CustomerFiscalEntitiesRequest>',
87
78
  :'metadata' => :'Hash<String, Object>',
88
79
  :'payment_sources' => :'Array<CustomerPaymentMethodsRequest>',
89
- :'shipping_contacts' => :'Array<CustomerShippingContacts>'
80
+ :'default_payment_source_id' => :'String',
81
+ :'default_fiscal_entity_id' => :'String',
82
+ :'default_shipping_contact_id' => :'String'
90
83
  }
91
84
  end
92
85
 
93
86
  # List of attributes with nullable: true
94
87
  def self.openapi_nullable
95
88
  Set.new([
96
- :'antifraud_info',
97
89
  ])
98
90
  end
99
91
 
@@ -112,46 +104,26 @@ module DigitalFemsa
112
104
  h[k.to_sym] = v
113
105
  }
114
106
 
115
- if attributes.key?(:'antifraud_info')
116
- self.antifraud_info = attributes[:'antifraud_info']
117
- end
118
-
119
- if attributes.key?(:'default_payment_source_id')
120
- self.default_payment_source_id = attributes[:'default_payment_source_id']
107
+ if attributes.key?(:'name')
108
+ self.name = attributes[:'name']
121
109
  end
122
110
 
123
111
  if attributes.key?(:'email')
124
112
  self.email = attributes[:'email']
125
113
  end
126
114
 
127
- if attributes.key?(:'name')
128
- self.name = attributes[:'name']
129
- end
130
-
131
115
  if attributes.key?(:'phone')
132
116
  self.phone = attributes[:'phone']
133
117
  end
134
118
 
135
- if attributes.key?(:'default_shipping_contact_id')
136
- self.default_shipping_contact_id = attributes[:'default_shipping_contact_id']
137
- end
138
-
139
119
  if attributes.key?(:'corporate')
140
120
  self.corporate = attributes[:'corporate']
141
- else
142
- self.corporate = false
143
121
  end
144
122
 
145
123
  if attributes.key?(:'custom_reference')
146
124
  self.custom_reference = attributes[:'custom_reference']
147
125
  end
148
126
 
149
- if attributes.key?(:'fiscal_entities')
150
- if (value = attributes[:'fiscal_entities']).is_a?(Array)
151
- self.fiscal_entities = value
152
- end
153
- end
154
-
155
127
  if attributes.key?(:'metadata')
156
128
  if (value = attributes[:'metadata']).is_a?(Hash)
157
129
  self.metadata = value
@@ -164,10 +136,16 @@ module DigitalFemsa
164
136
  end
165
137
  end
166
138
 
167
- if attributes.key?(:'shipping_contacts')
168
- if (value = attributes[:'shipping_contacts']).is_a?(Array)
169
- self.shipping_contacts = value
170
- end
139
+ if attributes.key?(:'default_payment_source_id')
140
+ self.default_payment_source_id = attributes[:'default_payment_source_id']
141
+ end
142
+
143
+ if attributes.key?(:'default_fiscal_entity_id')
144
+ self.default_fiscal_entity_id = attributes[:'default_fiscal_entity_id']
145
+ end
146
+
147
+ if attributes.key?(:'default_shipping_contact_id')
148
+ self.default_shipping_contact_id = attributes[:'default_shipping_contact_id']
171
149
  end
172
150
  end
173
151
 
@@ -176,10 +154,6 @@ module DigitalFemsa
176
154
  def list_invalid_properties
177
155
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
178
156
  invalid_properties = Array.new
179
- if !@metadata.nil? && @metadata.length > 100
180
- invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.')
181
- end
182
-
183
157
  invalid_properties
184
158
  end
185
159
 
@@ -187,41 +161,24 @@ module DigitalFemsa
187
161
  # @return true if the model is valid
188
162
  def valid?
189
163
  warn '[DEPRECATED] the `valid?` method is obsolete'
190
- return false if !@metadata.nil? && @metadata.length > 100
191
164
  true
192
165
  end
193
166
 
194
- # Custom attribute writer method with validation
195
- # @param [Object] metadata Value to be assigned
196
- def metadata=(metadata)
197
- if metadata.nil?
198
- fail ArgumentError, 'metadata cannot be nil'
199
- end
200
-
201
- if metadata.length > 100
202
- fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.'
203
- end
204
-
205
- @metadata = metadata
206
- end
207
-
208
167
  # Checks equality by comparing each attribute.
209
168
  # @param [Object] Object to be compared
210
169
  def ==(o)
211
170
  return true if self.equal?(o)
212
171
  self.class == o.class &&
213
- antifraud_info == o.antifraud_info &&
214
- default_payment_source_id == o.default_payment_source_id &&
215
- email == o.email &&
216
172
  name == o.name &&
173
+ email == o.email &&
217
174
  phone == o.phone &&
218
- default_shipping_contact_id == o.default_shipping_contact_id &&
219
175
  corporate == o.corporate &&
220
176
  custom_reference == o.custom_reference &&
221
- fiscal_entities == o.fiscal_entities &&
222
177
  metadata == o.metadata &&
223
178
  payment_sources == o.payment_sources &&
224
- shipping_contacts == o.shipping_contacts
179
+ default_payment_source_id == o.default_payment_source_id &&
180
+ default_fiscal_entity_id == o.default_fiscal_entity_id &&
181
+ default_shipping_contact_id == o.default_shipping_contact_id
225
182
  end
226
183
 
227
184
  # @see the `==` method
@@ -233,7 +190,7 @@ module DigitalFemsa
233
190
  # Calculates hash code according to all attributes.
234
191
  # @return [Integer] Hash code
235
192
  def hash
236
- [antifraud_info, default_payment_source_id, email, name, phone, default_shipping_contact_id, corporate, custom_reference, fiscal_entities, metadata, payment_sources, shipping_contacts].hash
193
+ [name, email, phone, corporate, custom_reference, metadata, payment_sources, default_payment_source_id, default_fiscal_entity_id, default_shipping_contact_id].hash
237
194
  end
238
195
 
239
196
  # Builds the object from hash
@@ -19,14 +19,14 @@ module DigitalFemsa
19
19
 
20
20
  attr_accessor :tax_id
21
21
 
22
+ attr_accessor :name
23
+
22
24
  attr_accessor :email
23
25
 
24
26
  attr_accessor :phone
25
27
 
26
28
  attr_accessor :metadata
27
29
 
28
- attr_accessor :company_name
29
-
30
30
  attr_accessor :id
31
31
 
32
32
  attr_accessor :object
@@ -42,10 +42,10 @@ module DigitalFemsa
42
42
  {
43
43
  :'address' => :'address',
44
44
  :'tax_id' => :'tax_id',
45
+ :'name' => :'name',
45
46
  :'email' => :'email',
46
47
  :'phone' => :'phone',
47
48
  :'metadata' => :'metadata',
48
- :'company_name' => :'company_name',
49
49
  :'id' => :'id',
50
50
  :'object' => :'object',
51
51
  :'created_at' => :'created_at',
@@ -64,10 +64,10 @@ module DigitalFemsa
64
64
  {
65
65
  :'address' => :'CustomerAddress',
66
66
  :'tax_id' => :'String',
67
+ :'name' => :'String',
67
68
  :'email' => :'String',
68
69
  :'phone' => :'String',
69
70
  :'metadata' => :'Hash<String, Object>',
70
- :'company_name' => :'String',
71
71
  :'id' => :'String',
72
72
  :'object' => :'String',
73
73
  :'created_at' => :'Integer',
@@ -114,6 +114,10 @@ module DigitalFemsa
114
114
  self.tax_id = attributes[:'tax_id']
115
115
  end
116
116
 
117
+ if attributes.key?(:'name')
118
+ self.name = attributes[:'name']
119
+ end
120
+
117
121
  if attributes.key?(:'email')
118
122
  self.email = attributes[:'email']
119
123
  end
@@ -128,10 +132,6 @@ module DigitalFemsa
128
132
  end
129
133
  end
130
134
 
131
- if attributes.key?(:'company_name')
132
- self.company_name = attributes[:'company_name']
133
- end
134
-
135
135
  if attributes.key?(:'id')
136
136
  self.id = attributes[:'id']
137
137
  else
@@ -201,10 +201,10 @@ module DigitalFemsa
201
201
  self.class == o.class &&
202
202
  address == o.address &&
203
203
  tax_id == o.tax_id &&
204
+ name == o.name &&
204
205
  email == o.email &&
205
206
  phone == o.phone &&
206
207
  metadata == o.metadata &&
207
- company_name == o.company_name &&
208
208
  id == o.id &&
209
209
  object == o.object &&
210
210
  created_at == o.created_at &&
@@ -221,7 +221,7 @@ module DigitalFemsa
221
221
  # Calculates hash code according to all attributes.
222
222
  # @return [Integer] Hash code
223
223
  def hash
224
- [address, tax_id, email, phone, metadata, company_name, id, object, created_at, parent_id, default].hash
224
+ [address, tax_id, name, email, phone, metadata, id, object, created_at, parent_id, default].hash
225
225
  end
226
226
 
227
227
  # Builds the object from hash
@@ -23,6 +23,28 @@ module DigitalFemsa
23
23
 
24
24
  attr_accessor :type
25
25
 
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
26
48
  # Attribute mapping from ruby-style variable name to JSON key.
27
49
  def self.attribute_map
28
50
  {
@@ -97,6 +119,8 @@ module DigitalFemsa
97
119
  def valid?
98
120
  warn '[DEPRECATED] the `valid?` method is obsolete'
99
121
  return false if !@amount.nil? && @amount < 0
122
+ type_validator = EnumAttributeValidator.new('String', ["loyalty", "campaign", "coupon", "sign"])
123
+ return false unless type_validator.valid?(@type)
100
124
  true
101
125
  end
102
126
 
@@ -114,6 +138,16 @@ module DigitalFemsa
114
138
  @amount = amount
115
139
  end
116
140
 
141
+ # Custom attribute writer method checking allowed values (enum).
142
+ # @param [Object] type Object to be assigned
143
+ def type=(type)
144
+ validator = EnumAttributeValidator.new('String', ["loyalty", "campaign", "coupon", "sign"])
145
+ unless validator.valid?(type)
146
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
147
+ end
148
+ @type = type
149
+ end
150
+
117
151
  # Checks equality by comparing each attribute.
118
152
  # @param [Object] Object to be compared
119
153
  def ==(o)