postfinancecheckout-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 (42) 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/postfinancecheckout-ruby-sdk/api_client.rb +1 -1
  6. data/lib/postfinancecheckout-ruby-sdk/api_exception_error_codes.rb +60 -0
  7. data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_approval_request.rb +230 -0
  8. data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_payment_data.rb +241 -0
  9. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_approval_response.rb +270 -0
  10. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_create_response.rb +13 -4
  11. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session.rb +39 -1
  12. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session_create.rb +21 -1
  13. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_request.rb +239 -0
  14. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_response.rb +241 -0
  15. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_request.rb +231 -0
  16. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_response.rb +241 -0
  17. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_option.rb +1 -1
  18. data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_address.rb +43 -5
  19. data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_dcc_transaction_sum.rb +302 -0
  20. data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_sum.rb +332 -0
  21. data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_summary.rb +347 -0
  22. data/lib/postfinancecheckout-ruby-sdk/models/refund.rb +13 -1
  23. data/lib/postfinancecheckout-ruby-sdk/models/refund_create.rb +13 -1
  24. data/lib/postfinancecheckout-ruby-sdk/models/rendered_terminal_transaction_summary.rb +241 -0
  25. data/lib/postfinancecheckout-ruby-sdk/models/scope.rb +15 -15
  26. data/lib/postfinancecheckout-ruby-sdk/models/subscription_update_request.rb +45 -22
  27. data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_list_response.rb +253 -0
  28. data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_search_response.rb +263 -0
  29. data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion.rb +13 -1
  30. data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion_details.rb +26 -4
  31. data/lib/postfinancecheckout-ruby-sdk/models/transaction_user_interface_type.rb +2 -1
  32. data/lib/postfinancecheckout-ruby-sdk/postfinancecheckout_sdk_exception.rb +2 -33
  33. data/lib/postfinancecheckout-ruby-sdk/sdk_exception_error_codes.rb +55 -0
  34. data/lib/postfinancecheckout-ruby-sdk/service/bogus_express_checkout_service.rb +114 -0
  35. data/lib/postfinancecheckout-ruby-sdk/service/express_checkout_service.rb +162 -0
  36. data/lib/postfinancecheckout-ruby-sdk/service/payment_terminal_transaction_summaries_service.rb +372 -0
  37. data/lib/postfinancecheckout-ruby-sdk/service/webhook_encryption_keys_service.rb +2 -2
  38. data/lib/postfinancecheckout-ruby-sdk/utils/encryption_util.rb +5 -5
  39. data/lib/postfinancecheckout-ruby-sdk/version.rb +1 -1
  40. data/lib/postfinancecheckout-ruby-sdk.rb +20 -1
  41. data/test/test_querying.rb +11 -0
  42. metadata +19 -2
@@ -0,0 +1,263 @@
1
+ =begin
2
+ # PostFinance Ruby SDK
3
+ #
4
+ # This library allows to interact with the PostFinance payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.postfinance.ch/en/private.html
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 PostfinancecheckoutRubySdk
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 `PostfinancecheckoutRubySdk::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 `PostfinancecheckoutRubySdk::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 = PostfinancecheckoutRubySdk.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
@@ -53,6 +53,9 @@ module PostfinancecheckoutRubySdk
53
53
 
54
54
  attr_accessor :mode
55
55
 
56
+ # Allow to store additional information about the object.
57
+ attr_accessor :meta_data
58
+
56
59
  # The date and time when the transaction completion succeeded.
57
60
  attr_accessor :succeeded_on
58
61
 
@@ -149,6 +152,7 @@ module PostfinancecheckoutRubySdk
149
152
  :'created_on' => :'createdOn',
150
153
  :'line_items' => :'lineItems',
151
154
  :'mode' => :'mode',
155
+ :'meta_data' => :'metaData',
152
156
  :'succeeded_on' => :'succeededOn',
153
157
  :'id' => :'id',
154
158
  :'state' => :'state',
@@ -196,6 +200,7 @@ module PostfinancecheckoutRubySdk
196
200
  :'created_on' => :'Time',
197
201
  :'line_items' => :'Array<LineItem>',
198
202
  :'mode' => :'TransactionCompletionMode',
203
+ :'meta_data' => :'Hash<String, String>',
199
204
  :'succeeded_on' => :'Time',
200
205
  :'id' => :'Integer',
201
206
  :'state' => :'TransactionCompletionState',
@@ -288,6 +293,12 @@ module PostfinancecheckoutRubySdk
288
293
  self.mode = attributes[:'mode']
289
294
  end
290
295
 
296
+ if attributes.key?(:'meta_data')
297
+ if (value = attributes[:'meta_data']).is_a?(Hash)
298
+ self.meta_data = value
299
+ end
300
+ end
301
+
291
302
  if attributes.key?(:'succeeded_on')
