wire4_client 1.1.2 → 1.1.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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +27 -0
  4. data/docs/AccountReassigned.md +1 -1
  5. data/docs/AccountResponse.md +1 -0
  6. data/docs/BeneficiaryDTO.md +10 -0
  7. data/docs/CargosRecurrentesApi.md +110 -0
  8. data/docs/CepResponse.md +1 -0
  9. data/docs/CepSearchBanxico.md +1 -0
  10. data/docs/CertificateRequest.md +1 -1
  11. data/docs/CodiCodeQrResponseDTO.md +1 -0
  12. data/docs/CodiCodeRequestDTO.md +6 -3
  13. data/docs/ConfirmRecurringCharge.md +9 -0
  14. data/docs/CuentasDeBeneficiariosSPEIApi.md +4 -0
  15. data/docs/CuentasDeBeneficiariosSPIDApi.md +4 -0
  16. data/docs/Customer.md +9 -0
  17. data/docs/Deposit.md +1 -0
  18. data/docs/Depositant.md +1 -0
  19. data/docs/DepositantCountResponse.md +8 -0
  20. data/docs/DepositantesApi.md +164 -1
  21. data/docs/FailedChargesDataDTO.md +13 -0
  22. data/docs/MessageDepositReceived.md +3 -0
  23. data/docs/PaymentRequestReportDTO.md +17 -0
  24. data/docs/PaymentRequestReq.md +18 -0
  25. data/docs/PaymentRequestResponse.md +10 -0
  26. data/docs/PaymentsSpeiAndSpidOrderId.md +9 -0
  27. data/docs/PaymentsSpeiAndSpidRequestId.md +12 -0
  28. data/docs/Person.md +1 -1
  29. data/docs/Product.md +11 -0
  30. data/docs/RecurringChargeRequest.md +14 -0
  31. data/docs/ReporteDeSolicitudesDePagosApi.md +107 -0
  32. data/docs/SolicitudDePagosApi.md +59 -0
  33. data/docs/SpidBeneficiaryResponse.md +1 -0
  34. data/docs/SuccessChargesDataDTO.md +12 -0
  35. data/docs/SuccessDataDTO.md +9 -0
  36. data/docs/TransactionSpeiSpid.md +15 -0
  37. data/docs/TransactionsRegister.md +11 -0
  38. data/docs/TransferenciasSPEIApi.md +163 -0
  39. data/lib/wire4_client/api/cargos_recurrentes_api.rb +143 -0
  40. data/lib/wire4_client/api/cuentas_de_beneficiarios_spei_api.rb +6 -0
  41. data/lib/wire4_client/api/cuentas_de_beneficiarios_spid_api.rb +6 -0
  42. data/lib/wire4_client/api/depositantes_api.rb +207 -2
  43. data/lib/wire4_client/api/reporte_de_solicitudes_de_pagos_api.rb +134 -0
  44. data/lib/wire4_client/api/solicitud_de_pagos_api.rb +84 -0
  45. data/lib/wire4_client/api/transferencias_spei_api.rb +234 -4
  46. data/lib/wire4_client/models/account_reassigned.rb +11 -11
  47. data/lib/wire4_client/models/account_response.rb +11 -1
  48. data/lib/wire4_client/models/amount_request.rb +10 -10
  49. data/lib/wire4_client/models/beneficiary_dto.rb +201 -0
  50. data/lib/wire4_client/models/cep_response.rb +45 -1
  51. data/lib/wire4_client/models/cep_search_banxico.rb +48 -4
  52. data/lib/wire4_client/models/certificate_request.rb +6 -15
  53. data/lib/wire4_client/models/codi_code_qr_response_dto.rb +15 -5
  54. data/lib/wire4_client/models/codi_code_request_dto.rb +94 -20
  55. data/lib/wire4_client/models/codi_operations_filters_request_dto.rb +2 -2
  56. data/lib/wire4_client/models/confirm_recurring_charge.rb +194 -0
  57. data/lib/wire4_client/models/customer.rb +205 -0
  58. data/lib/wire4_client/models/deposit.rb +48 -4
  59. data/lib/wire4_client/models/depositant.rb +14 -4
  60. data/lib/wire4_client/models/depositant_count_response.rb +185 -0
  61. data/lib/wire4_client/models/failed_charges_data_dto.rb +228 -0
  62. data/lib/wire4_client/models/message_deposit_received.rb +31 -1
  63. data/lib/wire4_client/models/operations.rb +4 -4
  64. data/lib/wire4_client/models/payment_codi.rb +2 -2
  65. data/lib/wire4_client/models/payment_request_report_dto.rb +300 -0
  66. data/lib/wire4_client/models/payment_request_req.rb +401 -0
  67. data/lib/wire4_client/models/payment_request_response.rb +204 -0
  68. data/lib/wire4_client/models/payments_spei_and_spid_order_id.rb +199 -0
  69. data/lib/wire4_client/models/payments_spei_and_spid_request_id.rb +229 -0
  70. data/lib/wire4_client/models/person.rb +0 -5
  71. data/lib/wire4_client/models/product.rb +288 -0
  72. data/lib/wire4_client/models/recurring_charge_request.rb +278 -0
  73. data/lib/wire4_client/models/sales_point_request.rb +5 -5
  74. data/lib/wire4_client/models/spid_beneficiary_response.rb +11 -1
  75. data/lib/wire4_client/models/success_charges_data_dto.rb +219 -0
  76. data/lib/wire4_client/models/success_data_dto.rb +226 -0
  77. data/lib/wire4_client/models/transaction_outgoing.rb +5 -5
  78. data/lib/wire4_client/models/transaction_spei_spid.rb +390 -0
  79. data/lib/wire4_client/models/transactions_register.rb +229 -0
  80. data/lib/wire4_client/version.rb +1 -1
  81. data/lib/wire4_client.rb +19 -0
  82. data/spec/api/cargos_recurrentes_api_spec.rb +61 -0
  83. data/spec/api/cuentas_de_beneficiarios_spei_api_spec.rb +2 -0
  84. data/spec/api/cuentas_de_beneficiarios_spid_api_spec.rb +2 -0
  85. data/spec/api/depositantes_api_spec.rb +42 -1
  86. data/spec/api/reporte_de_solicitudes_de_pagos_api_spec.rb +59 -0
  87. data/spec/api/solicitud_de_pagos_api_spec.rb +48 -0
  88. data/spec/api/transferencias_spei_api_spec.rb +42 -0
  89. data/spec/models/account_reassigned_spec.rb +3 -3
  90. data/spec/models/account_response_spec.rb +6 -0
  91. data/spec/models/beneficiary_dto_spec.rb +53 -0
  92. data/spec/models/cep_response_spec.rb +10 -0
  93. data/spec/models/cep_search_banxico_spec.rb +10 -0
  94. data/spec/models/codi_code_qr_response_dto_spec.rb +8 -2
  95. data/spec/models/codi_code_request_dto_spec.rb +23 -1
  96. data/spec/models/codi_operations_filters_request_dto_spec.rb +1 -1
  97. data/spec/models/confirm_recurring_charge_spec.rb +47 -0
  98. data/spec/models/customer_spec.rb +47 -0
  99. data/spec/models/deposit_spec.rb +10 -0
  100. data/spec/models/depositant_count_response_spec.rb +41 -0
  101. data/spec/models/depositant_spec.rb +6 -0
  102. data/spec/models/failed_charges_data_dto_spec.rb +71 -0
  103. data/spec/models/message_deposit_received_spec.rb +18 -0
  104. data/spec/models/operations_spec.rb +2 -2
  105. data/spec/models/payment_codi_spec.rb +1 -1
  106. data/spec/models/payment_request_report_dto_spec.rb +99 -0
  107. data/spec/models/payment_request_req_spec.rb +109 -0
  108. data/spec/models/payment_request_response_spec.rb +53 -0
  109. data/spec/models/payments_spei_and_spid_order_id_spec.rb +47 -0
  110. data/spec/models/payments_spei_and_spid_request_id_spec.rb +65 -0
  111. data/spec/models/product_spec.rb +63 -0
  112. data/spec/models/recurring_charge_request_spec.rb +77 -0
  113. data/spec/models/spid_beneficiary_response_spec.rb +6 -0
  114. data/spec/models/success_charges_data_dto_spec.rb +65 -0
  115. data/spec/models/success_data_dto_spec.rb +51 -0
  116. data/spec/models/transaction_spei_spid_spec.rb +83 -0
  117. data/spec/models/transactions_register_spec.rb +59 -0
  118. data/wire4_client-1.1.3.gem +0 -0
  119. data/wire4_client.gemspec +7 -7
  120. metadata +108 -55
