wire4_client 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +28 -1
  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 +138 -4
  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/failed_charges_data_dto.rb +228 -0
  61. data/lib/wire4_client/models/message_deposit_received.rb +31 -1
  62. data/lib/wire4_client/models/operations.rb +4 -4
  63. data/lib/wire4_client/models/payment_codi.rb +2 -2
  64. data/lib/wire4_client/models/payment_request_report_dto.rb +300 -0
  65. data/lib/wire4_client/models/payment_request_req.rb +401 -0
  66. data/lib/wire4_client/models/payment_request_response.rb +204 -0
  67. data/lib/wire4_client/models/payments_spei_and_spid_order_id.rb +199 -0
  68. data/lib/wire4_client/models/payments_spei_and_spid_request_id.rb +229 -0
  69. data/lib/wire4_client/models/person.rb +0 -5
  70. data/lib/wire4_client/models/product.rb +288 -0
  71. data/lib/wire4_client/models/recurring_charge_request.rb +278 -0
  72. data/lib/wire4_client/models/sales_point_request.rb +5 -5
  73. data/lib/wire4_client/models/spid_beneficiary_response.rb +11 -1
  74. data/lib/wire4_client/models/success_charges_data_dto.rb +219 -0
  75. data/lib/wire4_client/models/success_data_dto.rb +226 -0
  76. data/lib/wire4_client/models/transaction_outgoing.rb +5 -5
  77. data/lib/wire4_client/models/transaction_spei_spid.rb +390 -0
  78. data/lib/wire4_client/models/transactions_register.rb +229 -0
  79. data/lib/wire4_client/version.rb +1 -1
  80. data/lib/wire4_client.rb +18 -0
  81. data/spec/api/cargos_recurrentes_api_spec.rb +61 -0
  82. data/spec/api/cuentas_de_beneficiarios_spei_api_spec.rb +2 -0
  83. data/spec/api/cuentas_de_beneficiarios_spid_api_spec.rb +2 -0
  84. data/spec/api/depositantes_api_spec.rb +42 -1
  85. data/spec/api/reporte_de_solicitudes_de_pagos_api_spec.rb +59 -0
  86. data/spec/api/solicitud_de_pagos_api_spec.rb +48 -0
  87. data/spec/api/transferencias_spei_api_spec.rb +42 -0
  88. data/spec/models/account_reassigned_spec.rb +3 -3
  89. data/spec/models/account_response_spec.rb +6 -0
  90. data/spec/models/beneficiary_dto_spec.rb +53 -0
  91. data/spec/models/cep_response_spec.rb +10 -0
  92. data/spec/models/cep_search_banxico_spec.rb +10 -0
  93. data/spec/models/codi_code_qr_response_dto_spec.rb +8 -2
  94. data/spec/models/codi_code_request_dto_spec.rb +23 -1
  95. data/spec/models/codi_operations_filters_request_dto_spec.rb +1 -1
  96. data/spec/models/confirm_recurring_charge_spec.rb +47 -0
  97. data/spec/models/customer_spec.rb +47 -0
  98. data/spec/models/deposit_spec.rb +10 -0
  99. data/spec/models/depositant_count_response_spec.rb +41 -0
  100. data/spec/models/depositant_spec.rb +6 -0
  101. data/spec/models/failed_charges_data_dto_spec.rb +71 -0
  102. data/spec/models/message_deposit_received_spec.rb +18 -0
  103. data/spec/models/operations_spec.rb +2 -2
  104. data/spec/models/payment_codi_spec.rb +1 -1
  105. data/spec/models/payment_request_report_dto_spec.rb +99 -0
  106. data/spec/models/payment_request_req_spec.rb +109 -0
  107. data/spec/models/payment_request_response_spec.rb +53 -0
  108. data/spec/models/payments_spei_and_spid_order_id_spec.rb +47 -0
  109. data/spec/models/payments_spei_and_spid_request_id_spec.rb +65 -0
  110. data/spec/models/product_spec.rb +63 -0
  111. data/spec/models/recurring_charge_request_spec.rb +77 -0
  112. data/spec/models/spid_beneficiary_response_spec.rb +6 -0
  113. data/spec/models/success_charges_data_dto_spec.rb +65 -0
  114. data/spec/models/success_data_dto_spec.rb +51 -0
  115. data/spec/models/transaction_spei_spid_spec.rb +83 -0
  116. data/spec/models/transactions_register_spec.rb +59 -0
  117. data/wire4_client-1.1.3.gem +0 -0
  118. data/wire4_client.gemspec +7 -7
  119. metadata +107 -55
