wallee-ruby-sdk 7.0.0 → 8.0.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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -16
  3. data/README.md +38 -1
  4. data/lib/wallee-ruby-sdk/api_client.rb +1 -1
  5. data/lib/wallee-ruby-sdk/models/charge_attempt_projection.rb +13 -4
  6. data/lib/wallee-ruby-sdk/models/express_checkout_session.rb +449 -0
  7. data/lib/wallee-ruby-sdk/models/express_checkout_session_create.rb +381 -0
  8. data/lib/wallee-ruby-sdk/models/express_checkout_session_create_response.rb +241 -0
  9. data/lib/wallee-ruby-sdk/models/express_checkout_session_process_request.rb +329 -0
  10. data/lib/wallee-ruby-sdk/models/express_checkout_session_process_response.rb +231 -0
  11. data/lib/wallee-ruby-sdk/models/express_checkout_session_state.rb +53 -0
  12. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_option.rb +303 -0
  13. data/lib/wallee-ruby-sdk/models/express_checkout_wallet_type.rb +255 -0
  14. data/lib/wallee-ruby-sdk/models/fulfillment_state.rb +2 -1
  15. data/lib/wallee-ruby-sdk/models/merchant_application_submit_request_dto.rb +232 -0
  16. data/lib/wallee-ruby-sdk/models/merchant_application_submitted_dto.rb +273 -0
  17. data/lib/wallee-ruby-sdk/models/{payment_terminal_update.rb → payment_terminal_update_request.rb} +15 -41
  18. data/lib/wallee-ruby-sdk/models/subscription_partial_update_request.rb +250 -0
  19. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +45 -22
  20. data/lib/wallee-ruby-sdk/models/transaction_amounts.rb +257 -0
  21. data/lib/wallee-ruby-sdk/models/walleejoin_create_partnership_api_request_dto.rb +20 -1
  22. data/lib/wallee-ruby-sdk/service/express_checkout_session_service.rb +255 -0
  23. data/lib/wallee-ruby-sdk/service/merchant_applications_service.rb +151 -0
  24. data/lib/wallee-ruby-sdk/service/payment_terminals_service.rb +9 -9
  25. data/lib/wallee-ruby-sdk/service/subscriptions_service.rb +9 -9
  26. data/lib/wallee-ruby-sdk/version.rb +1 -1
  27. data/lib/wallee-ruby-sdk.rb +14 -1
  28. data/wallee-ruby-sdk.gemspec +3 -3
  29. metadata +962 -931
