wallee-ruby-sdk 2.2.4 → 3.0.6

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/wallee-ruby-sdk.rb +46 -3
  4. data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
  5. data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
  6. data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
  7. data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
  9. data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
  10. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +71 -0
  11. data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
  12. data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
  13. data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
  14. data/lib/wallee-ruby-sdk/api/token_service_api.rb +63 -0
  15. data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
  16. data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
  17. data/lib/wallee-ruby-sdk/api_client.rb +2 -1
  18. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
  19. data/lib/wallee-ruby-sdk/models/abstract_subscription_product_active.rb +11 -1
  20. data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
  21. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
  22. data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
  23. data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
  24. data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
  25. data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
  26. data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
  27. data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
  28. data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
  29. data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
  30. data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
  31. data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
  32. data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
  33. data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
  34. data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
  35. data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
  36. data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
  37. data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
  38. data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
  39. data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
  40. data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +1 -1
  41. data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +1 -1
  42. data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
  43. data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
  44. data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
  45. data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
  46. data/lib/wallee-ruby-sdk/models/payment_contract.rb +1 -25
  47. data/lib/wallee-ruby-sdk/models/payment_link.rb +16 -40
  48. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
  49. data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
  50. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +16 -44
  51. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
  52. data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
  53. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
  54. data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
  55. data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -22
  56. data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
  57. data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
  58. data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
  59. data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
  60. data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
  61. data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
  62. data/lib/wallee-ruby-sdk/models/role.rb +1 -1
  63. data/lib/wallee-ruby-sdk/models/role_state.rb +37 -0
  64. data/lib/wallee-ruby-sdk/models/shopify_subscriber.rb +1 -1
  65. data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
  66. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +11 -1
  67. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +12 -2
  68. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +11 -1
  69. data/lib/wallee-ruby-sdk/models/shopify_subscription_version.rb +11 -1
  70. data/lib/wallee-ruby-sdk/models/subscriber.rb +1 -1
  71. data/lib/wallee-ruby-sdk/models/subscriber_create.rb +1 -1
  72. data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +1 -25
  73. data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +1 -29
  74. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +1 -25
  75. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +1 -25
  76. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +1 -1
  77. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +1 -1
  78. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +12 -2
  79. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry_create.rb +1 -1
  80. data/lib/wallee-ruby-sdk/models/subscription_product.rb +11 -1
  81. data/lib/wallee-ruby-sdk/models/subscription_product_active.rb +11 -1
  82. data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
  83. data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
  84. data/lib/wallee-ruby-sdk/models/subscription_product_create.rb +11 -1
  85. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +2 -2
  86. data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
  87. data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
  88. data/lib/wallee-ruby-sdk/models/token.rb +1 -25
  89. data/lib/wallee-ruby-sdk/models/token_create.rb +1 -29
  90. data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
  91. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
  92. data/lib/wallee-ruby-sdk/models/transaction.rb +64 -4
  93. data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
  94. data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
  95. data/lib/wallee-ruby-sdk/models/webhook_url.rb +11 -1
  96. data/lib/wallee-ruby-sdk/version.rb +1 -1
  97. data/test/condition_type_service_test.rb +22 -0
  98. metadata +50 -5
  99. data/lib/wallee-ruby-sdk/models/payment_terminal_contact_address.rb +0 -396
@@ -29,7 +29,7 @@ module Wallee
29
29
  #
30
30
  attr_accessor :discarded_on
31
31
 
32
- # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
32
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
33
33
  attr_accessor :external_id
34
34
 
35
35
  #
@@ -20,7 +20,7 @@ require 'date'
20
20
  module Wallee
21
21
  # The subscription charge represents a single charge carried out for a particular subscription.
22
22
  class SubscriptionChargeCreate
23
- # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
23
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
24
24
  attr_accessor :external_id
25
25
 
26
26
  # The user will be redirected to failed URL when the transaction could not be authorized or completed. In case no failed URL is specified a default failed page will be displayed.
@@ -35,7 +35,10 @@ module Wallee
35
35
  # The created on date indicates the date on which the entity was stored into the database.
36
36
  attr_accessor :created_on
37
37
 
38
- # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
38
+ #
39
+ attr_accessor :discount_including_tax
40
+
41
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
39
42
  attr_accessor :external_id
40
43
 
41
44
  # The ID is the primary key of the entity. The ID identifies the entity uniquely.
@@ -76,6 +79,7 @@ module Wallee
76
79
  :'amount_including_tax' => :'amountIncludingTax',
77
80
  :'created_by' => :'createdBy',
