wallee-ruby-sdk 6.2.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +56 -14
  3. data/LICENSE +1 -1
  4. data/README.md +57 -29
  5. data/lib/wallee-ruby-sdk/api_client.rb +1 -1
  6. data/lib/wallee-ruby-sdk/api_exception_error_codes.rb +60 -0
  7. data/lib/wallee-ruby-sdk/models/bogus_express_checkout_approval_request.rb +230 -0
  8. data/lib/wallee-ruby-sdk/models/bogus_express_checkout_payment_data.rb +241 -0
  9. data/lib/wallee-ruby-sdk/models/express_checkout_approval_response.rb +270 -0
  10. data/lib/wallee-ruby-sdk/models/express_checkout_create_response.rb +13 -4
  11. data/lib/wallee-ruby-sdk/models/express_checkout_session.rb +39 -1
  12. data/lib/wallee-ruby-sdk/models/express_checkout_session_create.rb +21 -1
  13. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_address_change_request.rb +239 -0
  14. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_address_change_response.rb +241 -0
  15. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_method_change_request.rb +231 -0
  16. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_method_change_response.rb +241 -0
  17. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_option.rb +1 -1
  18. data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +43 -5
  19. data/lib/wallee-ruby-sdk/models/payment_terminal_dcc_transaction_sum.rb +302 -0
  20. data/lib/wallee-ruby-sdk/models/payment_terminal_transaction_sum.rb +332 -0
  21. data/lib/wallee-ruby-sdk/models/payment_terminal_transaction_summary.rb +347 -0
  22. data/lib/wallee-ruby-sdk/models/refund.rb +13 -1
  23. data/lib/wallee-ruby-sdk/models/refund_create.rb +13 -1
  24. data/lib/wallee-ruby-sdk/models/rendered_terminal_transaction_summary.rb +241 -0
  25. data/lib/wallee-ruby-sdk/models/scope.rb +15 -15
  26. data/lib/wallee-ruby-sdk/models/terminal_transaction_summary_list_response.rb +253 -0
  27. data/lib/wallee-ruby-sdk/models/terminal_transaction_summary_search_response.rb +263 -0
  28. data/lib/wallee-ruby-sdk/models/transaction_completion.rb +13 -1
  29. data/lib/wallee-ruby-sdk/models/transaction_completion_details.rb +26 -4
  30. data/lib/wallee-ruby-sdk/models/transaction_user_interface_type.rb +2 -1
  31. data/lib/wallee-ruby-sdk/sdk_exception_error_codes.rb +55 -0
  32. data/lib/wallee-ruby-sdk/service/bogus_express_checkout_service.rb +114 -0
  33. data/lib/wallee-ruby-sdk/service/express_checkout_service.rb +162 -0
  34. data/lib/wallee-ruby-sdk/service/payment_terminal_transaction_summaries_service.rb +372 -0
  35. data/lib/wallee-ruby-sdk/service/webhook_encryption_keys_service.rb +2 -2
  36. data/lib/wallee-ruby-sdk/utils/encryption_util.rb +5 -5
  37. data/lib/wallee-ruby-sdk/version.rb +1 -1
  38. data/lib/wallee-ruby-sdk/wallee_sdk_exception.rb +2 -33
  39. data/lib/wallee-ruby-sdk.rb +20 -1
  40. data/test/test_querying.rb +11 -0
  41. metadata +19 -2
@@ -27,12 +27,20 @@ module WalleeRubySdk
27
27
  class ExpressCheckoutSessionCreate
28
28
  attr_accessor :line_items
29
29
 
30
+ # The URL to fetch the shipping options from.
31
+ attr_accessor :merchant_shipping_callback_url
32
+
33
+ # The currency of the session.
34
+ attr_accessor :currency
35
+
30
36
  attr_accessor :shipping_options
31
37
 
32
38
  # Attribute mapping from ruby-style variable name to JSON key.
33
39
  def self.attribute_map