@@ -0,0 +1,449 @@
1
+ =begin
2
+ # Wallee AG Ruby SDK
3
+ #
4
+ # This library allows to interact with the Wallee AG payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://en.wallee.com
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 WalleeRubySdk
27
+ class ExpressCheckoutSession
28
+ # The URL to fetch the shipping options from.
29
+ attr_accessor :merchant_shipping_callback_url
30
+
31
+ # The total amount of the session.
32
+ attr_accessor :authorization_amount
33
+
34
+ attr_accessor :wallet_type
35
+
36
+ # The date and time when the object is planned to be permanently removed. If the value is empty, the object will not be removed.
37
+ attr_accessor :planned_purge_date
38
+
39
+ # Customer time zone for presentation and cutoffs (same semantics as on Transaction).
40
+ attr_accessor :time_zone
41
+
42
+ # Preferred language for customer-facing content (same semantics as on Transaction).
43
+ attr_accessor :language
44
+
45
+ # The date and time when the session was created.
46
+ attr_accessor :created_on
47
+
48
+ attr_accessor :line_items
49
+
50
+ # The spaceId linked to the entity.
51
+ attr_accessor :linked_space_id
52
+
53
+ # The base URL on the merchant shop used to create the order.
54
+ attr_accessor :merchant_redirect_url
55
+
56
+ attr_accessor :meta_data
57
+
58
+ attr_accessor :authorization_environment
59
+
60
+ attr_accessor :failure_reason
61
+
62
+ attr_accessor :shipping_address
63
+
64
+ # The currency of the session.
65
+ attr_accessor :currency
66
+
67
+ attr_accessor :billing_address
68
+
69
+ # Id of the entity.
70
+ attr_accessor :id
71
+
72
+ attr_accessor :state
73
+
74
+ # The payment transaction this object is linked to.
75
+ attr_accessor :linked_transaction
76
+
77
+ attr_accessor :shipping_options
78
+
79
+ attr_accessor :transaction
80
+
81
+ class EnumAttributeValidator
82
+ attr_reader :datatype
83
+ attr_reader :allowable_values
84
+
85
+ def initialize(datatype, allowable_values)
86
+ @allowable_values = allowable_values.map do |value|
87
+ case datatype.to_s
88
+ when /Integer/i
89
+ value.to_i
90
+ when /Float/i
91
+ value.to_f
92
+ else
93
+ value
94
+ end
95
+ end
96
+ end
97
+
98
+ def valid?(value)
99
+ !value || allowable_values.include?(value)
100
+ end
101
+ end
102
+
103
+ # Attribute mapping from ruby-style variable name to JSON key.
104
+ def self.attribute_map
105
+ {
106
+ :'merchant_shipping_callback_url' => :'merchantShippingCallbackUrl',
107
+ :'authorization_amount' => :'authorizationAmount',
108
+ :'wallet_type' => :'walletType',
109
+ :'planned_purge_date' => :'plannedPurgeDate',
110
+ :'time_zone' => :'timeZone',
111
+ :'language' => :'language',
112
+ :'created_on' => :'createdOn',
113
+ :'line_items' => :'lineItems',
114
+ :'linked_space_id' => :'linkedSpaceId',
115
+ :'merchant_redirect_url' => :'merchantRedirectUrl',
116
+ :'meta_data' => :'metaData',
117
+ :'authorization_environment' => :'authorizationEnvironment',
118
+ :'failure_reason' => :'failureReason',
119
+ :'shipping_address' => :'shippingAddress',
120
+ :'currency' => :'currency',
121
+ :'billing_address' => :'billingAddress',
122
+ :'id' => :'id',
123
+ :'state' => :'state',
124
+ :'linked_transaction' => :'linkedTransaction',
125
+ :'shipping_options' => :'shippingOptions',
126
+ :'transaction' => :'transaction'
127
+ }
128
+ end
129
+
130
+ # Returns attribute mapping this model knows about
131
+ def self.acceptable_attribute_map
132
+ attribute_map
133
+ end
134
+
135
+ # Returns all the JSON keys this model knows about
136
+ def self.acceptable_attributes
137
+ acceptable_attribute_map.values
138
+ end
139
+
140
+ # Attribute type mapping.
141
+ def self.openapi_types
142
+ {
143
+ :'merchant_shipping_callback_url' => :'String',
144
+ :'authorization_amount' => :'Float',
145
+ :'wallet_type' => :'ExpressCheckoutWalletType',
146
+ :'planned_purge_date' => :'Time',
147
+ :'time_zone' => :'String',
148
+ :'language' => :'String',
149
+ :'created_on' => :'Time',
150
+ :'line_items' => :'Array<LineItem>',
151
+ :'linked_space_id' => :'Integer',
152
+ :'merchant_redirect_url' => :'String',
153
+ :'meta_data' => :'Hash<String, String>',
154
+ :'authorization_environment' => :'ChargeAttemptEnvironment',
155
+ :'failure_reason' => :'FailureReason',
156
+ :'shipping_address' => :'Address',
157
+ :'currency' => :'String',
158
+ :'billing_address' => :'Address',
159
+ :'id' => :'Integer',
160
+ :'state' => :'ExpressCheckoutSessionState',
161
+ :'linked_transaction' => :'Integer',
162
+ :'shipping_options' => :'Array<ExpressCheckoutShippingOption>',
163
+ :'transaction' => :'Transaction'
164
+ }
165
+ end
166
+
167
+ # List of attributes with nullable: true
168
+ def self.openapi_nullable
169
+ Set.new([
170
+ ])
171
+ end
172
+
173
+ # Initializes the object
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ def initialize(attributes = {})
176
+ if (!attributes.is_a?(Hash))
177
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::ExpressCheckoutSession` initialize method"
178
+ end
179
+
180
+ # check to see if the attribute exists and convert string to symbol for hash key
181
+ acceptable_attribute_map = self.class.acceptable_attribute_map
182
+ attributes = attributes.each_with_object({}) { |(k, v), h|
183
+ if (!acceptable_attribute_map.key?(k.to_sym))
184
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::ExpressCheckoutSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
185
+ end
186
+ h[k.to_sym] = v
187
+ }
188
+
189
+ if attributes.key?(:'merchant_shipping_callback_url')
190
+ self.merchant_shipping_callback_url = attributes[:'merchant_shipping_callback_url']
191
+ end
192
+
193
+ if attributes.key?(:'authorization_amount')
194
+ self.authorization_amount = attributes[:'authorization_amount']
195
+ end
196
+
197
+ if attributes.key?(:'wallet_type')
198
+ self.wallet_type = attributes[:'wallet_type']
199
+ end
200
+
201
+ if attributes.key?(:'planned_purge_date')
202
+ self.planned_purge_date = attributes[:'planned_purge_date']
203
+ end
204
+
205
+ if attributes.key?(:'time_zone')
206
+ self.time_zone = attributes[:'time_zone']
207
+ end
208
+
209
+ if attributes.key?(:'language')
210
+ self.language = attributes[:'language']
211
+ end
212
+
213
+ if attributes.key?(:'created_on')
214
+ self.created_on = attributes[:'created_on']
215
+ end
216
+
217
+ if attributes.key?(:'line_items')
218
+ if (value = attributes[:'line_items']).is_a?(Array)
219
+ self.line_items = value
220
+ end
221
+ end
222
+
223
+ if attributes.key?(:'linked_space_id')
224
+ self.linked_space_id = attributes[:'linked_space_id']
225
+ end
226
+
227
+ if attributes.key?(:'merchant_redirect_url')
228
+ self.merchant_redirect_url = attributes[:'merchant_redirect_url']
229
+ end
230
+
231
+ if attributes.key?(:'meta_data')
232
+ if (value = attributes[:'meta_data']).is_a?(Hash)
233
+ self.meta_data = value
234
+ end
235
+ end
236
+
237
+ if attributes.key?(:'authorization_environment')
238
+ self.authorization_environment = attributes[:'authorization_environment']
239
+ end
240
+
241
+ if attributes.key?(:'failure_reason')
242
+ self.failure_reason = attributes[:'failure_reason']
243
+ end
244
+
245
+ if attributes.key?(:'shipping_address')
246
+ self.shipping_address = attributes[:'shipping_address']
247
+ end
248
+
249
+ if attributes.key?(:'currency')
250
+ self.currency = attributes[:'currency']
251
+ end
252
+
253
+ if attributes.key?(:'billing_address')
254
+ self.billing_address = attributes[:'billing_address']
255
+ end
256
+
257
+ if attributes.key?(:'id')
258
+ self.id = attributes[:'id']
259
+ end
260
+
261
+ if attributes.key?(:'state')
262
+ self.state = attributes[:'state']
263
+ end
264
+
265
+ if attributes.key?(:'linked_transaction')
266
+ self.linked_transaction = attributes[:'linked_transaction']
267
+ end
268
+
269
+ if attributes.key?(:'shipping_options')
270
+ if (value = attributes[:'shipping_options']).is_a?(Array)
271
+ self.shipping_options = value
272
+ end
273
+ end
274
+
275
+ if attributes.key?(:'transaction')
276
+ self.transaction = attributes[:'transaction']
277
+ end
278
+ end
279
+
280
+ # Show invalid properties with the reasons. Usually used together with valid?
281
+ # @return Array for valid properties with the reasons
282
+ def list_invalid_properties
283
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
284
+ invalid_properties = Array.new
285
+ invalid_properties
286
+ end
287
+
288
+ # Check to see if the all the properties in the model are valid
289
+ # @return true if the model is valid
290
+ def valid?
291
+ warn '[DEPRECATED] the `valid?` method is obsolete'
292
+ true
293
+ end
294
+
295
+ # Checks equality by comparing each attribute.
296
+ # @param [Object] Object to be compared
297
+ def ==(o)
298
+ return true if self.equal?(o)
299
+ self.class == o.class &&
300
+ merchant_shipping_callback_url == o.merchant_shipping_callback_url &&
301
+ authorization_amount == o.authorization_amount &&
302
+ wallet_type == o.wallet_type &&
303
+ planned_purge_date == o.planned_purge_date &&
304
+ time_zone == o.time_zone &&
305
+ language == o.language &&
306
+ created_on == o.created_on &&
307
+ line_items == o.line_items &&
308
+ linked_space_id == o.linked_space_id &&
309
+ merchant_redirect_url == o.merchant_redirect_url &&
310
+ meta_data == o.meta_data &&
311
+ authorization_environment == o.authorization_environment &&
312
+ failure_reason == o.failure_reason &&
313
+ shipping_address == o.shipping_address &&
314
+ currency == o.currency &&
315
+ billing_address == o.billing_address &&
316
+ id == o.id &&
317
+ state == o.state &&
318
+ linked_transaction == o.linked_transaction &&
319
+ shipping_options == o.shipping_options &&
320
+ transaction == o.transaction
321
+ end
322
+
323
+ # @see the `==` method
324
+ # @param [Object] Object to be compared
325
+ def eql?(o)
326
+ self == o
327
+ end
328
+
329
+ # Calculates hash code according to all attributes.
330
+ # @return [Integer] Hash code
331
+ def hash
332
+ [merchant_shipping_callback_url, authorization_amount, wallet_type, planned_purge_date, time_zone, language, created_on, line_items, linked_space_id, merchant_redirect_url, meta_data, authorization_environment, failure_reason, shipping_address, currency, billing_address, id, state, linked_transaction, shipping_options, transaction].hash
333
+ end
334
+
335
+ # Builds the object from hash
336
+ # @param [Hash] attributes Model attributes in the form of hash
337
+ # @return [Object] Returns the model itself
338
+ def self.build_from_hash(attributes)
339
+ return nil unless attributes.is_a?(Hash)
340
+ attributes = attributes.transform_keys(&:to_sym)
341
+ transformed_hash = {}
342
+ openapi_types.each_pair do |key, type|
343
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
344
+ transformed_hash["#{key}"] = nil
345
+ elsif type =~ /\AArray<(.*)>/i
346
+ # check to ensure the input is an array given that the attribute
347
+ # is documented as an array but the input is not
348
+ if attributes[attribute_map[key]].is_a?(Array)
349
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
350
+ end
351
+ elsif !attributes[attribute_map[key]].nil?
352
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
353
+ end
354
+ end
355
+ new(transformed_hash)
356
+ end
357
+
358
+ # Deserializes the data based on type
359
+ # @param string type Data type
360
+ # @param string value Value to be deserialized
361
+ # @return [Object] Deserialized data
362
+ def self._deserialize(type, value)
363
+ case type.to_sym
364
+ when :Time
365
+ Time.parse(value)
366
+ when :Date
367
+ Date.parse(value)
368
+ when :String
369
+ value.to_s
370
+ when :Integer
371
+ value.to_i
372
+ when :Float
373
+ value.to_f
374
+ when :Boolean
375
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
376
+ true
377
+ else
378
+ false
379
+ end
380
+ when :Object
381
+ # generic object (usually a Hash), return directly
382
+ value
383
+ when /\AArray<(?<inner_type>.+)>\z/
384
+ inner_type = Regexp.last_match[:inner_type]
385
+ value.map { |v| _deserialize(inner_type, v) }
386
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
387
+ k_type = Regexp.last_match[:k_type]
388
+ v_type = Regexp.last_match[:v_type]
389
+ {}.tap do |hash|
390
+ value.each do |k, v|
391
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
392
+ end
393
+ end
394
+ else # model
395
+ # models (e.g. Pet) or oneOf
396
+ klass = WalleeRubySdk.const_get(type)
397
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
398
+ end
399
+ end
400
+
401
+ # Returns the string representation of the object
402
+ # @return [String] String presentation of the object
403
+ def to_s
404
+ to_hash.to_s
405
+ end
406
+
407
+ # to_body is an alias to to_hash (backward compatibility)
408
+ # @return [Hash] Returns the object in the form of hash
409
+ def to_body
410
+ to_hash
411
+ end
412
+
413
+ # Returns the object in the form of hash
414
+ # @return [Hash] Returns the object in the form of hash
415
+ def to_hash
416
+ hash = {}
417
+ self.class.attribute_map.each_pair do |attr, param|
418
+ value = self.send(attr)
419
+ if value.nil?
420
+ is_nullable = self.class.openapi_nullable.include?(attr)
421
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
422
+ end
423
+
424
+ hash[param] = _to_hash(value)
425
+ end
426
+ hash
427
+ end
428
+
429
+ # Outputs non-array value in the form of hash
430
+ # For object, use to_hash. Otherwise, just return the value
431
+ # @param [Object] value Any valid value
432
+ # @return [Hash] Returns the value in the form of hash
433
+ def _to_hash(value)
434
+ if value.is_a?(Array)
435
+ value.compact.map { |v| _to_hash(v) }
436
+ elsif value.is_a?(Hash)
437
+ {}.tap do |hash|
438
+ value.each { |k, v| hash[k] = _to_hash(v) }
439
+ end
440
+ elsif value.respond_to? :to_hash
441
+ value.to_hash
442
+ else
443
+ value
444
+ end
445
+ end
446
+
447
+ end
448
+
449
+ end