vrpayment-ruby-sdk 6.2.0 → 6.4.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +56 -14
  3. data/LICENSE +1 -1
  4. data/README.md +57 -29
  5. data/lib/vrpayment-ruby-sdk/api_client.rb +1 -1
  6. data/lib/vrpayment-ruby-sdk/api_exception_error_codes.rb +60 -0
  7. data/lib/vrpayment-ruby-sdk/models/bogus_express_checkout_approval_request.rb +230 -0
  8. data/lib/vrpayment-ruby-sdk/models/bogus_express_checkout_payment_data.rb +241 -0
  9. data/lib/vrpayment-ruby-sdk/models/express_checkout_approval_response.rb +270 -0
  10. data/lib/vrpayment-ruby-sdk/models/express_checkout_create_response.rb +13 -4
  11. data/lib/vrpayment-ruby-sdk/models/express_checkout_session.rb +39 -1
  12. data/lib/vrpayment-ruby-sdk/models/express_checkout_session_create.rb +21 -1
  13. data/lib/vrpayment-ruby-sdk/models/express_checkout_shipping_address_change_request.rb +239 -0
  14. data/lib/vrpayment-ruby-sdk/models/express_checkout_shipping_address_change_response.rb +241 -0
  15. data/lib/vrpayment-ruby-sdk/models/express_checkout_shipping_method_change_request.rb +231 -0
  16. data/lib/vrpayment-ruby-sdk/models/express_checkout_shipping_method_change_response.rb +241 -0
  17. data/lib/vrpayment-ruby-sdk/models/express_checkout_shipping_option.rb +1 -1
  18. data/lib/vrpayment-ruby-sdk/models/payment_terminal_address.rb +43 -5
  19. data/lib/vrpayment-ruby-sdk/models/payment_terminal_dcc_transaction_sum.rb +302 -0
  20. data/lib/vrpayment-ruby-sdk/models/payment_terminal_transaction_sum.rb +332 -0
  21. data/lib/vrpayment-ruby-sdk/models/payment_terminal_transaction_summary.rb +347 -0
  22. data/lib/vrpayment-ruby-sdk/models/refund.rb +13 -1
  23. data/lib/vrpayment-ruby-sdk/models/refund_create.rb +13 -1
  24. data/lib/vrpayment-ruby-sdk/models/rendered_terminal_transaction_summary.rb +241 -0
  25. data/lib/vrpayment-ruby-sdk/models/scope.rb +15 -15
  26. data/lib/vrpayment-ruby-sdk/models/subscription_update_request.rb +22 -45
  27. data/lib/vrpayment-ruby-sdk/models/terminal_transaction_summary_list_response.rb +253 -0
  28. data/lib/vrpayment-ruby-sdk/models/terminal_transaction_summary_search_response.rb +263 -0
  29. data/lib/vrpayment-ruby-sdk/models/transaction_completion.rb +13 -1
  30. data/lib/vrpayment-ruby-sdk/models/transaction_completion_details.rb +26 -4
  31. data/lib/vrpayment-ruby-sdk/models/transaction_user_interface_type.rb +2 -1
  32. data/lib/vrpayment-ruby-sdk/sdk_exception_error_codes.rb +55 -0
  33. data/lib/vrpayment-ruby-sdk/service/bogus_express_checkout_service.rb +114 -0
  34. data/lib/vrpayment-ruby-sdk/service/express_checkout_service.rb +162 -0
  35. data/lib/vrpayment-ruby-sdk/service/payment_terminal_transaction_summaries_service.rb +372 -0
  36. data/lib/vrpayment-ruby-sdk/service/webhook_encryption_keys_service.rb +2 -2
  37. data/lib/vrpayment-ruby-sdk/utils/encryption_util.rb +5 -5
  38. data/lib/vrpayment-ruby-sdk/version.rb +1 -1
  39. data/lib/vrpayment-ruby-sdk/vrpayment_sdk_exception.rb +2 -33
  40. data/lib/vrpayment-ruby-sdk.rb +20 -1
  41. data/test/test_querying.rb +11 -0
  42. metadata +19 -2