34
40
  {
35
41
  :'line_items' => :'lineItems',
42
+ :'merchant_shipping_callback_url' => :'merchantShippingCallbackUrl',
43
+ :'currency' => :'currency',
36
44
  :'shipping_options' => :'shippingOptions'
37
45
  }
38
46
  end
@@ -51,6 +59,8 @@ module WalleeRubySdk
51
59
  def self.openapi_types
52
60
  {
53
61
  :'line_items' => :'Array<LineItem>',
62
+ :'merchant_shipping_callback_url' => :'String',
63
+ :'currency' => :'String',
54
64
  :'shipping_options' => :'Array<ExpressCheckoutShippingOption>'
55
65
  }
56
66
  end
@@ -83,6 +93,14 @@ module WalleeRubySdk
83
93
  end
84
94
  end
85
95
 
96
+ if attributes.key?(:'merchant_shipping_callback_url')
97
+ self.merchant_shipping_callback_url = attributes[:'merchant_shipping_callback_url']
98
+ end
99
+
100
+ if attributes.key?(:'currency')
101
+ self.currency = attributes[:'currency']
102
+ end
103
+
86
104
  if attributes.key?(:'shipping_options')
87
105
  if (value = attributes[:'shipping_options']).is_a?(Array)
88
106
  self.shipping_options = value
@@ -111,6 +129,8 @@ module WalleeRubySdk
111
129
  return true if self.equal?(o)
112
130
  self.class == o.class &&
113
131
  line_items == o.line_items &&
132
+ merchant_shipping_callback_url == o.merchant_shipping_callback_url &&
133
+ currency == o.currency &&
114
134
  shipping_options == o.shipping_options
115
135
  end
116
136
 
@@ -123,7 +143,7 @@ module WalleeRubySdk
123
143
  # Calculates hash code according to all attributes.
124
144
  # @return [Integer] Hash code
125
145
  def hash
126
- [line_items, shipping_options].hash
146
+ [line_items, merchant_shipping_callback_url, currency, shipping_options].hash
127
147
  end
128
148
 
129
149
  # Builds the object from hash
@@ -0,0 +1,239 @@
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 ExpressCheckoutShippingAddressChangeRequest
28
+ attr_accessor :shipping_address
29
+
30
+ attr_accessor :billing_address
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'shipping_address' => :'shippingAddress',
36
+ :'billing_address' => :'billingAddress'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'shipping_address' => :'Address',
54
+ :'billing_address' => :'Address'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::ExpressCheckoutShippingAddressChangeRequest` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ acceptable_attribute_map = self.class.acceptable_attribute_map
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!acceptable_attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::ExpressCheckoutShippingAddressChangeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'shipping_address')
81
+ self.shipping_address = attributes[:'shipping_address']
82
+ end
83
+
84
+ if attributes.key?(:'billing_address')
85
+ self.billing_address = attributes[:'billing_address']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
93
+ invalid_properties = Array.new
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ shipping_address == o.shipping_address &&
110
+ billing_address == o.billing_address
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [shipping_address, billing_address].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = WalleeRubySdk.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -0,0 +1,241 @@
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 ExpressCheckoutShippingAddressChangeResponse
28
+ attr_accessor :order_total
29
+
30
+ attr_accessor :shipping_options
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'order_total' => :'orderTotal',
36
+ :'shipping_options' => :'shippingOptions'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'order_total' => :'Float',
54
+ :'shipping_options' => :'Array<ExpressCheckoutShippingOption>'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::ExpressCheckoutShippingAddressChangeResponse` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ acceptable_attribute_map = self.class.acceptable_attribute_map
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!acceptable_attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::ExpressCheckoutShippingAddressChangeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'order_total')
81
+ self.order_total = attributes[:'order_total']
82
+ end
83
+
84
+ if attributes.key?(:'shipping_options')
85
+ if (value = attributes[:'shipping_options']).is_a?(Array)
86
+ self.shipping_options = value
87
+ end
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ order_total == o.order_total &&
112
+ shipping_options == o.shipping_options
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [order_total, shipping_options].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = WalleeRubySdk.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end