wallee-ruby-sdk 2.2.3 → 3.0.5

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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/lib/wallee-ruby-sdk.rb +63 -8
  5. data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
  6. data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
  7. data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
  9. data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
  10. data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
  11. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +170 -0
  12. data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
  13. data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
  14. data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
  15. data/lib/wallee-ruby-sdk/api/shopify_subscription_service_api.rb +124 -0
  16. data/lib/wallee-ruby-sdk/api/shopify_transaction_service_api.rb +213 -0
  17. data/lib/wallee-ruby-sdk/api/subscriber_service_api.rb +3 -3
  18. data/lib/wallee-ruby-sdk/api/subscription_service_api.rb +67 -0
  19. data/lib/wallee-ruby-sdk/api/token_service_api.rb +189 -0
  20. data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
  21. data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
  22. data/lib/wallee-ruby-sdk/api_client.rb +7 -4
  23. data/lib/wallee-ruby-sdk/configuration.rb +2 -2
  24. data/lib/wallee-ruby-sdk/models/abstract_account_update.rb +11 -1
  25. data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
  26. data/lib/wallee-ruby-sdk/models/{abstract_shopify_subscription_product_active.rb → abstract_shopify_subscription_product_update.rb} +2 -12
  27. data/lib/wallee-ruby-sdk/models/abstract_space_update.rb +11 -1
  28. data/lib/wallee-ruby-sdk/models/abstract_subscription_product_active.rb +11 -1
  29. data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +59 -1
  30. data/lib/wallee-ruby-sdk/models/abstract_webhook_url_update.rb +24 -0
  31. data/lib/wallee-ruby-sdk/models/account.rb +31 -1
  32. data/lib/wallee-ruby-sdk/models/account_create.rb +11 -1
  33. data/lib/wallee-ruby-sdk/models/account_update.rb +11 -1
  34. data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
  35. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
  36. data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
  37. data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
  38. data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
  39. data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
  40. data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
  41. data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
  42. data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
  43. data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
  44. data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
  45. data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
  46. data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
  47. data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
  48. data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
  49. data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
  50. data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
  51. data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
  52. data/lib/wallee-ruby-sdk/models/charge_attempt.rb +11 -1
  53. data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
  54. data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
  55. data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +1 -1
  56. data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +1 -1
  57. data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
  58. data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
  59. data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
  60. data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
  61. data/lib/wallee-ruby-sdk/models/payment_connector_configuration.rb +13 -1
  62. data/lib/wallee-ruby-sdk/models/payment_contract.rb +1 -25
  63. data/lib/wallee-ruby-sdk/models/payment_link.rb +16 -40
  64. data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
  65. data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
  66. data/lib/wallee-ruby-sdk/models/payment_link_create.rb +16 -44
  67. data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
  68. data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
  69. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
  70. data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
  71. data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -22
  72. data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
  73. data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
  74. data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
  75. data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
  76. data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
  77. data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
  78. data/lib/wallee-ruby-sdk/models/role.rb +1 -1
  79. data/lib/wallee-ruby-sdk/models/role_state.rb +37 -0
  80. data/lib/wallee-ruby-sdk/models/sales_channel.rb +34 -4
  81. data/lib/wallee-ruby-sdk/models/shopify_additional_line_item_data.rb +35 -0
  82. data/lib/wallee-ruby-sdk/models/shopify_integration.rb +73 -31
  83. data/lib/wallee-ruby-sdk/models/shopify_integration_payment_app_version.rb +34 -0
  84. data/lib/wallee-ruby-sdk/models/{shopify_integration_app_version.rb → shopify_integration_subscription_app_version.rb} +3 -3
  85. data/lib/wallee-ruby-sdk/models/shopify_subscriber.rb +1 -1
  86. data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
  87. data/lib/wallee-ruby-sdk/models/shopify_subscriber_creation.rb +216 -0
  88. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +61 -7
  89. data/lib/wallee-ruby-sdk/models/shopify_subscription_address.rb +0 -60
  90. data/lib/wallee-ruby-sdk/models/{payment_terminal_contact_address.rb → shopify_subscription_address_create.rb} +152 -2
  91. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +363 -0
  92. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +271 -0
  93. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_item.rb → shopify_subscription_model_item.rb} +2 -2
  94. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_tax_line.rb → shopify_subscription_model_tax_line.rb} +1 -1
  95. data/lib/wallee-ruby-sdk/models/shopify_subscription_product_create.rb +9 -14
  96. data/lib/wallee-ruby-sdk/models/{shopify_subscription_product_active.rb → shopify_subscription_product_update.rb} +2 -12
  97. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_addresses_request.rb +211 -0
  98. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_request.rb +11 -81
  99. data/lib/wallee-ruby-sdk/models/shopify_subscription_version.rb +11 -1
  100. data/lib/wallee-ruby-sdk/models/space.rb +31 -1
  101. data/lib/wallee-ruby-sdk/models/space_create.rb +11 -1
  102. data/lib/wallee-ruby-sdk/models/space_update.rb +11 -1
  103. data/lib/wallee-ruby-sdk/models/subscriber.rb +1 -1
  104. data/lib/wallee-ruby-sdk/models/subscriber_create.rb +1 -1
  105. data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
  106. data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +1 -25
  107. data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +1 -29
  108. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +1 -25
  109. data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +1 -25
  110. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +49 -1
  111. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +49 -1
  112. data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +1 -1
  113. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +12 -2
  114. data/lib/wallee-ruby-sdk/models/subscription_ledger_entry_create.rb +1 -1
  115. data/lib/wallee-ruby-sdk/models/subscription_product.rb +11 -1
  116. data/lib/wallee-ruby-sdk/models/subscription_product_active.rb +11 -1
  117. data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
  118. data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
  119. data/lib/wallee-ruby-sdk/models/subscription_product_create.rb +11 -1
  120. data/lib/wallee-ruby-sdk/models/subscription_product_version.rb +11 -1
  121. data/lib/wallee-ruby-sdk/models/subscription_product_version_pending.rb +14 -4
  122. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +206 -0
  123. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +35 -0
  124. data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
  125. data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
  126. data/lib/wallee-ruby-sdk/models/token.rb +1 -25
  127. data/lib/wallee-ruby-sdk/models/token_create.rb +1 -29
  128. data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
  129. data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
  130. data/lib/wallee-ruby-sdk/models/transaction.rb +132 -4
  131. data/lib/wallee-ruby-sdk/models/transaction_completion.rb +26 -1
  132. data/lib/wallee-ruby-sdk/models/transaction_completion_behavior.rb +36 -0
  133. data/lib/wallee-ruby-sdk/models/transaction_completion_request.rb +26 -1
  134. data/lib/wallee-ruby-sdk/models/transaction_create.rb +59 -1
  135. data/lib/wallee-ruby-sdk/models/transaction_pending.rb +59 -1
  136. data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
  137. data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
  138. data/lib/wallee-ruby-sdk/models/webhook_url.rb +35 -1
  139. data/lib/wallee-ruby-sdk/models/webhook_url_create.rb +24 -0
  140. data/lib/wallee-ruby-sdk/models/webhook_url_update.rb +24 -0
  141. data/lib/wallee-ruby-sdk/version.rb +1 -1
  142. data/test/condition_type_service_test.rb +22 -0
  143. data/wallee-ruby-sdk.gemspec +3 -2
  144. metadata +93 -17
