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