292
303
  self.succeeded_on = attributes[:'succeeded_on']
293
304
  end
@@ -514,6 +525,7 @@ module PostfinancecheckoutRubySdk
514
525
  created_on == o.created_on &&
515
526
  line_items == o.line_items &&
516
527
  mode == o.mode &&
528
+ meta_data == o.meta_data &&
517
529
  succeeded_on == o.succeeded_on &&
518
530
  id == o.id &&
519
531
  state == o.state &&
@@ -546,7 +558,7 @@ module PostfinancecheckoutRubySdk
546
558
  # Calculates hash code according to all attributes.
547
559
  # @return [Integer] Hash code
548
560
  def hash
549
- [line_item_version, statement_descriptor, base_line_items, processing_on, invoice_merchant_reference, language, remaining_line_items, created_on, line_items, mode, succeeded_on, id, state, linked_transaction, payment_information, amount, last_completion, planned_purge_date, external_id, time_zone, space_view_id, version, labels, linked_space_id, timeout_on, created_by, next_update_on, failure_reason, tax_amount, failed_on, processor_reference].hash
561
+ [line_item_version, statement_descriptor, base_line_items, processing_on, invoice_merchant_reference, language, remaining_line_items, created_on, line_items, mode, meta_data, succeeded_on, id, state, linked_transaction, payment_information, amount, last_completion, planned_purge_date, external_id, time_zone, space_view_id, version, labels, linked_space_id, timeout_on, created_by, next_update_on, failure_reason, tax_amount, failed_on, processor_reference].hash
550
562
  end
551
563
 
552
564
  # Builds the object from hash
@@ -28,6 +28,9 @@ module PostfinancecheckoutRubySdk
28
28
  # The line items to be captured in the transaction completion.
29
29
  attr_accessor :line_items
30
30
 
31
+ # Allow to store additional information about the object.
32
+ attr_accessor :meta_data
33
+
31
34
  # Whether this is the final completion for the transaction, meaning no further completions can occur, and the transaction will move to its completed state upon success.
32
35
  attr_accessor :last_completion
33
36
 
@@ -40,14 +43,19 @@ module PostfinancecheckoutRubySdk
40
43
  # The merchant's reference used to identify the invoice.
41
44
  attr_accessor :invoice_merchant_reference
42
45
 
46
+ # A unique identifier for the object.
47
+ attr_accessor :id
48
+
43
49
  # Attribute mapping from ruby-style variable name to JSON key.
44
50
  def self.attribute_map
45
51
  {
46
52
  :'line_items' => :'lineItems',
53
+ :'meta_data' => :'metaData',
47
54
  :'last_completion' => :'lastCompletion',
48
55
  :'statement_descriptor' => :'statementDescriptor',
49
56
  :'external_id' => :'externalId',
50
- :'invoice_merchant_reference' => :'invoiceMerchantReference'
57
+ :'invoice_merchant_reference' => :'invoiceMerchantReference',
58
+ :'id' => :'id'
51
59
  }
52
60
  end
53
61
 
@@ -65,10 +73,12 @@ module PostfinancecheckoutRubySdk
65
73
  def self.openapi_types
66
74
  {
67
75
  :'line_items' => :'Array<CompletionLineItemCreate>',
76
+ :'meta_data' => :'Hash<String, String>',
68
77
  :'last_completion' => :'Boolean',
69
78
  :'statement_descriptor' => :'String',
70
79
  :'external_id' => :'String',
71
- :'invoice_merchant_reference' => :'String'
80
+ :'invoice_merchant_reference' => :'String',
81
+ :'id' => :'Integer'
72
82
  }
73
83
  end
74
84
 
@@ -100,6 +110,12 @@ module PostfinancecheckoutRubySdk
100
110
  end
101
111
  end
102
112
 
113
+ if attributes.key?(:'meta_data')
114
+ if (value = attributes[:'meta_data']).is_a?(Hash)
115
+ self.meta_data = value
116
+ end
117
+ end
118
+
103
119
  if attributes.key?(:'last_completion')
104
120
  self.last_completion = attributes[:'last_completion']
105
121
  end
@@ -115,6 +131,10 @@ module PostfinancecheckoutRubySdk
115
131
  if attributes.key?(:'invoice_merchant_reference')
116
132
  self.invoice_merchant_reference = attributes[:'invoice_merchant_reference']
117
133
  end
134
+
135
+ if attributes.key?(:'id')
136
+ self.id = attributes[:'id']
137
+ end
118
138
  end
119
139
 
120
140
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -237,10 +257,12 @@ module PostfinancecheckoutRubySdk
237
257
  return true if self.equal?(o)
238
258
  self.class == o.class &&
239
259
  line_items == o.line_items &&
260
+ meta_data == o.meta_data &&
240
261
  last_completion == o.last_completion &&