@@ -18,27 +18,47 @@ limitations under the License.
18
18
  require 'date'
19
19
 
20
20
  module Wallee
21
- # This model holds the card data in plain.
22
- class UnencryptedCardData
21
+ # This model holds the card data and optional cardholder authentication details.
22
+ class AuthenticatedCardDataCreate
23
23
  # The card holder name is the name printed onto the card. It identifies the person who owns the card.
24
24
  attr_accessor :card_holder_name
25
25
 
26
26
  # The card verification code (CVC) is a 3 to 4 digit code typically printed on the back of the card. It helps to ensure that the card holder is authorizing the transaction. For card not-present transactions this field is optional.
27
27
  attr_accessor :card_verification_code
28
28
 
29
+ # The cardholder authentication information. The authentication is optional and can be provided if the cardholder has been already authenticated (e.g. in 3-D Secure system).
30
+ attr_accessor :cardholder_authentication
31
+
32
+ # The additional authentication value used to secure the tokenized card transactions.
33
+ attr_accessor :cryptogram
34
+
29
35
  # The card expiry date indicates when the card expires. The format is the format yyyy-mm where yyyy is the year (e.g. 2019) and the mm is the month (e.g. 09).
30
36
  attr_accessor :expiry_date
31
37
 
32
38
  # The primary account number (PAN) identifies the card. The number is numeric and typically printed on the front of the card.
33
39
  attr_accessor :primary_account_number
34
40
 