@@ -0,0 +1,347 @@
1
+ =begin
2
+ # VR Payment Ruby SDK
3
+ #
4
+ # This library allows to interact with the VR Payment payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.vr-payment.de
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module VrpaymentRubySdk
27
+ class PaymentTerminalTransactionSummary
28
+ # The unique reference assigned to this transaction summary.
29
+ attr_accessor :reference
30
+
31
+ # The ID of the space this object belongs to.
32
+ attr_accessor :linked_space_id
33
+
34
+ # The total monetary amounts of all transactions, organized and grouped by brand and currency.
35
+ attr_accessor :transaction_sums
36
+
37
+ # Detailed breakdown of Dynamic Currency Conversion (DCC) transactions, showing transaction amounts in both original and converted currencies, grouped by payment brand.
38
+ attr_accessor :dcc_transaction_sums
39
+
40
+ # The end of the time period covered by this summary report.
41
+ attr_accessor :ended_on
42
+
43
+ # The overall transaction volume in each processed currency.
44
+ attr_accessor :balance_amount_per_currency
45
+
46
+ # The payment terminal that processed the transactions included in this summary report.
47
+ attr_accessor :payment_terminal
48
+
49
+ # The HTML content of the transaction summary receipt.
50
+ attr_accessor :receipt
51
+
52
+ # A unique identifier for the object.
53
+ attr_accessor :id
54
+
55
+ # The total count of all transactions processed by the terminal during the summary period.
56
+ attr_accessor :number_of_transactions
57
+
58
+ # The beginning of the time period covered by this summary report.
59
+ attr_accessor :started_on
60
+
61
+ # The version is used for optimistic locking and incremented whenever the object is updated.
62
+ attr_accessor :version
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'reference' => :'reference',
68
+ :'linked_space_id' => :'linkedSpaceId',
69
+ :'transaction_sums' => :'transactionSums',
70
+ :'dcc_transaction_sums' => :'dccTransactionSums',
71
+ :'ended_on' => :'endedOn',
72
+ :'balance_amount_per_currency' => :'balanceAmountPerCurrency',
73
+ :'payment_terminal' => :'paymentTerminal',
74
+ :'receipt' => :'receipt',
75
+ :'id' => :'id',
76
+ :'number_of_transactions' => :'numberOfTransactions',
77
+ :'started_on' => :'startedOn',
78
+ :'version' => :'version'
79
+ }
80
+ end
81
+
82
+ # Returns attribute mapping this model knows about
83
+ def self.acceptable_attribute_map
84
+ attribute_map
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ acceptable_attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'reference' => :'Integer',
96
+ :'linked_space_id' => :'Integer',
97
+ :'transaction_sums' => :'Array<PaymentTerminalTransactionSum>',
98
+ :'dcc_transaction_sums' => :'Array<PaymentTerminalDccTransactionSum>',
99
+ :'ended_on' => :'Time',
100
+ :'balance_amount_per_currency' => :'Hash<String, Float>',
101
+ :'payment_terminal' => :'Integer',
102
+ :'receipt' => :'String',
103
+ :'id' => :'Integer',
104
+ :'number_of_transactions' => :'Integer',
105
+ :'started_on' => :'Time',
106
+ :'version' => :'Integer'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::PaymentTerminalTransactionSummary` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ acceptable_attribute_map = self.class.acceptable_attribute_map
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!acceptable_attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::PaymentTerminalTransactionSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'reference')
133
+ self.reference = attributes[:'reference']
134
+ end
135
+
136
+ if attributes.key?(:'linked_space_id')
137
+ self.linked_space_id = attributes[:'linked_space_id']
138
+ end
139
+
140
+ if attributes.key?(:'transaction_sums')
141
+ if (value = attributes[:'transaction_sums']).is_a?(Array)
142
+ self.transaction_sums = value
143
+ end
144
+ end
145
+
146
+ if attributes.key?(:'dcc_transaction_sums')
147
+ if (value = attributes[:'dcc_transaction_sums']).is_a?(Array)
148
+ self.dcc_transaction_sums = value
149
+ end
150
+ end
151
+
152
+ if attributes.key?(:'ended_on')
153
+ self.ended_on = attributes[:'ended_on']
154
+ end
155
+
156
+ if attributes.key?(:'balance_amount_per_currency')
157
+ if (value = attributes[:'balance_amount_per_currency']).is_a?(Hash)
158
+ self.balance_amount_per_currency = value
159
+ end
160
+ end
161
+
162
+ if attributes.key?(:'payment_terminal')
163
+ self.payment_terminal = attributes[:'payment_terminal']
164
+ end
165
+
166
+ if attributes.key?(:'receipt')
167
+ self.receipt = attributes[:'receipt']
168
+ end
169
+
170
+ if attributes.key?(:'id')
171
+ self.id = attributes[:'id']
172
+ end
173
+
174
+ if attributes.key?(:'number_of_transactions')
175
+ self.number_of_transactions = attributes[:'number_of_transactions']
176
+ end
177
+
178
+ if attributes.key?(:'started_on')
179
+ self.started_on = attributes[:'started_on']
180
+ end
181
+
182
+ if attributes.key?(:'version')
183
+ self.version = attributes[:'version']
184
+ end
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
191
+ invalid_properties = Array.new
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ true
200
+ end
201
+
202
+ # Checks equality by comparing each attribute.
203
+ # @param [Object] Object to be compared
204
+ def ==(o)
205
+ return true if self.equal?(o)
206
+ self.class == o.class &&
207
+ reference == o.reference &&
208
+ linked_space_id == o.linked_space_id &&
209
+ transaction_sums == o.transaction_sums &&
210
+ dcc_transaction_sums == o.dcc_transaction_sums &&
211
+ ended_on == o.ended_on &&
212
+ balance_amount_per_currency == o.balance_amount_per_currency &&
213
+ payment_terminal == o.payment_terminal &&
214
+ receipt == o.receipt &&
215
+ id == o.id &&
216
+ number_of_transactions == o.number_of_transactions &&
217
+ started_on == o.started_on &&
218
+ version == o.version
219
+ end
220
+
221
+ # @see the `==` method
222
+ # @param [Object] Object to be compared
223
+ def eql?(o)
224
+ self == o
225
+ end
226
+
227
+ # Calculates hash code according to all attributes.
228
+ # @return [Integer] Hash code
229
+ def hash
230
+ [reference, linked_space_id, transaction_sums, dcc_transaction_sums, ended_on, balance_amount_per_currency, payment_terminal, receipt, id, number_of_transactions, started_on, version].hash
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def self.build_from_hash(attributes)
237
+ return nil unless attributes.is_a?(Hash)
238
+ attributes = attributes.transform_keys(&:to_sym)
239
+ transformed_hash = {}
240
+ openapi_types.each_pair do |key, type|
241
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
242
+ transformed_hash["#{key}"] = nil
243
+ elsif type =~ /\AArray<(.*)>/i
244
+ # check to ensure the input is an array given that the attribute
245
+ # is documented as an array but the input is not
246
+ if attributes[attribute_map[key]].is_a?(Array)
247
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
248
+ end
249
+ elsif !attributes[attribute_map[key]].nil?
250
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
251
+ end
252
+ end
253
+ new(transformed_hash)
254
+ end
255
+
256
+ # Deserializes the data based on type
257
+ # @param string type Data type
258
+ # @param string value Value to be deserialized
259
+ # @return [Object] Deserialized data
260
+ def self._deserialize(type, value)
261
+ case type.to_sym
262
+ when :Time
263
+ Time.parse(value)
264
+ when :Date
265
+ Date.parse(value)
266
+ when :String
267
+ value.to_s
268
+ when :Integer
269
+ value.to_i
270
+ when :Float
271
+ value.to_f
272
+ when :Boolean
273
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
274
+ true
275
+ else
276
+ false
277
+ end
278
+ when :Object
279
+ # generic object (usually a Hash), return directly
280
+ value
281
+ when /\AArray<(?<inner_type>.+)>\z/
282
+ inner_type = Regexp.last_match[:inner_type]
283
+ value.map { |v| _deserialize(inner_type, v) }
284
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
285
+ k_type = Regexp.last_match[:k_type]
286
+ v_type = Regexp.last_match[:v_type]
287
+ {}.tap do |hash|
288
+ value.each do |k, v|
289
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
290
+ end
291
+ end
292
+ else # model
293
+ # models (e.g. Pet) or oneOf
294
+ klass = VrpaymentRubySdk.const_get(type)
295
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
296
+ end
297
+ end
298
+
299
+ # Returns the string representation of the object
300
+ # @return [String] String presentation of the object
301
+ def to_s
302
+ to_hash.to_s
303
+ end
304
+
305
+ # to_body is an alias to to_hash (backward compatibility)
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_body
308
+ to_hash
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ if value.nil?
318
+ is_nullable = self.class.openapi_nullable.include?(attr)
319
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
+ end
321
+
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ # Outputs non-array value in the form of hash
328
+ # For object, use to_hash. Otherwise, just return the value
329
+ # @param [Object] value Any valid value
330
+ # @return [Hash] Returns the value in the form of hash
331
+ def _to_hash(value)
332
+ if value.is_a?(Array)
333
+ value.compact.map { |v| _to_hash(v) }
334
+ elsif value.is_a?(Hash)
335
+ {}.tap do |hash|
336
+ value.each { |k, v| hash[k] = _to_hash(v) }
337
+ end
338
+ elsif value.respond_to? :to_hash
339
+ value.to_hash
340
+ else
341
+ value
342
+ end
343
+ end
344
+
345
+ end
346
+
347
+ end
@@ -52,6 +52,9 @@ module VrpaymentRubySdk
52
52
  # The line items included in the refund, representing the reductions.
53
53
  attr_accessor :line_items
54
54
 
55
+ # Allow to store additional information about the object.
56
+ attr_accessor :meta_data
57
+
55
58
  # The date and time when the refund succeeded.
56
59
  attr_accessor :succeeded_on
57
60
 
@@ -151,6 +154,7 @@ module VrpaymentRubySdk
151
154
  :'type' => :'type',
152
155
  :'created_on' => :'createdOn',
153
156
  :'line_items' => :'lineItems',
157
+ :'meta_data' => :'metaData',
154
158
  :'succeeded_on' => :'succeededOn',
155
159
  :'reduced_line_items' => :'reducedLineItems',
156
160
  :'id' => :'id',
@@ -199,6 +203,7 @@ module VrpaymentRubySdk
199
203
  :'type' => :'RefundType',
200
204
  :'created_on' => :'Time',
201
205
  :'line_items' => :'Array<LineItem>',
206
+ :'meta_data' => :'Hash<String, String>',
202
207
  :'succeeded_on' => :'Time',
203
208
  :'reduced_line_items' => :'Array<LineItem>',
204
209
  :'id' => :'Integer',
@@ -291,6 +296,12 @@ module VrpaymentRubySdk
291
296
  end
292
297
  end
293
298
 
299
+ if attributes.key?(:'meta_data')
300
+ if (value = attributes[:'meta_data']).is_a?(Hash)
301
+ self.meta_data = value
302
+ end
303
+ end
304
+
294
305
  if attributes.key?(:'succeeded_on')
295
306
  self.succeeded_on = attributes[:'succeeded_on']
296
307
  end
@@ -525,6 +536,7 @@ module VrpaymentRubySdk
525
536
  type == o.type &&
526
537
  created_on == o.created_on &&
527
538
  line_items == o.line_items &&
539
+ meta_data == o.meta_data &&
528
540
  succeeded_on == o.succeeded_on &&
529
541
  reduced_line_items == o.reduced_line_items &&
530
542
  id == o.id &&
@@ -559,7 +571,7 @@ module VrpaymentRubySdk
559
571
  # Calculates hash code according to all attributes.
560
572
  # @return [Integer] Hash code
561
573
  def hash
562
- [total_settled_amount, reductions, base_line_items, processing_on, taxes, language, type, created_on, line_items, succeeded_on, reduced_line_items, id, state, merchant_reference, completion, amount, planned_purge_date, external_id, time_zone, version, labels, linked_space_id, timeout_on, environment, created_by, next_update_on, updated_invoice, failure_reason, total_applied_fees, failed_on, transaction, processor_reference].hash
574
+ [total_settled_amount, reductions, base_line_items, processing_on, taxes, language, type, created_on, line_items, meta_data, succeeded_on, reduced_line_items, id, state, merchant_reference, completion, amount, planned_purge_date, external_id, time_zone, version, labels, linked_space_id, timeout_on, environment, created_by, next_update_on, updated_invoice, failure_reason, total_applied_fees, failed_on, transaction, processor_reference].hash
563
575
  end
564
576
 
565
577
  # Builds the object from hash
@@ -29,6 +29,9 @@ module VrpaymentRubySdk
29
29
  # The transaction completion that the refund belongs to.
30
30
  attr_accessor :completion
31
31
 
32
+ # Allow to store additional information about the object.
33
+ attr_accessor :meta_data
34
+
32
35
  # The total monetary amount of the refund, representing the exact credit issued to the customer.
33
36
  attr_accessor :amount
34
37
 
@@ -72,6 +75,7 @@ module VrpaymentRubySdk
72
75
  def self.attribute_map
73
76
  {
74
77
  :'completion' => :'completion',
78
+ :'meta_data' => :'metaData',
75
79
  :'amount' => :'amount',
76
80
  :'reductions' => :'reductions',
77
81
  :'external_id' => :'externalId',
@@ -95,6 +99,7 @@ module VrpaymentRubySdk
95
99
  def self.openapi_types
96
100
  {
97
101
  :'completion' => :'Integer',
102
+ :'meta_data' => :'Hash<String, String>',
98
103
  :'amount' => :'Float',
99
104
  :'reductions' => :'Array<LineItemReductionCreate>',
100
105
  :'external_id' => :'String',
@@ -130,6 +135,12 @@ module VrpaymentRubySdk
130
135
  self.completion = attributes[:'completion']
131
136
  end
132
137
 
138
+ if attributes.key?(:'meta_data')
139
+ if (value = attributes[:'meta_data']).is_a?(Hash)
140
+ self.meta_data = value
141
+ end
142
+ end
143
+
133
144
  if attributes.key?(:'amount')
134
145
  self.amount = attributes[:'amount']
135
146
  end
@@ -271,6 +282,7 @@ module VrpaymentRubySdk
271
282
  return true if self.equal?(o)
272
283
  self.class == o.class &&
273
284
  completion == o.completion &&
285
+ meta_data == o.meta_data &&
274
286
  amount == o.amount &&
275
287
  reductions == o.reductions &&
276
288
  external_id == o.external_id &&
@@ -288,7 +300,7 @@ module VrpaymentRubySdk
288
300
  # Calculates hash code according to all attributes.
289
301
  # @return [Integer] Hash code
290
302
  def hash
291
- [completion, amount, reductions, external_id, type, merchant_reference, transaction].hash
303
+ [completion, meta_data, amount, reductions, external_id, type, merchant_reference, transaction].hash
292
304
  end
293
305
 
294
306
  # Builds the object from hash
@@ -0,0 +1,241 @@
1
+ =begin
2
+ # VR Payment Ruby SDK
3
+ #
4
+ # This library allows to interact with the VR Payment payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.vr-payment.de
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module VrpaymentRubySdk
27
+ class RenderedTerminalTransactionSummary
28
+ # The data property contains the binary data of the receipt document encoded as base 64 encoded string.
29
+ attr_accessor :data
30
+
31
+ # The mime type indicates the format of the receipt document. The mime type depends on the requested receipt format.
32
+ attr_accessor :mime_type
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'data' => :'data',
38
+ :'mime_type' => :'mimeType'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'data' => :'String',
56
+ :'mime_type' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::RenderedTerminalTransactionSummary` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::RenderedTerminalTransactionSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'data')
83
+ self.data = attributes[:'data']
84
+ end
85
+
86
+ if attributes.key?(:'mime_type')
87
+ self.mime_type = attributes[:'mime_type']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ data == o.data &&
112
+ mime_type == o.mime_type
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [data, mime_type].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = VrpaymentRubySdk.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end