241
262
  statement_descriptor == o.statement_descriptor &&
242
263
  external_id == o.external_id &&
243
- invoice_merchant_reference == o.invoice_merchant_reference
264
+ invoice_merchant_reference == o.invoice_merchant_reference &&
265
+ id == o.id
244
266
  end
245
267
 
246
268
  # @see the `==` method
@@ -252,7 +274,7 @@ module PostfinancecheckoutRubySdk
252
274
  # Calculates hash code according to all attributes.
253
275
  # @return [Integer] Hash code
254
276
  def hash
255
- [line_items, last_completion, statement_descriptor, external_id, invoice_merchant_reference].hash
277
+ [line_items, meta_data, last_completion, statement_descriptor, external_id, invoice_merchant_reference, id].hash
256
278
  end
257
279
 
258
280
  # Builds the object from hash
@@ -30,10 +30,11 @@ module PostfinancecheckoutRubySdk
30
30
  PAYMENT_PAGE = "PAYMENT_PAGE".freeze
31
31
  MOBILE_SDK = "MOBILE_SDK".freeze
32
32
  TERMINAL = "TERMINAL".freeze
33
+ CLOUD_TILL_INTERFACE = "CLOUD_TILL_INTERFACE".freeze
33
34
  EXPRESS_CHECKOUT = "EXPRESS_CHECKOUT".freeze
34
35
 
35
36
  def self.all_vars
36
- @all_vars ||= [IFRAME, LIGHTBOX, PAYMENT_PAGE, MOBILE_SDK, TERMINAL, EXPRESS_CHECKOUT].freeze
37
+ @all_vars ||= [IFRAME, LIGHTBOX, PAYMENT_PAGE, MOBILE_SDK, TERMINAL, CLOUD_TILL_INTERFACE, EXPRESS_CHECKOUT].freeze
37
38
  end
38
39
 
39
40
  # Builds the enum from string
@@ -20,42 +20,11 @@
20
20
  # limitations under the License.
21
21
  =end
22
22
 
23
- # The `ErrorCode` module defines potential error codes that may be raised by the PostFinanceCheckout SDK.
24
- #
25
- # ## Error Code Ranges:
26
- # - **1000–1999**: Client-side errors – typically due to invalid input (e.g., malformed headers, bad keys).
27
- # - **2000–2999**: Server-side errors – typically due to incorrect data provided by the server.
28
- # - **404**: Not Found – used when an endpoint returns an empty response.
29
- #
30
- module ErrorCode
31
- # 404
32
- UNKNOWN_WEBHOOK_ENCRYPTION_PUBLIC_KEY = { code: 404, description: "Unknown webhook signature public key" }
33
-
34
- # 1000–1999
35
- WEBHOOK_ENCRYPTION_GENERAL_ERROR = { code: 1000, description: "General webhook encryption error" }
36
- INVALID_WEBHOOK_ENCRYPTION_PUBLIC_KEY = { code: 1001, description: "Invalid webhook signature public key" }
37
- INVALID_WEBHOOK_ENCRYPTION_HEADER_FORMAT = { code: 1002, description: "Invalid webhook signature header" }
38
- UNSUPPORTED_WEBHOOK_ENCRYPTION_ALGORYTHM = { code: 1003, description: "Unsupported webhook signature algorithm" }
39
- UNKNOWN_WEBHOOK_ENCRYPTION_PROVIDER = { code: 1004, description: "Unknown webhook encryption provider" }
40
- WEBHOOK_ENCRYPTION_VERIFIER_INIT_ERROR = { code: 1005, description: "Encryption verifier initialization error" }
41
- WEBHOOK_ENCRYPTION_VERIFIER_CONTENT_UPDATE_ERROR = { code: 1006, description: "Error during content update in encryption verifier" }
42
- WEBHOOK_ENCRYPTION_SIGNATURE_VERIFICATION_FAILED = { code: 1007, description: "Encryption signature verification failed" }
43
- INVALID_WEBHOOK_ENCRYPTION_CONTENT_SIGNATURE = { code: 1008, description: "Invalid webhook content signature" }
44
-
45
- # 2000–2999
46
- MISSING_WEBHOOK_ENCRYPTION_ALGORYTHM = { code: 2000, description: "Missing webhook signature algorithm value" }
47
-
48
- def self.to_s(error)
49
- "#{error[:code]}: #{error[:description]}"
50
- end
51
- end
52
-
53
23
  class PostFinanceCheckoutSdkException < StandardError
54
24
  attr_reader :code
55
25
 
56
26
  def initialize(code, message)
57
27
  @code = code
58
- full_message = "Error code: #{code[:code]}. #{message}"
59
- super(full_message)
28
+ super("Error code: #{code}. #{message}")
60
29
  end