41
+ #
42
+ attr_accessor :recurring_indicator
43
+
44
+ #
45
+ attr_accessor :scheme_transaction_reference
46
+
47
+ #
48
+ attr_accessor :token_requestor_id
49
+
35
50
  # Attribute mapping from ruby-style variable name to JSON key.
36
51
  def self.attribute_map
37
52
  {
38
53
  :'card_holder_name' => :'cardHolderName',
39
54
  :'card_verification_code' => :'cardVerificationCode',
55
+ :'cardholder_authentication' => :'cardholderAuthentication',
56
+ :'cryptogram' => :'cryptogram',
40
57
  :'expiry_date' => :'expiryDate',
41
- :'primary_account_number' => :'primaryAccountNumber'
58
+ :'primary_account_number' => :'primaryAccountNumber',
59
+ :'recurring_indicator' => :'recurringIndicator',
60
+ :'scheme_transaction_reference' => :'schemeTransactionReference',
61
+ :'token_requestor_id' => :'tokenRequestorId'
42
62
  }
43
63
  end
44
64
 
@@ -47,8 +67,13 @@ module Wallee
47
67
  {
48
68
  :'card_holder_name' => :'String',
49
69
  :'card_verification_code' => :'String',
70
+ :'cardholder_authentication' => :'CardholderAuthenticationCreate',
71
+ :'cryptogram' => :'CardCryptogramCreate',
50
72
  :'expiry_date' => :'String',
51
- :'primary_account_number' => :'String'
73
+ :'primary_account_number' => :'String',
74
+ :'recurring_indicator' => :'RecurringIndicator',
75
+ :'scheme_transaction_reference' => :'String',
76
+ :'token_requestor_id' => :'String'
52
77
  }
53
78
  end
54
79
 
@@ -68,6 +93,14 @@ module Wallee
68
93
  self.card_verification_code = attributes[:'cardVerificationCode']
69
94
  end
70
95
 
96
+ if attributes.has_key?(:'cardholderAuthentication')
97
+ self.cardholder_authentication = attributes[:'cardholderAuthentication']
98
+ end
99
+
100
+ if attributes.has_key?(:'cryptogram')
101
+ self.cryptogram = attributes[:'cryptogram']
102
+ end
103
+
71
104
  if attributes.has_key?(:'expiryDate')
72
105
  self.expiry_date = attributes[:'expiryDate']
73
106
  end
@@ -75,6 +108,18 @@ module Wallee
75
108
  if attributes.has_key?(:'primaryAccountNumber')
76
109
  self.primary_account_number = attributes[:'primaryAccountNumber']
77
110
  end
111
+
112
+ if attributes.has_key?(:'recurringIndicator')
113
+ self.recurring_indicator = attributes[:'recurringIndicator']
114
+ end
115
+
116
+ if attributes.has_key?(:'schemeTransactionReference')
117
+ self.scheme_transaction_reference = attributes[:'schemeTransactionReference']
118
+ end
119
+
120
+ if attributes.has_key?(:'tokenRequestorId')
121
+ self.token_requestor_id = attributes[:'tokenRequestorId']
122
+ end
78
123
  end
79
124
 
80
125
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -93,14 +138,22 @@ module Wallee
93
138
  invalid_properties.push('invalid value for "card_verification_code", the character length must be great than or equal to 3.')
94
139
  end
95
140
 
96
- if !@primary_account_number.nil? && @primary_account_number.to_s.length > 30
141
+ if @primary_account_number.nil?
142
+ invalid_properties.push('invalid value for "primary_account_number", primary_account_number cannot be nil.')
143
+ end
144
+
145
+ if @primary_account_number.to_s.length > 30
97
146
  invalid_properties.push('invalid value for "primary_account_number", the character length must be smaller than or equal to 30.')
98
147
  end
99
148
 
100
- if !@primary_account_number.nil? && @primary_account_number.to_s.length < 10
149
+ if @primary_account_number.to_s.length < 10
101
150
  invalid_properties.push('invalid value for "primary_account_number", the character length must be great than or equal to 10.')
102
151
  end
103
152
 
153
+ if !@scheme_transaction_reference.nil? && @scheme_transaction_reference.to_s.length > 100
154
+ invalid_properties.push('invalid value for "scheme_transaction_reference", the character length must be smaller than or equal to 100.')
155
+ end
156
+
104
157
  invalid_properties
105
158
  end
106
159
 
@@ -110,8 +163,10 @@ module Wallee
110
163
  return false if !@card_holder_name.nil? && @card_holder_name.to_s.length > 100