@@ -0,0 +1,228 @@
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 FailedChargesDataDTO
17
+ attr_accessor :brand
18
+
19
+ attr_accessor :card_number
20
+
21
+ attr_accessor :date
22
+
23
+ attr_accessor :error_code
24
+
25
+ attr_accessor :error_message
26
+
27
+ attr_accessor :holder_name
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'brand' => :'brand',
33
+ :'card_number' => :'card_number',
34
+ :'date' => :'date',
35
+ :'error_code' => :'error_code',
36
+ :'error_message' => :'error_message',
37
+ :'holder_name' => :'holder_name'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'brand' => :'String',
45
+ :'card_number' => :'String',
46
+ :'date' => :'String',
47
+ :'error_code' => :'String',
48
+ :'error_message' => :'String',
49
+ :'holder_name' => :'String'
50
+ }
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ if attributes.has_key?(:'brand')
62
+ self.brand = attributes[:'brand']
63
+ end
64
+
65
+ if attributes.has_key?(:'card_number')
66
+ self.card_number = attributes[:'card_number']
67
+ end
68
+
69
+ if attributes.has_key?(:'date')
70
+ self.date = attributes[:'date']
71
+ end
72
+
73
+ if attributes.has_key?(:'error_code')
74
+ self.error_code = attributes[:'error_code']
75
+ end
76
+
77
+ if attributes.has_key?(:'error_message')
78
+ self.error_message = attributes[:'error_message']
79
+ end
80
+
81
+ if attributes.has_key?(:'holder_name')
82
+ self.holder_name = attributes[:'holder_name']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ brand == o.brand &&
105
+ card_number == o.card_number &&
106
+ date == o.date &&
107
+ error_code == o.error_code &&
108
+ error_message == o.error_message &&
109
+ holder_name == o.holder_name
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [brand, card_number, date, error_code, error_message, holder_name].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = Wire4Client.const_get(type).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -66,9 +66,18 @@ module Wire4Client
66
66
  # Es el identificador asignado por Monex a la transferencia.
67
67
  attr_accessor :monex_transaction_id
68
68
 
69
+ # Número de orden asignado por el cliente de Wire4
70
+ attr_accessor :order_id
71
+
69
72
  # Es la referecia de la transferencia.
70
73
  attr_accessor :reference
71
74
 
75
+ # Es el identificador de la solicitud de cobro establecido por la aplicación.
76
+ attr_accessor :request_id
77
+
78
+ # Es el id de devolucion de la transaccion.
79
+ attr_accessor :return_id_instruction
80
+
72
81
  # Es la cuenta del ordenante que podría ser un número celular (10 dígitos), una tarjeta de débito (TDD, de 16 dígitos) o Cuenta CLABE interbancaria (18 dígitos).
73
82
  attr_accessor :sender_account
74
83
 
@@ -101,7 +110,10 @@ module Wire4Client
101
110
  :'description' => :'description',
102
111
  :'monex_description' => :'monex_description',
103
112
  :'monex_transaction_id' => :'monex_transaction_id',
113
+ :'order_id' => :'order_id',
104
114
  :'reference' => :'reference',
115
+ :'request_id' => :'request_id',
116
+ :'return_id_instruction' => :'return_id_instruction',
105
117
  :'sender_account' => :'sender_account',
106
118
  :'sender_bank' => :'sender_bank',
107
119
  :'sender_name' => :'sender_name',
@@ -129,7 +141,10 @@ module Wire4Client
129
141
  :'description' => :'String',
130
142
  :'monex_description' => :'String',
131
143
  :'monex_transaction_id' => :'String',
144
+ :'order_id' => :'String',
132
145
  :'reference' => :'String',
146
+ :'request_id' => :'String',
147
+ :'return_id_instruction' => :'Integer',
133
148
  :'sender_account' => :'String',
134
149
  :'sender_bank' => :'MessageInstitution',
135
150
  :'sender_name' => :'String',
@@ -213,10 +228,22 @@ module Wire4Client
213
228
  self.monex_transaction_id = attributes[:'monex_transaction_id']
214
229
  end
215
230
 
231
+ if attributes.has_key?(:'order_id')
232
+ self.order_id = attributes[:'order_id']
233
+ end
234
+
216
235
  if attributes.has_key?(:'reference')
217
236
  self.reference = attributes[:'reference']
218
237
  end
219
238
 
239
+ if attributes.has_key?(:'request_id')
240
+ self.request_id = attributes[:'request_id']
241
+ end
242
+
243
+ if attributes.has_key?(:'return_id_instruction')
244
+ self.return_id_instruction = attributes[:'return_id_instruction']
245
+ end
246
+
220
247
  if attributes.has_key?(:'sender_account')
221
248
  self.sender_account = attributes[:'sender_account']
222
249
  end
@@ -269,7 +296,10 @@ module Wire4Client
269
296
  description == o.description &&
270
297
  monex_description == o.monex_description &&
271
298
  monex_transaction_id == o.monex_transaction_id &&