78
81
  :'created_on' => :'createdOn',
82
+ :'discount_including_tax' => :'discountIncludingTax',
79
83
  :'external_id' => :'externalId',
80
84
  :'id' => :'id',
81
85
  :'linked_space_id' => :'linkedSpaceId',
@@ -98,6 +102,7 @@ module Wallee
98
102
  :'amount_including_tax' => :'Float',
99
103
  :'created_by' => :'Integer',
100
104
  :'created_on' => :'DateTime',
105
+ :'discount_including_tax' => :'Float',
101
106
  :'external_id' => :'String',
102
107
  :'id' => :'Integer',
103
108
  :'linked_space_id' => :'Integer',
@@ -140,6 +145,10 @@ module Wallee
140
145
  self.created_on = attributes[:'createdOn']
141
146
  end
142
147
 
148
+ if attributes.has_key?(:'discountIncludingTax')
149
+ self.discount_including_tax = attributes[:'discountIncludingTax']
150
+ end
151
+
143
152
  if attributes.has_key?(:'externalId')
144
153
  self.external_id = attributes[:'externalId']
145
154
  end
@@ -234,6 +243,7 @@ module Wallee
234
243
  amount_including_tax == o.amount_including_tax &&
235
244
  created_by == o.created_by &&
236
245
  created_on == o.created_on &&
246
+ discount_including_tax == o.discount_including_tax &&
237
247
  external_id == o.external_id &&
238
248
  id == o.id &&
239
249
  linked_space_id == o.linked_space_id &&
@@ -256,7 +266,7 @@ module Wallee
256
266
  # Calculates hash code according to all attributes.
257
267
  # @return [Fixnum] Hash code
258
268
  def hash
259
- [aggregated_tax_rate, amount_excluding_tax, amount_including_tax, created_by, created_on, external_id, id, linked_space_id, planned_purge_date, quantity, state, subscription_version, tax_amount, taxes, title, version].hash
269
+ [aggregated_tax_rate, amount_excluding_tax, amount_including_tax, created_by, created_on, discount_including_tax, external_id, id, linked_space_id, planned_purge_date, quantity, state, subscription_version, tax_amount, taxes, title, version].hash
260
270
  end
261
271
 
262
272
  # Builds the object from hash
@@ -23,7 +23,7 @@ module Wallee
23
23
  #
24
24
  attr_accessor :amount_including_tax
25
25
 
26
- # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
26
+ # A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
27
27
  attr_accessor :external_id
28
28
 
29
29
  #
@@ -38,6 +38,9 @@ module Wallee
38
38
  # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
39
39
  attr_accessor :planned_purge_date
40
40
 
41
+ # Marks the product as locked. Meaning that customer can not change away from this product or change to this product later on.
42
+ attr_accessor :product_locked
43
+
41
44
  # The product reference identifies the product for external systems. This field may contain the product's SKU.
42
45
  attr_accessor :reference
43
46
 
@@ -62,6 +65,7 @@ module Wallee
62
65
  :'linked_space_id' => :'linkedSpaceId',
63
66
  :'name' => :'name',
64
67
  :'planned_purge_date' => :'plannedPurgeDate',
68
+ :'product_locked' => :'productLocked',
65
69
  :'reference' => :'reference',
66
70
  :'sort_order' => :'sortOrder',
67
71
  :'space_id' => :'spaceId',
@@ -79,6 +83,7 @@ module Wallee
79
83
  :'linked_space_id' => :'Integer',
80
84
  :'name' => :'String',
81
85
  :'planned_purge_date' => :'DateTime',
86
+ :'product_locked' => :'BOOLEAN',
82
87
  :'reference' => :'String',
83
88
  :'sort_order' => :'Integer',
84
89
  :'space_id' => :'Integer',
@@ -121,6 +126,10 @@ module Wallee
121
126
  self.planned_purge_date = attributes[:'plannedPurgeDate']
122
127
  end
123
128
 
129
+ if attributes.has_key?(:'productLocked')
130
+ self.product_locked = attributes[:'productLocked']
131
+ end
132
+
124
133
  if attributes.has_key?(:'reference')
125
134
  self.reference = attributes[:'reference']
126
135
  end
@@ -196,6 +205,7 @@ module Wallee
196
205
  linked_space_id == o.linked_space_id &&
197
206
  name == o.name &&
198
207
  planned_purge_date == o.planned_purge_date &&
208
+ product_locked == o.product_locked &&
199
209
  reference == o.reference &&
200
210
  sort_order == o.sort_order &&
201
211
  space_id == o.space_id &&
