vrpayment-ruby-sdk 6.2.0 → 6.3.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.
@@ -0,0 +1,263 @@
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 TerminalTransactionSummarySearchResponse
28
+ # An array containing the actual response objects.
29
+ attr_accessor :data
30
+
31
+ # The number of skipped objects.
32
+ attr_accessor :offset
33
+
34
+ # Whether there are more objects available after this set. If false, there are no more objects to retrieve.
35
+ attr_accessor :has_more
36
+
37
+ # The applied limit on the number of objects returned.
38
+ attr_accessor :limit
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'data' => :'data',
44
+ :'offset' => :'offset',
45
+ :'has_more' => :'hasMore',
46
+ :'limit' => :'limit'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'data' => :'Array<PaymentTerminalTransactionSummary>',
64
+ :'offset' => :'Integer',
65
+ :'has_more' => :'Boolean',
66
+ :'limit' => :'Integer'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VrpaymentRubySdk::TerminalTransactionSummarySearchResponse` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VrpaymentRubySdk::TerminalTransactionSummarySearchResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'data')
93
+ if (value = attributes[:'data']).is_a?(Array)
94
+ self.data = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'offset')
99
+ self.offset = attributes[:'offset']
100
+ end
101
+
102
+ if attributes.key?(:'has_more')
103
+ self.has_more = attributes[:'has_more']
104
+ end
105
+
106
+ if attributes.key?(:'limit')
107
+ self.limit = attributes[:'limit']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
+ invalid_properties = Array.new
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
+ true
124
+ end
125
+
126
+ # Checks equality by comparing each attribute.
127
+ # @param [Object] Object to be compared
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ data == o.data &&
132
+ offset == o.offset &&
133
+ has_more == o.has_more &&
134
+ limit == o.limit
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [data, offset, has_more, limit].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def self._deserialize(type, value)
177
+ case type.to_sym
178
+ when :Time
179
+ Time.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ # models (e.g. Pet) or oneOf
210
+ klass = VrpaymentRubySdk.const_get(type)
211
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+
261
+ end
262
+
263
+ end
@@ -0,0 +1,55 @@
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
+ module VrpaymentRubySdk
24
+ module SdkExceptionErrorCodes
25
+ # Unknown webhook signature public key
26
+ UNKNOWN_WEBHOOK_ENCRYPTION_PUBLIC_KEY = 'unknown_public_key'
27
+ # General webhook encryption error
28
+ WEBHOOK_ENCRYPTION_GENERAL_ERROR = 'encryption_error'
29
+ # Invalid webhook signature public key
30
+ INVALID_WEBHOOK_ENCRYPTION_PUBLIC_KEY = 'invalid_public_key'
31
+ # Invalid webhook signature header
32
+ INVALID_WEBHOOK_ENCRYPTION_HEADER_FORMAT = 'invalid_webhook_header'
33
+ # Unsupported webhook signature algorithm
34
+ UNSUPPORTED_WEBHOOK_ENCRYPTION_ALGORYTHM = 'unsupported_encryption_algorythm'
35
+ # Unknown webhook encryption provider
36
+ UNKNOWN_WEBHOOK_ENCRYPTION_PROVIDER = 'unknown_encryption_provider'
37
+ # Encryption verifier initialization error
38
+ WEBHOOK_ENCRYPTION_VERIFIER_INIT_ERROR = 'verifier_init_failure'
39
+ # Error during content update in encryption verifier
40
+ WEBHOOK_ENCRYPTION_VERIFIER_CONTENT_UPDATE_ERROR = 'content_update_failure'
41
+ # Encryption signature verification failed
42
+ WEBHOOK_ENCRYPTION_SIGNATURE_VERIFICATION_FAILED = 'signature_verification_failure'
43
+ # Invalid webhook content signature
44
+ INVALID_WEBHOOK_ENCRYPTION_CONTENT_SIGNATURE = 'invalid_content_signature'
45
+ # Missing webhook signature algorithm value
46
+ MISSING_WEBHOOK_ENCRYPTION_ALGORYTHM = 'missing_encryption_algorythm'
47
+
48
+ # Checks if the given exception matches the specific error code.
49
+ # @param exception [VRPaymentSdkException] The exception to check
50
+ # @param code [String] The error code to compare against
51
+ def self.is?(exception, code)
52
+ exception.code == code
53
+ end
54
+ end
55
+ end