111
164
  return false if !@card_verification_code.nil? && @card_verification_code.to_s.length > 4
112
165
  return false if !@card_verification_code.nil? && @card_verification_code.to_s.length < 3
113
- return false if !@primary_account_number.nil? && @primary_account_number.to_s.length > 30
114
- return false if !@primary_account_number.nil? && @primary_account_number.to_s.length < 10
166
+ return false if @primary_account_number.nil?
167
+ return false if @primary_account_number.to_s.length > 30
168
+ return false if @primary_account_number.to_s.length < 10
169
+ return false if !@scheme_transaction_reference.nil? && @scheme_transaction_reference.to_s.length > 100
115
170
  true
116
171
  end
117
172
 
@@ -142,17 +197,31 @@ module Wallee
142
197
  # Custom attribute writer method with validation
143
198
  # @param [Object] primary_account_number Value to be assigned
144
199
  def primary_account_number=(primary_account_number)
145
- if !primary_account_number.nil? && primary_account_number.to_s.length > 30
200
+ if primary_account_number.nil?
201
+ fail ArgumentError, 'primary_account_number cannot be nil'
202
+ end
203
+
204
+ if primary_account_number.to_s.length > 30
146
205
  fail ArgumentError, 'invalid value for "primary_account_number", the character length must be smaller than or equal to 30.'
147
206
  end
148
207
 
149
- if !primary_account_number.nil? && primary_account_number.to_s.length < 10
208
+ if primary_account_number.to_s.length < 10
150
209
  fail ArgumentError, 'invalid value for "primary_account_number", the character length must be great than or equal to 10.'
151
210
  end
152
211
 
153
212
  @primary_account_number = primary_account_number
154
213
  end
155
214
 
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] scheme_transaction_reference Value to be assigned
217
+ def scheme_transaction_reference=(scheme_transaction_reference)
218
+ if !scheme_transaction_reference.nil? && scheme_transaction_reference.to_s.length > 100
219
+ fail ArgumentError, 'invalid value for "scheme_transaction_reference", the character length must be smaller than or equal to 100.'
220
+ end
221
+
222
+ @scheme_transaction_reference = scheme_transaction_reference
223
+ end
224
+
156
225
  # Checks equality by comparing each attribute.
157
226
  # @param [Object] Object to be compared
158
227
  def ==(o)
@@ -160,8 +229,13 @@ module Wallee
160
229
  self.class == o.class &&
161
230
  card_holder_name == o.card_holder_name &&
162
231
  card_verification_code == o.card_verification_code &&
232
+ cardholder_authentication == o.cardholder_authentication &&
233
+ cryptogram == o.cryptogram &&
163
234
  expiry_date == o.expiry_date &&
164
- primary_account_number == o.primary_account_number
235
+ primary_account_number == o.primary_account_number &&
236
+ recurring_indicator == o.recurring_indicator &&
237
+ scheme_transaction_reference == o.scheme_transaction_reference &&
238
+ token_requestor_id == o.token_requestor_id
165
239
  end
166
240
 
167
241
  # @see the `==` method
@@ -173,7 +247,7 @@ module Wallee
173
247
  # Calculates hash code according to all attributes.
174
248
  # @return [Fixnum] Hash code
175
249
  def hash
176
- [card_holder_name, card_verification_code, expiry_date, primary_account_number].hash
250
+ [card_holder_name, card_verification_code, cardholder_authentication, cryptogram, expiry_date, primary_account_number, recurring_indicator, scheme_transaction_reference, token_requestor_id].hash
177
251
  end
178
252
 
179
253
  # Builds the object from hash