@@ -212,7 +222,7 @@ module Wallee
212
222
  # Calculates hash code according to all attributes.
213
223
  # @return [Fixnum] Hash code
214
224
  def hash
215
- [allowed_payment_method_configurations, failed_payment_suspension_period, id, linked_space_id, name, planned_purge_date, reference, sort_order, space_id, state, version].hash
225
+ [allowed_payment_method_configurations, failed_payment_suspension_period, id, linked_space_id, name, planned_purge_date, product_locked, reference, sort_order, space_id, state, version].hash
216
226
  end
217
227
 
218
228
  # Builds the object from hash
@@ -29,6 +29,9 @@ module Wallee
29
29
  # The product name is used internally to identify the configuration in administrative interfaces. For example it is used within search fields and hence it should be distinct and descriptive.
30
30
  attr_accessor :name
31
31
 
32
+ # Marks the product as locked. Meaning that customer can not change away from this product or change to this product later on.
33
+ attr_accessor :product_locked
34
+
32
35
  # The sort order controls in which order the product is listed. The sort order is used to order the products in ascending order.
33
36
  attr_accessor :sort_order
34
37
 
@@ -47,6 +50,7 @@ module Wallee
47
50
  :'allowed_payment_method_configurations' => :'allowedPaymentMethodConfigurations',
48
51
  :'failed_payment_suspension_period' => :'failedPaymentSuspensionPeriod',
49
52
  :'name' => :'name',
53
+ :'product_locked' => :'productLocked',
50
54
  :'sort_order' => :'sortOrder',
51
55
  :'state' => :'state',
52
56
  :'id' => :'id',
@@ -60,6 +64,7 @@ module Wallee
60
64
  :'allowed_payment_method_configurations' => :'Array<Integer>',
61
65
  :'failed_payment_suspension_period' => :'String',
62
66
  :'name' => :'String',
67
+ :'product_locked' => :'BOOLEAN',
63
68
  :'sort_order' => :'Integer',
64
69
  :'state' => :'SubscriptionProductState',
65
70
  :'id' => :'Integer',
@@ -89,6 +94,10 @@ module Wallee
89
94
  self.name = attributes[:'name']
90
95
  end
91
96
 
97
+ if attributes.has_key?(:'productLocked')
98
+ self.product_locked = attributes[:'productLocked']
99
+ end
100
+
92
101
  if attributes.has_key?(:'sortOrder')
93
102
  self.sort_order = attributes[:'sortOrder']
94
103
  end
@@ -152,6 +161,7 @@ module Wallee
152
161
  allowed_payment_method_configurations == o.allowed_payment_method_configurations &&
153
162
  failed_payment_suspension_period == o.failed_payment_suspension_period &&
154
163
  name == o.name &&
164
+ product_locked == o.product_locked &&
155
165
  sort_order == o.sort_order &&
156
166
  state == o.state &&
157
167
  id == o.id &&
@@ -167,7 +177,7 @@ module Wallee
167
177
  # Calculates hash code according to all attributes.
168
178
  # @return [Fixnum] Hash code
169
179
  def hash
170
- [allowed_payment_method_configurations, failed_payment_suspension_period, name, sort_order, state, id, version].hash
180
+ [allowed_payment_method_configurations, failed_payment_suspension_period, name, product_locked, sort_order, state, id, version].hash
171
181
  end
172
182
 
173
183
  # Builds the object from hash
@@ -26,7 +26,7 @@ module Wallee
26
26
  #
27
27
  attr_accessor :component_group
28
28
 
29
- # When a component is marked as a 'default' component it is used when no other component is selected by the user.
29
+ # When a component is marked as a 'default' component it is used as the default component in its group and will be preselected in the product configuration.
30
30
  attr_accessor :default_component
31
31
 
32
32
  # The component description may contain a longer description which gives the subscriber a better understanding of what the component contains.
@@ -32,7 +32,7 @@ module Wallee
32
32
  #
33
33
  attr_accessor :component_group
34
34
 
35
- # When a component is marked as a 'default' component it is used when no other component is selected by the user.
35
+ # When a component is marked as a 'default' component it is used as the default component in its group and will be preselected in the product configuration.
36
36
  attr_accessor :default_component
37
37
 
38
38
  # The component description may contain a longer description which gives the subscriber a better understanding of what the component contains.
@@ -29,6 +29,9 @@ module Wallee
29
29
  # The product name is used internally to identify the configuration in administrative interfaces. For example it is used within search fields and hence it should be distinct and descriptive.
30
30
  attr_accessor :name
31
31
 