61
- end
30
+ end
@@ -0,0 +1,55 @@
1
+ =begin
2
+ # PostFinance Ruby SDK
3
+ #
4
+ # This library allows to interact with the PostFinance payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.postfinance.ch/en/private.html
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 PostfinancecheckoutRubySdk
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 [PostFinanceCheckoutSdkException] 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
@@ -0,0 +1,114 @@
1
+ =begin
2
+ # PostFinance Ruby SDK
3
+ #
4
+ # This library allows to interact with the PostFinance payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.postfinance.ch/en/private.html
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 'cgi'
24
+
25
+ module PostfinancecheckoutRubySdk
26
+ class BogusExpressCheckoutService
27
+ attr_accessor :api_client
28
+
29
+
30
+ def initialize(api_client = ApiClient.default)
31
+ @api_client = api_client
32
+ end
33
+ # Approve express checkout wallet payment
34
+ # @param session_token [String]
35
+ # @param space [Integer] Specifies the ID of the space the operation should be executed in.
36
+ # @param bogus_express_checkout_approval_request [BogusExpressCheckoutApprovalRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [ExpressCheckoutApprovalResponse]
39
+ def post_bogus_express_checkout_on_approve(session_token, space, bogus_express_checkout_approval_request, opts = {})
40
+ data, _status_code, _headers = post_bogus_express_checkout_on_approve_with_http_info(session_token, space, bogus_express_checkout_approval_request, opts)
41
+ data
42
+ end
43
+
44
+ # Approve express checkout wallet payment
45
+
46
+ # @param session_token [String]
47
+ # @param space [Integer] Specifies the ID of the space the operation should be executed in.
48
+ # @param bogus_express_checkout_approval_request [BogusExpressCheckoutApprovalRequest]
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [Array<(ExpressCheckoutApprovalResponse, Integer, Hash)>] ExpressCheckoutApprovalResponse data, response status code and response headers
51
+ def post_bogus_express_checkout_on_approve_with_http_info(session_token, space, bogus_express_checkout_approval_request, opts = {})
52
+ if @api_client.config.debugging
53
+ @api_client.config.logger.debug 'Calling API: BogusExpressCheckoutService.post_bogus_express_checkout_on_approve ...'
54
+ end
55
+ # verify the required parameter 'session_token' is set
56
+ if @api_client.config.client_side_validation && session_token.nil?
57
+ fail ArgumentError, "Missing the required parameter 'session_token' when calling BogusExpressCheckoutService.post_bogus_express_checkout_on_approve"
58
+ end
59
+ # verify the required parameter 'space' is set
60
+ if @api_client.config.client_side_validation && space.nil?
61
+ fail ArgumentError, "Missing the required parameter 'space' when calling BogusExpressCheckoutService.post_bogus_express_checkout_on_approve"
62
+ end
63
+ # verify the required parameter 'bogus_express_checkout_approval_request' is set
64
+ if @api_client.config.client_side_validation && bogus_express_checkout_approval_request.nil?
65
+ fail ArgumentError, "Missing the required parameter 'bogus_express_checkout_approval_request' when calling BogusExpressCheckoutService.post_bogus_express_checkout_on_approve"
66
+ end
67
+ # resource path
68
+ local_var_path = '/bogus-express-checkout/on-approve'
69
+
70
+ # query parameters
71
+ query_params = opts[:query_params] || {}
72
+ query_params[:'sessionToken'] = session_token
73
+
74
+ # header parameters
75
+ header_params = opts[:header_params] || {}
76
+ # HTTP header 'Accept' (if needed)
77
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
78
+ # HTTP header 'Content-Type'
79
+ content_type = @api_client.select_header_content_type(['application/json'])
80
+ if !content_type.nil?
81
+ header_params['Content-Type'] = content_type
82
+ end
83
+ header_params[:'Space'] = space
84
+
85
+ # form parameters
86
+ form_params = opts[:form_params] || {}
87
+
88
+ # connection timeout
89
+ connection_timeout = @api_client.config.timeout
90
+
91
+ # http body (model)
92
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(bogus_express_checkout_approval_request)
93
+
94
+ # return_type
95
+ return_type = opts[:debug_return_type] || 'ExpressCheckoutApprovalResponse'
96
+
97
+ new_options = opts.merge(
98
+ :operation => :"BogusExpressCheckoutService.post_bogus_express_checkout_on_approve",
99
+ :header_params => header_params,
100
+ :query_params => query_params,
101
+ :form_params => form_params,
102
+ :body => post_body,
103
+ :return_type => return_type
104
+ )
105
+
106
+ data, status_code, headers = @api_client.call_api(:POST.to_sym.downcase, local_var_path, new_options, connection_timeout)
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug "API called: BogusExpressCheckoutService#post_bogus_express_checkout_on_approve\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
109
+ end
110
+ return data, status_code, headers
111
+ end
112
+
113
+ end
114
+ end