@@ -0,0 +1,291 @@
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
+ #
22
+ class BankAccount
23
+ # The optional description is shown along the identifier. The intention of the description is to give an alternative name to the bank account.
24
+ attr_accessor :description
25
+
26
+ # The ID is the primary key of the entity. The ID identifies the entity uniquely.
27
+ attr_accessor :id
28
+
29
+ # The bank account identifier is responsible to uniquely identify the bank account.
30
+ attr_accessor :identifier
31
+
32
+ # The linked space id holds the ID of the space to which the entity belongs to.
33
+ attr_accessor :linked_space_id
34
+
35
+ # The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
36
+ attr_accessor :planned_purge_date
37
+
38
+ #
39
+ attr_accessor :state
40
+
41
+ #
42
+ attr_accessor :type
43
+
44
+ # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
45
+ attr_accessor :version
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'description' => :'description',
51
+ :'id' => :'id',
52
+ :'identifier' => :'identifier',
53
+ :'linked_space_id' => :'linkedSpaceId',
54
+ :'planned_purge_date' => :'plannedPurgeDate',
55
+ :'state' => :'state',
56
+ :'type' => :'type',
57
+ :'version' => :'version'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ :'description' => :'String',
65
+ :'id' => :'Integer',
66
+ :'identifier' => :'String',
67
+ :'linked_space_id' => :'Integer',
68
+ :'planned_purge_date' => :'DateTime',
69
+ :'state' => :'BankAccountState',
70
+ :'type' => :'Integer',
71
+ :'version' => :'Integer'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ if attributes.has_key?(:'description')
84
+ self.description = attributes[:'description']
85
+ end
86
+
87
+ if attributes.has_key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.has_key?(:'identifier')
92
+ self.identifier = attributes[:'identifier']
93
+ end
94
+
95
+ if attributes.has_key?(:'linkedSpaceId')
96
+ self.linked_space_id = attributes[:'linkedSpaceId']
97
+ end
98
+
99
+ if attributes.has_key?(:'plannedPurgeDate')
100
+ self.planned_purge_date = attributes[:'plannedPurgeDate']
101
+ end
102
+
103
+ if attributes.has_key?(:'state')
104
+ self.state = attributes[:'state']
105
+ end
106
+
107
+ if attributes.has_key?(:'type')
108
+ self.type = attributes[:'type']
109
+ end
110
+
111
+ if attributes.has_key?(:'version')
112
+ self.version = attributes[:'version']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ if !@description.nil? && @description.to_s.length > 100
121
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 100.')
122
+ end
123
+
124
+ if !@identifier.nil? && @identifier.to_s.length > 100
125
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 100.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ return false if !@description.nil? && @description.to_s.length > 100
135
+ return false if !@identifier.nil? && @identifier.to_s.length > 100
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] description Value to be assigned
141
+ def description=(description)
142
+ if !description.nil? && description.to_s.length > 100
143
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 100.'
144
+ end
145
+
146
+ @description = description
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] identifier Value to be assigned
151
+ def identifier=(identifier)
152
+ if !identifier.nil? && identifier.to_s.length > 100
153
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 100.'
154
+ end
155
+
156
+ @identifier = identifier
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ description == o.description &&
165
+ id == o.id &&
166
+ identifier == o.identifier &&
167
+ linked_space_id == o.linked_space_id &&
168
+ planned_purge_date == o.planned_purge_date &&
169
+ state == o.state &&
170
+ type == o.type &&
171
+ version == o.version
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Fixnum] Hash code
182
+ def hash
183
+ [description, id, identifier, linked_space_id, planned_purge_date, state, type, version].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.swagger_types.each_pair do |key, type|
192
+ if type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Deserializes the data based on type
207
+ # @param string type Data type
208
+ # @param string value Value to be deserialized
209
+ # @return [Object] Deserialized data
210
+ def _deserialize(type, value)
211
+ case type.to_sym
212
+ when :DateTime
213
+ DateTime.parse(value)
214
+ when :Date
215
+ Date.parse(value)
216
+ when :String
217
+ value.to_s
218
+ when :Integer
219
+ value.to_i
220
+ when :Float
221
+ value.to_f
222
+ when :BOOLEAN
223
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
+ true
225
+ else
226
+ false
227
+ end
228
+ when :Object
229
+ # generic object (usually a Hash), return directly
230
+ value
231
+ when /\AArray<(?<inner_type>.+)>\z/
232
+ inner_type = Regexp.last_match[:inner_type]
233
+ value.map { |v| _deserialize(inner_type, v) }
234
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
+ k_type = Regexp.last_match[:k_type]
236
+ v_type = Regexp.last_match[:v_type]
237
+ {}.tap do |hash|
238
+ value.each do |k, v|
239
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
+ end
241
+ end
242
+ else # model
243
+ temp_model = Wallee.const_get(type).new
244
+ temp_model.build_from_hash(value)
245
+ end
246
+ end
247
+
248
+ # Returns the string representation of the object
249
+ # @return [String] String presentation of the object
250
+ def to_s
251
+ to_hash.to_s
252
+ end
253
+
254
+ # to_body is an alias to to_hash (backward compatibility)
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_body
257
+ to_hash
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ self.class.attribute_map.each_pair do |attr, param|
265
+ value = self.send(attr)
266
+ next if value.nil?
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map{ |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+ end