32
+ # Marks the product as locked. Meaning that customer can not change away from this product or change to this product later on.
33
+ attr_accessor :product_locked
34
+
32
35
  # The sort order controls in which order the product is listed. The sort order is used to order the products in ascending order.
33
36
  attr_accessor :sort_order
34
37
 
@@ -44,6 +47,7 @@ module Wallee
44
47
  :'allowed_payment_method_configurations' => :'allowedPaymentMethodConfigurations',
45
48
  :'failed_payment_suspension_period' => :'failedPaymentSuspensionPeriod',
46
49
  :'name' => :'name',
50
+ :'product_locked' => :'productLocked',
47
51
  :'sort_order' => :'sortOrder',
48
52
  :'state' => :'state',
49
53
  :'reference' => :'reference'
@@ -56,6 +60,7 @@ module Wallee
56
60
  :'allowed_payment_method_configurations' => :'Array<Integer>',
57
61
  :'failed_payment_suspension_period' => :'String',
58
62
  :'name' => :'String',
63
+ :'product_locked' => :'BOOLEAN',
59
64
  :'sort_order' => :'Integer',
60
65
  :'state' => :'SubscriptionProductState',
61
66
  :'reference' => :'String'
@@ -84,6 +89,10 @@ module Wallee
84
89
  self.name = attributes[:'name']
85
90
  end
86
91
 
92
+ if attributes.has_key?(:'productLocked')
93
+ self.product_locked = attributes[:'productLocked']
94
+ end
95
+
87
96
  if attributes.has_key?(:'sortOrder')
88
97
  self.sort_order = attributes[:'sortOrder']
89
98
  end
@@ -157,6 +166,7 @@ module Wallee
157
166
  allowed_payment_method_configurations == o.allowed_payment_method_configurations &&
158
167
  failed_payment_suspension_period == o.failed_payment_suspension_period &&
159
168
  name == o.name &&
169
+ product_locked == o.product_locked &&
160
170
  sort_order == o.sort_order &&
161
171
  state == o.state &&
162
172
  reference == o.reference
@@ -171,7 +181,7 @@ module Wallee
171
181
  # Calculates hash code according to all attributes.
172
182
  # @return [Fixnum] Hash code
173
183
  def hash
174
- [allowed_payment_method_configurations, failed_payment_suspension_period, name, sort_order, state, reference].hash
184
+ [allowed_payment_method_configurations, failed_payment_suspension_period, name, product_locked, sort_order, state, reference].hash
175
185
  end
176
186
 
177
187
  # Builds the object from hash
@@ -20,8 +20,8 @@ require 'date'
20
20
  module Wallee
21
21
  class TaxCalculation
22
22
 
23
- INCLUDED = 'TAX_INCLUDED'.freeze
24
- NOT_INCLUDED = 'TAX_NOT_INCLUDED'.freeze
23
+ TAX_INCLUDED = 'TAX_INCLUDED'.freeze
24
+ TAX_NOT_INCLUDED = 'TAX_NOT_INCLUDED'.freeze
25
25
 
26
26
  # Builds the enum from string
27
27
  # @param [String] The enum value in the form of the string
@@ -0,0 +1,221 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ # The receipt fetch request allows to retrieve the receipt documents for a terminal transaction.
22
+ class TerminalReceiptFetchRequest
23
+ # The format determines in what format the receipts will be returned in.
24
+ attr_accessor :format
25
+
26
+ # Provide here the ID of the transaction for which the receipts should be fetched.
27
+ attr_accessor :transaction
28
+
29
+ # The width controls how width the document will be rendered. In case of the PDF format the width is in mm. In case of the text format the width is in the number of chars per line.
30
+ attr_accessor :width
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'format' => :'format',
36
+ :'transaction' => :'transaction',
37
+ :'width' => :'width'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'format' => :'TerminalReceiptFormat',
45
+ :'transaction' => :'Integer',
46
+ :'width' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'format')
59
+ self.format = attributes[:'format']
60
+ end
61
+
62
+ if attributes.has_key?(:'transaction')
63
+ self.transaction = attributes[:'transaction']
64
+ end
65
+
66
+ if attributes.has_key?(:'width')
67
+ self.width = attributes[:'width']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ if @format.nil?
76
+ invalid_properties.push('invalid value for "format", format cannot be nil.')
77
+ end
78
+
79
+ if @transaction.nil?
80
+ invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @format.nil?
90
+ return false if @transaction.nil?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ format == o.format &&
100
+ transaction == o.transaction &&
101
+ width == o.width
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [format, transaction, width].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = Wallee.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end