wallee-ruby-sdk 2.2.3 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,363 @@
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 ShopifySubscriptionCreationRequest
23
+ #
24
+ attr_accessor :billing_address
25
+
26
+ #
27
+ attr_accessor :billing_configuration
28
+
29
+ #
30
+ attr_accessor :currency
31
+
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
+ attr_accessor :external_id
34
+
35
+ #
36
+ attr_accessor :initial_execution_date
37
+
38
+ #
39
+ attr_accessor :integration
40
+
41
+ #
42
+ attr_accessor :items
43
+
44
+ #
45
+ attr_accessor :language
46
+
47
+ #
48
+ attr_accessor :shipping_address
49
+
50
+ #
51
+ attr_accessor :shipping_method_name
52
+
53
+ #
54
+ attr_accessor :space_view_id
55
+
56
+ #
57
+ attr_accessor :store_order_confirmation_email_enabled
58
+
59
+ #
60
+ attr_accessor :subscriber
61
+
62
+ #
63
+ attr_accessor :subscriber_suspension_allowed
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'billing_address' => :'billingAddress',
69
+ :'billing_configuration' => :'billingConfiguration',
70
+ :'currency' => :'currency',
71
+ :'external_id' => :'externalId',
72
+ :'initial_execution_date' => :'initialExecutionDate',
73
+ :'integration' => :'integration',
74
+ :'items' => :'items',
75
+ :'language' => :'language',
76
+ :'shipping_address' => :'shippingAddress',
77
+ :'shipping_method_name' => :'shippingMethodName',
78
+ :'space_view_id' => :'spaceViewId',
79
+ :'store_order_confirmation_email_enabled' => :'storeOrderConfirmationEmailEnabled',
80
+ :'subscriber' => :'subscriber',
81
+ :'subscriber_suspension_allowed' => :'subscriberSuspensionAllowed'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'billing_address' => :'ShopifySubscriptionAddressCreate',
89
+ :'billing_configuration' => :'ShopifySubscriptionModelBillingConfiguration',
90
+ :'currency' => :'String',
91
+ :'external_id' => :'String',
92
+ :'initial_execution_date' => :'DateTime',
93
+ :'integration' => :'Integer',
94
+ :'items' => :'Array<ShopifySubscriptionModelItem>',
95
+ :'language' => :'String',
96
+ :'shipping_address' => :'ShopifySubscriptionAddressCreate',
97
+ :'shipping_method_name' => :'String',
98
+ :'space_view_id' => :'Integer',
99
+ :'store_order_confirmation_email_enabled' => :'BOOLEAN',
100
+ :'subscriber' => :'ShopifySubscriberCreation',
101
+ :'subscriber_suspension_allowed' => :'BOOLEAN'
102
+ }
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ return unless attributes.is_a?(Hash)
109
+
110
+ # convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
112
+
113
+ if attributes.has_key?(:'billingAddress')
114
+ self.billing_address = attributes[:'billingAddress']
115
+ end
116
+
117
+ if attributes.has_key?(:'billingConfiguration')
118
+ self.billing_configuration = attributes[:'billingConfiguration']
119
+ end
120
+
121
+ if attributes.has_key?(:'currency')
122
+ self.currency = attributes[:'currency']
123
+ end
124
+
125
+ if attributes.has_key?(:'externalId')
126
+ self.external_id = attributes[:'externalId']
127
+ end
128
+
129
+ if attributes.has_key?(:'initialExecutionDate')
130
+ self.initial_execution_date = attributes[:'initialExecutionDate']
131
+ end
132
+
133
+ if attributes.has_key?(:'integration')
134
+ self.integration = attributes[:'integration']
135
+ end
136
+
137
+ if attributes.has_key?(:'items')
138
+ if (value = attributes[:'items']).is_a?(Array)
139
+ self.items = value
140
+ end
141
+ end
142
+
143
+ if attributes.has_key?(:'language')
144
+ self.language = attributes[:'language']
145
+ end
146
+
147
+ if attributes.has_key?(:'shippingAddress')
148
+ self.shipping_address = attributes[:'shippingAddress']
149
+ end
150
+
151
+ if attributes.has_key?(:'shippingMethodName')
152
+ self.shipping_method_name = attributes[:'shippingMethodName']
153
+ end
154
+
155
+ if attributes.has_key?(:'spaceViewId')
156
+ self.space_view_id = attributes[:'spaceViewId']
157
+ end
158
+
159
+ if attributes.has_key?(:'storeOrderConfirmationEmailEnabled')
160
+ self.store_order_confirmation_email_enabled = attributes[:'storeOrderConfirmationEmailEnabled']
161
+ end
162
+
163
+ if attributes.has_key?(:'subscriber')
164
+ self.subscriber = attributes[:'subscriber']
165
+ end
166
+
167
+ if attributes.has_key?(:'subscriberSuspensionAllowed')
168
+ self.subscriber_suspension_allowed = attributes[:'subscriberSuspensionAllowed']
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ invalid_properties = Array.new
176
+ if @billing_address.nil?
177
+ invalid_properties.push('invalid value for "billing_address", billing_address cannot be nil.')
178
+ end
179
+
180
+ if @currency.nil?
181
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
182
+ end
183
+
184
+ if @external_id.nil?
185
+ invalid_properties.push('invalid value for "external_id", external_id cannot be nil.')
186
+ end
187
+
188
+ if @integration.nil?
189
+ invalid_properties.push('invalid value for "integration", integration cannot be nil.')
190
+ end
191
+
192
+ if @items.nil?
193
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
194
+ end
195
+
196
+ if @language.nil?
197
+ invalid_properties.push('invalid value for "language", language cannot be nil.')
198
+ end
199
+
200
+ if @shipping_address.nil?
201
+ invalid_properties.push('invalid value for "shipping_address", shipping_address cannot be nil.')
202
+ end
203
+
204
+ if @subscriber.nil?
205
+ invalid_properties.push('invalid value for "subscriber", subscriber cannot be nil.')
206
+ end
207
+
208
+ invalid_properties
209
+ end
210
+
211
+ # Check to see if the all the properties in the model are valid
212
+ # @return true if the model is valid
213
+ def valid?
214
+ return false if @billing_address.nil?
215
+ return false if @currency.nil?
216
+ return false if @external_id.nil?
217
+ return false if @integration.nil?
218
+ return false if @items.nil?
219
+ return false if @language.nil?
220
+ return false if @shipping_address.nil?
221
+ return false if @subscriber.nil?
222
+ true
223
+ end
224
+
225
+ # Checks equality by comparing each attribute.
226
+ # @param [Object] Object to be compared
227
+ def ==(o)
228
+ return true if self.equal?(o)
229
+ self.class == o.class &&
230
+ billing_address == o.billing_address &&
231
+ billing_configuration == o.billing_configuration &&
232
+ currency == o.currency &&
233
+ external_id == o.external_id &&
234
+ initial_execution_date == o.initial_execution_date &&
235
+ integration == o.integration &&
236
+ items == o.items &&
237
+ language == o.language &&
238
+ shipping_address == o.shipping_address &&
239
+ shipping_method_name == o.shipping_method_name &&
240
+ space_view_id == o.space_view_id &&
241
+ store_order_confirmation_email_enabled == o.store_order_confirmation_email_enabled &&
242
+ subscriber == o.subscriber &&
243
+ subscriber_suspension_allowed == o.subscriber_suspension_allowed
244
+ end
245
+
246
+ # @see the `==` method
247
+ # @param [Object] Object to be compared
248
+ def eql?(o)
249
+ self == o
250
+ end
251
+
252
+ # Calculates hash code according to all attributes.
253
+ # @return [Fixnum] Hash code
254
+ def hash
255
+ [billing_address, billing_configuration, currency, external_id, initial_execution_date, integration, items, language, shipping_address, shipping_method_name, space_view_id, store_order_confirmation_email_enabled, subscriber, subscriber_suspension_allowed].hash
256
+ end
257
+
258
+ # Builds the object from hash
259
+ # @param [Hash] attributes Model attributes in the form of hash
260
+ # @return [Object] Returns the model itself
261
+ def build_from_hash(attributes)
262
+ return nil unless attributes.is_a?(Hash)
263
+ self.class.swagger_types.each_pair do |key, type|
264
+ if type =~ /\AArray<(.*)>/i
265
+ # check to ensure the input is an array given that the attribute
266
+ # is documented as an array but the input is not
267
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
268
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
269
+ end
270
+ elsif !attributes[self.class.attribute_map[key]].nil?
271
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
272
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
273
+ end
274
+
275
+ self
276
+ end
277
+
278
+ # Deserializes the data based on type
279
+ # @param string type Data type
280
+ # @param string value Value to be deserialized
281
+ # @return [Object] Deserialized data
282
+ def _deserialize(type, value)
283
+ case type.to_sym
284
+ when :DateTime
285
+ DateTime.parse(value)
286
+ when :Date
287
+ Date.parse(value)
288
+ when :String
289
+ value.to_s
290
+ when :Integer
291
+ value.to_i
292
+ when :Float
293
+ value.to_f
294
+ when :BOOLEAN
295
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
296
+ true
297
+ else
298
+ false
299
+ end
300
+ when :Object
301
+ # generic object (usually a Hash), return directly
302
+ value
303
+ when /\AArray<(?<inner_type>.+)>\z/
304
+ inner_type = Regexp.last_match[:inner_type]
305
+ value.map { |v| _deserialize(inner_type, v) }
306
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
307
+ k_type = Regexp.last_match[:k_type]
308
+ v_type = Regexp.last_match[:v_type]
309
+ {}.tap do |hash|
310
+ value.each do |k, v|
311
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
312
+ end
313
+ end
314
+ else # model
315
+ temp_model = Wallee.const_get(type).new
316
+ temp_model.build_from_hash(value)
317
+ end
318
+ end
319
+
320
+ # Returns the string representation of the object
321
+ # @return [String] String presentation of the object
322
+ def to_s
323
+ to_hash.to_s
324
+ end
325
+
326
+ # to_body is an alias to to_hash (backward compatibility)
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_body
329
+ to_hash
330
+ end
331
+
332
+ # Returns the object in the form of hash
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_hash
335
+ hash = {}
336
+ self.class.attribute_map.each_pair do |attr, param|
337
+ value = self.send(attr)
338
+ next if value.nil?
339
+ hash[param] = _to_hash(value)
340
+ end
341
+ hash
342
+ end
343
+
344
+ # Outputs non-array value in the form of hash
345
+ # For object, use to_hash. Otherwise, just return the value
346
+ # @param [Object] value Any valid value
347
+ # @return [Hash] Returns the value in the form of hash
348
+ def _to_hash(value)
349
+ if value.is_a?(Array)
350
+ value.compact.map{ |v| _to_hash(v) }
351
+ elsif value.is_a?(Hash)
352
+ {}.tap do |hash|
353
+ value.each { |k, v| hash[k] = _to_hash(v) }
354
+ end
355
+ elsif value.respond_to? :to_hash
356
+ value.to_hash
357
+ else
358
+ value
359
+ end
360
+ end
361
+
362
+ end
363
+ end
@@ -0,0 +1,271 @@
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 ShopifySubscriptionModelBillingConfiguration
23
+ # Define the day of the month on which the recurring orders should be created.
24
+ attr_accessor :billing_day_of_month
25
+
26
+ #
27
+ attr_accessor :billing_interval_amount
28
+
29
+ # Define how frequently recurring orders should be created.
30
+ attr_accessor :billing_interval_unit
31
+
32
+ # This date will be used as basis to calculate the dates of recurring orders.
33
+ attr_accessor :billing_reference_date
34
+
35
+ # Define the weekday on which the recurring orders should be created.
36
+ attr_accessor :billing_weekday
37
+
38
+ # Define the maximum number of orders the subscription will run for.
39
+ attr_accessor :maximal_billing_cycles
40
+
41
+ # Define the maximum number of orders the subscription can be suspended for at a time.
42
+ attr_accessor :maximal_suspendable_cycles
43
+
44
+ # Define the minimal number of orders the subscription will run for.
45
+ attr_accessor :minimal_billing_cycles
46
+
47
+ # Define the number of orders the subscription will keep running for after its termination has been requested.
48
+ attr_accessor :termination_billing_cycles
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'billing_day_of_month' => :'billingDayOfMonth',
54
+ :'billing_interval_amount' => :'billingIntervalAmount',
55
+ :'billing_interval_unit' => :'billingIntervalUnit',
56
+ :'billing_reference_date' => :'billingReferenceDate',
57
+ :'billing_weekday' => :'billingWeekday',
58
+ :'maximal_billing_cycles' => :'maximalBillingCycles',
59
+ :'maximal_suspendable_cycles' => :'maximalSuspendableCycles',
60
+ :'minimal_billing_cycles' => :'minimalBillingCycles',
61
+ :'termination_billing_cycles' => :'terminationBillingCycles'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ :'billing_day_of_month' => :'Integer',
69
+ :'billing_interval_amount' => :'Integer',
70
+ :'billing_interval_unit' => :'ShopifySubscriptionBillingIntervalUnit',
71
+ :'billing_reference_date' => :'DateTime',
72
+ :'billing_weekday' => :'ShopifySubscriptionWeekday',
73
+ :'maximal_billing_cycles' => :'Integer',
74
+ :'maximal_suspendable_cycles' => :'Integer',
75
+ :'minimal_billing_cycles' => :'Integer',
76
+ :'termination_billing_cycles' => :'Integer'
77
+ }
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ return unless attributes.is_a?(Hash)
84
+
85
+ # convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
+
88
+ if attributes.has_key?(:'billingDayOfMonth')
89
+ self.billing_day_of_month = attributes[:'billingDayOfMonth']
90
+ end
91
+
92
+ if attributes.has_key?(:'billingIntervalAmount')
93
+ self.billing_interval_amount = attributes[:'billingIntervalAmount']
94
+ end
95
+
96
+ if attributes.has_key?(:'billingIntervalUnit')
97
+ self.billing_interval_unit = attributes[:'billingIntervalUnit']
98
+ end
99
+
100
+ if attributes.has_key?(:'billingReferenceDate')
101
+ self.billing_reference_date = attributes[:'billingReferenceDate']
102
+ end
103
+
104
+ if attributes.has_key?(:'billingWeekday')
105
+ self.billing_weekday = attributes[:'billingWeekday']
106
+ end
107
+
108
+ if attributes.has_key?(:'maximalBillingCycles')
109
+ self.maximal_billing_cycles = attributes[:'maximalBillingCycles']
110
+ end
111
+
112
+ if attributes.has_key?(:'maximalSuspendableCycles')
113
+ self.maximal_suspendable_cycles = attributes[:'maximalSuspendableCycles']
114
+ end
115
+
116
+ if attributes.has_key?(:'minimalBillingCycles')
117
+ self.minimal_billing_cycles = attributes[:'minimalBillingCycles']
118
+ end
119
+
120
+ if attributes.has_key?(:'terminationBillingCycles')
121
+ self.termination_billing_cycles = attributes[:'terminationBillingCycles']
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ billing_day_of_month == o.billing_day_of_month &&
144
+ billing_interval_amount == o.billing_interval_amount &&
145
+ billing_interval_unit == o.billing_interval_unit &&
146
+ billing_reference_date == o.billing_reference_date &&
147
+ billing_weekday == o.billing_weekday &&
148
+ maximal_billing_cycles == o.maximal_billing_cycles &&
149
+ maximal_suspendable_cycles == o.maximal_suspendable_cycles &&
150
+ minimal_billing_cycles == o.minimal_billing_cycles &&
151
+ termination_billing_cycles == o.termination_billing_cycles
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Fixnum] Hash code
162
+ def hash
163
+ [billing_day_of_month, billing_interval_amount, billing_interval_unit, billing_reference_date, billing_weekday, maximal_billing_cycles, maximal_suspendable_cycles, minimal_billing_cycles, termination_billing_cycles].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :BOOLEAN
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ temp_model = Wallee.const_get(type).new
224
+ temp_model.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map{ |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+ end