299
+ order_id == o.order_id &&
272
300
  reference == o.reference &&
301
+ request_id == o.request_id &&
302
+ return_id_instruction == o.return_id_instruction &&
273
303
  sender_account == o.sender_account &&
274
304
  sender_bank == o.sender_bank &&
275
305
  sender_name == o.sender_name &&
@@ -285,7 +315,7 @@ module Wire4Client
285
315
  # Calculates hash code according to all attributes.
286
316
  # @return [Fixnum] Hash code
287
317
  def hash
288
- [amount, beneficiary_account, beneficiary_name, beneficiary_rfc, cep, clave_rastreo, confirm_date, currency_code, deposit_date, depositant, depositant_alias, depositant_clabe, depositant_email, depositant_rfc, description, monex_description, monex_transaction_id, reference, sender_account, sender_bank, sender_name, sender_rfc].hash
318
+ [amount, beneficiary_account, beneficiary_name, beneficiary_rfc, cep, clave_rastreo, confirm_date, currency_code, deposit_date, depositant, depositant_alias, depositant_clabe, depositant_email, depositant_rfc, description, monex_description, monex_transaction_id, order_id, reference, request_id, return_id_instruction, sender_account, sender_bank, sender_name, sender_rfc].hash
289
319
  end
290
320
 
291
321
  # Builds the object from hash
@@ -158,9 +158,9 @@ module Wire4Client
158
158
  # Check to see if the all the properties in the model are valid
159
159
  # @return true if the model is valid
160
160
  def valid?
161
- status_validator = EnumAttributeValidator.new('String', ['RECEIVED', 'COMPLETED', 'CANCELLED'])
161
+ status_validator = EnumAttributeValidator.new('String', ['ACCEPTED', 'RECEIVED', 'COMPLETED', 'CANCELLED', 'POSTPONED', 'REJECTED', 'REVERSED', 'PENDING'])
162
162
  return false unless status_validator.valid?(@status)
163
- type_validator = EnumAttributeValidator.new('String', ['PUSH_NOTIFICATION', 'QR_CODE'])
163
+ type_validator = EnumAttributeValidator.new('String', ['PUSH_NOTIFICATION', 'QR_CODE', 'UNKNOWN'])
164
164
  return false unless type_validator.valid?(@type)
165
165
  true
166
166
  end
@@ -168,7 +168,7 @@ module Wire4Client
168
168
  # Custom attribute writer method checking allowed values (enum).
169
169
  # @param [Object] status Object to be assigned
170
170
  def status=(status)
171
- validator = EnumAttributeValidator.new('String', ['RECEIVED', 'COMPLETED', 'CANCELLED'])
171
+ validator = EnumAttributeValidator.new('String', ['ACCEPTED', 'RECEIVED', 'COMPLETED', 'CANCELLED', 'POSTPONED', 'REJECTED', 'REVERSED', 'PENDING'])
172
172
  unless validator.valid?(status)
173
173
  fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
174
174
  end
@@ -178,7 +178,7 @@ module Wire4Client
178
178
  # Custom attribute writer method checking allowed values (enum).
179
179
  # @param [Object] type Object to be assigned
180
180
  def type=(type)
181
- validator = EnumAttributeValidator.new('String', ['PUSH_NOTIFICATION', 'QR_CODE'])
181
+ validator = EnumAttributeValidator.new('String', ['PUSH_NOTIFICATION', 'QR_CODE', 'UNKNOWN'])
182
182
  unless validator.valid?(type)
183
183
  fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
184
184
  end
@@ -122,7 +122,7 @@ module Wire4Client
122
122
  # Check to see if the all the properties in the model are valid
123
123
  # @return true if the model is valid
124
124
  def valid?
125
- status_validator = EnumAttributeValidator.new('String', ['RECEIVED', 'COMPLETED', 'CANCELLED'])
125
+ status_validator = EnumAttributeValidator.new('String', ['ACCEPTED', 'RECEIVED', 'COMPLETED', 'CANCELLED', 'POSTPONED', 'REJECTED', 'REVERSED', 'PENDING'])
126
126
  return false unless status_validator.valid?(@status)
127
127
  true
128
128
  end
@@ -130,7 +130,7 @@ module Wire4Client
130
130
  # Custom attribute writer method checking allowed values (enum).
131
131
  # @param [Object] status Object to be assigned
132
132
  def status=(status)
133
- validator = EnumAttributeValidator.new('String', ['RECEIVED', 'COMPLETED', 'CANCELLED'])
133
+ validator = EnumAttributeValidator.new('String', ['ACCEPTED', 'RECEIVED', 'COMPLETED', 'CANCELLED', 'POSTPONED', 'REJECTED', 'REVERSED', 'PENDING'])
134
134
  unless validator.valid?(status)
135
135
  fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
136
136
  end
@@ -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