@@ -0,0 +1,300 @@
1
+ =begin
2
+ #Wire4RestAPI
3
+
4
+ #Referencia de la API de Wire4
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Wire4Client
16
+ class PaymentRequestReportDTO
17
+ attr_accessor :amount
18
+
19
+ attr_accessor :cancel_return_url
20
+
21
+ attr_accessor :customer
22
+
23
+ attr_accessor :description
24
+
25
+ attr_accessor :due_date
26
+
27
+ attr_accessor :failed_charges
28
+
29
+ attr_accessor :order_id
30
+
31
+ attr_accessor :return_url
32
+
33
+ attr_accessor :status
34
+
35
+ attr_accessor :success_charge
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'amount' => :'amount',
63
+ :'cancel_return_url' => :'cancel_return_url',
64
+ :'customer' => :'customer',
65
+ :'description' => :'description',
66
+ :'due_date' => :'due_date',
67
+ :'failed_charges' => :'failed_charges',
68
+ :'order_id' => :'order_id',
69
+ :'return_url' => :'return_url',
70
+ :'status' => :'status',
71
+ :'success_charge' => :'success_charge'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'amount' => :'String',
79
+ :'cancel_return_url' => :'String',
80
+ :'customer' => :'Customer',
81
+ :'description' => :'String',
82
+ :'due_date' => :'String',
83
+ :'failed_charges' => :'Array<FailedChargesDataDTO>',
84
+ :'order_id' => :'String',
85
+ :'return_url' => :'String',
86
+ :'status' => :'String',
87
+ :'success_charge' => :'SuccessDataDTO'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ return unless attributes.is_a?(Hash)
95
+
96
+ # convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
98
+
99
+ if attributes.has_key?(:'amount')
100
+ self.amount = attributes[:'amount']
101
+ end
102
+
103
+ if attributes.has_key?(:'cancel_return_url')
104
+ self.cancel_return_url = attributes[:'cancel_return_url']
105
+ end
106
+
107
+ if attributes.has_key?(:'customer')
108
+ self.customer = attributes[:'customer']
109
+ end
110
+
111
+ if attributes.has_key?(:'description')
112
+ self.description = attributes[:'description']
113
+ end
114
+
115
+ if attributes.has_key?(:'due_date')
116
+ self.due_date = attributes[:'due_date']
117
+ end
118
+
119
+ if attributes.has_key?(:'failed_charges')
120
+ if (value = attributes[:'failed_charges']).is_a?(Array)
121
+ self.failed_charges = value
122
+ end
123
+ end
124
+
125
+ if attributes.has_key?(:'order_id')
126
+ self.order_id = attributes[:'order_id']
127
+ end
128
+
129
+ if attributes.has_key?(:'return_url')
130
+ self.return_url = attributes[:'return_url']
131
+ end
132
+
133
+ if attributes.has_key?(:'status')
134
+ self.status = attributes[:'status']
135
+ end
136
+
137
+ if attributes.has_key?(:'success_charge')
138
+ self.success_charge = attributes[:'success_charge']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ status_validator = EnumAttributeValidator.new('String', ['NEW', 'REQUESTED', 'PAID', 'CANCELLED'])
153
+ return false unless status_validator.valid?(@status)
154
+ true
155
+ end
156
+
157
+ # Custom attribute writer method checking allowed values (enum).
158
+ # @param [Object] status Object to be assigned
159
+ def status=(status)
160
+ validator = EnumAttributeValidator.new('String', ['NEW', 'REQUESTED', 'PAID', 'CANCELLED'])
161
+ unless validator.valid?(status)
162
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
163
+ end
164
+ @status = status
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ amount == o.amount &&
173
+ cancel_return_url == o.cancel_return_url &&
174
+ customer == o.customer &&
175
+ description == o.description &&
176
+ due_date == o.due_date &&
177
+ failed_charges == o.failed_charges &&
178
+ order_id == o.order_id &&
179
+ return_url == o.return_url &&
180
+ status == o.status &&
181
+ success_charge == o.success_charge
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Fixnum] Hash code
192
+ def hash
193
+ [amount, cancel_return_url, customer, description, due_date, failed_charges, order_id, return_url, status, success_charge].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ self.class.swagger_types.each_pair do |key, type|
202
+ if type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
206
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
207
+ end
208
+ elsif !attributes[self.class.attribute_map[key]].nil?
209
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
210
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
211
+ end
212
+
213
+ self
214
+ end
215
+
216
+ # Deserializes the data based on type
217
+ # @param string type Data type
218
+ # @param string value Value to be deserialized
219
+ # @return [Object] Deserialized data
220
+ def _deserialize(type, value)
221
+ case type.to_sym
222
+ when :DateTime
223
+ DateTime.parse(value)
224
+ when :Date
225
+ Date.parse(value)
226
+ when :String
227
+ value.to_s
228
+ when :Integer
229
+ value.to_i
230
+ when :Float
231
+ value.to_f
232
+ when :BOOLEAN
233
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
234
+ true
235
+ else
236
+ false
237
+ end
238
+ when :Object
239
+ # generic object (usually a Hash), return directly
240
+ value
241
+ when /\AArray<(?<inner_type>.+)>\z/
242
+ inner_type = Regexp.last_match[:inner_type]
243
+ value.map { |v| _deserialize(inner_type, v) }
244
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
245
+ k_type = Regexp.last_match[:k_type]
246
+ v_type = Regexp.last_match[:v_type]
247
+ {}.tap do |hash|
248
+ value.each do |k, v|
249
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
250
+ end
251
+ end
252
+ else # model
253
+ temp_model = Wire4Client.const_get(type).new
254
+ temp_model.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ next if value.nil?
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+ end
300
+ end
@@ -0,0 +1,401 @@
1
+ =begin
2
+ #Wire4RestAPI
3
+
4
+ #Referencia de la API de Wire4
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Wire4Client
16
+ # Objeto request para solicitud de pago
17
+ class PaymentRequestReq
18
+ # Es el monto de la solicitud de pago
19
+ attr_accessor :amount
20
+
21
+ # Es la dirección URL a la que se redirigirá en caso de que el usuario cancele.
22
+ attr_accessor :cancel_return_url
23
+
24
+ # Datos del cliente
25
+ attr_accessor :customer
26
+
27
+ # Es el número de cuenta CLABE donde se realizará el deposito.
28
+ attr_accessor :depositant_account
29
+
30
+ # Es la descripción de la solicitud de pago.
31
+ attr_accessor :description
32
+
33
+ # Es la fecha de operación de la solicitud de pago.
34
+ attr_accessor :due_date
35
+
36
+ # Es la fecha de inicio de la solicitud de pago.
37
+ attr_accessor :from_date
38
+
39
+ attr_accessor :method
40
+
41
+ # Número de orden asignado por el cliente de Wire4
42
+ attr_accessor :order_id
43
+
44
+ # Es la dirección URL a la que se redirigirá en caso de éxito.
45
+ attr_accessor :return_url
46
+
47
+ # Tipo de pago por paycash
48
+ attr_accessor :type
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'amount' => :'amount',
76
+ :'cancel_return_url' => :'cancel_return_url',
77
+ :'customer' => :'customer',
78
+ :'depositant_account' => :'depositant_account',
79
+ :'description' => :'description',
80
+ :'due_date' => :'due_date',
81
+ :'from_date' => :'from_date',
82
+ :'method' => :'method',
83
+ :'order_id' => :'order_id',
84
+ :'return_url' => :'return_url',
85
+ :'type' => :'type'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.swagger_types
91
+ {
92
+ :'amount' => :'Float',
93
+ :'cancel_return_url' => :'String',
94
+ :'customer' => :'Customer',
95
+ :'depositant_account' => :'String',
96
+ :'description' => :'String',
97
+ :'due_date' => :'Date',
98
+ :'from_date' => :'Date',
99
+ :'method' => :'String',
100
+ :'order_id' => :'String',
101
+ :'return_url' => :'String',
102
+ :'type' => :'String'
103
+ }
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
+
114
+ if attributes.has_key?(:'amount')
115
+ self.amount = attributes[:'amount']
116
+ end
117
+
118
+ if attributes.has_key?(:'cancel_return_url')
119
+ self.cancel_return_url = attributes[:'cancel_return_url']
120
+ end
121
+
122
+ if attributes.has_key?(:'customer')
123
+ self.customer = attributes[:'customer']
124
+ end
125
+
126
+ if attributes.has_key?(:'depositant_account')
127
+ self.depositant_account = attributes[:'depositant_account']
128
+ end
129
+
130
+ if attributes.has_key?(:'description')
131
+ self.description = attributes[:'description']
132
+ end
133
+
134
+ if attributes.has_key?(:'due_date')
135
+ self.due_date = attributes[:'due_date']
136
+ end
137
+
138
+ if attributes.has_key?(:'from_date')
139
+ self.from_date = attributes[:'from_date']
140
+ end
141
+
142
+ if attributes.has_key?(:'method')
143
+ self.method = attributes[:'method']
144
+ end
145
+
146
+ if attributes.has_key?(:'order_id')
147
+ self.order_id = attributes[:'order_id']
148
+ end
149
+
150
+ if attributes.has_key?(:'return_url')
151
+ self.return_url = attributes[:'return_url']
152
+ end
153
+
154
+ if attributes.has_key?(:'type')
155
+ self.type = attributes[:'type']
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ invalid_properties = Array.new
163
+ if @amount.nil?
164
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
165
+ end
166
+
167
+ if @amount > 100000
168
+ invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000.')
169
+ end
170
+
171
+ if @amount < 0.01
172
+ invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.01.')
173
+ end
174
+
175
+ if @method.nil?
176
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
177
+ end
178
+
179
+ if @order_id.nil?
180
+ invalid_properties.push('invalid value for "order_id", order_id cannot be nil.')
181
+ end
182
+
183
+ if @order_id.to_s.length > 256
184
+ invalid_properties.push('invalid value for "order_id", the character length must be smaller than or equal to 256.')
185
+ end
186
+
187
+ if @order_id.to_s.length < 1
188
+ invalid_properties.push('invalid value for "order_id", the character length must be great than or equal to 1.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ return false if @amount.nil?
198
+ return false if @amount > 100000
199
+ return false if @amount < 0.01
200
+ return false if @method.nil?
201
+ method_validator = EnumAttributeValidator.new('String', ['CARD', 'CASH', 'SPEI'])
202
+ return false unless method_validator.valid?(@method)
203
+ return false if @order_id.nil?
204
+ return false if @order_id.to_s.length > 256
205
+ return false if @order_id.to_s.length < 1
206
+ type_validator = EnumAttributeValidator.new('String', ['RECURRENT', 'ONE_OCCASION'])
207
+ return false unless type_validator.valid?(@type)
208
+ true
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] amount Value to be assigned
213
+ def amount=(amount)
214
+ if amount.nil?
215
+ fail ArgumentError, 'amount cannot be nil'
216
+ end
217
+
218
+ if amount > 100000
219
+ fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000.'
220
+ end
221
+
222
+ if amount < 0.01
223
+ fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.01.'
224
+ end
225
+
226
+ @amount = amount
227
+ end
228
+
229
+ # Custom attribute writer method checking allowed values (enum).
230
+ # @param [Object] method Object to be assigned
231
+ def method=(method)
232
+ validator = EnumAttributeValidator.new('String', ['CARD', 'CASH', 'SPEI'])
233
+ unless validator.valid?(method)
234
+ fail ArgumentError, 'invalid value for "method", must be one of #{validator.allowable_values}.'
235
+ end
236
+ @method = method
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] order_id Value to be assigned
241
+ def order_id=(order_id)
242
+ if order_id.nil?
243
+ fail ArgumentError, 'order_id cannot be nil'
244
+ end
245
+
246
+ if order_id.to_s.length > 256
247
+ fail ArgumentError, 'invalid value for "order_id", the character length must be smaller than or equal to 256.'
248
+ end
249
+
250
+ if order_id.to_s.length < 1
251
+ fail ArgumentError, 'invalid value for "order_id", the character length must be great than or equal to 1.'
252
+ end
253
+
254
+ @order_id = order_id
255
+ end
256
+
257
+ # Custom attribute writer method checking allowed values (enum).
258
+ # @param [Object] type Object to be assigned
259
+ def type=(type)
260
+ validator = EnumAttributeValidator.new('String', ['RECURRENT', 'ONE_OCCASION'])
261
+ unless validator.valid?(type)
262
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
263
+ end
264
+ @type = type
265
+ end
266
+
267
+ # Checks equality by comparing each attribute.
268
+ # @param [Object] Object to be compared
269
+ def ==(o)
270
+ return true if self.equal?(o)
271
+ self.class == o.class &&
272
+ amount == o.amount &&
273
+ cancel_return_url == o.cancel_return_url &&
274
+ customer == o.customer &&
275
+ depositant_account == o.depositant_account &&
276
+ description == o.description &&
277
+ due_date == o.due_date &&
278
+ from_date == o.from_date &&
279
+ method == o.method &&
280
+ order_id == o.order_id &&
281
+ return_url == o.return_url &&
282
+ type == o.type
283
+ end
284
+
285
+ # @see the `==` method
286
+ # @param [Object] Object to be compared
287
+ def eql?(o)
288
+ self == o
289
+ end
290
+
291
+ # Calculates hash code according to all attributes.
292
+ # @return [Fixnum] Hash code
293
+ def hash
294
+ [amount, cancel_return_url, customer, depositant_account, description, due_date, from_date, method, order_id, return_url, type].hash
295
+ end
296
+
297
+ # Builds the object from hash
298
+ # @param [Hash] attributes Model attributes in the form of hash
299
+ # @return [Object] Returns the model itself
300
+ def build_from_hash(attributes)
301
+ return nil unless attributes.is_a?(Hash)
302
+ self.class.swagger_types.each_pair do |key, type|
303
+ if type =~ /\AArray<(.*)>/i
304
+ # check to ensure the input is an array given that the the attribute
305
+ # is documented as an array but the input is not
306
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
307
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
308
+ end
309
+ elsif !attributes[self.class.attribute_map[key]].nil?
310
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
311
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
312
+ end
313
+
314
+ self
315
+ end
316
+
317
+ # Deserializes the data based on type
318
+ # @param string type Data type
319
+ # @param string value Value to be deserialized
320
+ # @return [Object] Deserialized data
321
+ def _deserialize(type, value)
322
+ case type.to_sym
323
+ when :DateTime
324
+ DateTime.parse(value)
325
+ when :Date
326
+ Date.parse(value)
327
+ when :String
328
+ value.to_s
329
+ when :Integer
330
+ value.to_i
331
+ when :Float
332
+ value.to_f
333
+ when :BOOLEAN
334
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
335
+ true
336
+ else
337
+ false
338
+ end
339
+ when :Object
340
+ # generic object (usually a Hash), return directly
341
+ value
342
+ when /\AArray<(?<inner_type>.+)>\z/
343
+ inner_type = Regexp.last_match[:inner_type]
344
+ value.map { |v| _deserialize(inner_type, v) }
345
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
346
+ k_type = Regexp.last_match[:k_type]
347
+ v_type = Regexp.last_match[:v_type]
348
+ {}.tap do |hash|
349
+ value.each do |k, v|
350
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
351
+ end
352
+ end
353
+ else # model
354
+ temp_model = Wire4Client.const_get(type).new
355
+ temp_model.build_from_hash(value)
356
+ end
357
+ end
358
+
359
+ # Returns the string representation of the object
360
+ # @return [String] String presentation of the object
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # to_body is an alias to to_hash (backward compatibility)
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_body
368
+ to_hash
369
+ end
370
+
371
+ # Returns the object in the form of hash
372
+ # @return [Hash] Returns the object in the form of hash
373
+ def to_hash
374
+ hash = {}
375
+ self.class.attribute_map.each_pair do |attr, param|
376
+ value = self.send(attr)
377
+ next if value.nil?
378
+ hash[param] = _to_hash(value)
379
+ end
380
+ hash
381
+ end
382
+
383
+ # Outputs non-array value in the form of hash
384
+ # For object, use to_hash. Otherwise, just return the value
385
+ # @param [Object] value Any valid value
386
+ # @return [Hash] Returns the value in the form of hash
387
+ def _to_hash(value)
388
+ if value.is_a?(Array)
389
+ value.compact.map { |v| _to_hash(v) }
390
+ elsif value.is_a?(Hash)
391
+ {}.tap do |hash|
392
+ value.each { |k, v| hash[k] = _to_hash(v) }
393
+ end
394
+ elsif value.respond_to? :to_hash
395
+ value.to_hash
396
+ else
397
+ value
398
+ end
399
+ end
400
+ end
401
+ end