postfinancecheckout-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.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.md +35 -29
- data/lib/postfinancecheckout-ruby-sdk/api_client.rb +1 -1
- data/lib/postfinancecheckout-ruby-sdk/api_exception_error_codes.rb +60 -0
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_address.rb +43 -5
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_dcc_transaction_sum.rb +302 -0
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_sum.rb +332 -0
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_summary.rb +347 -0
- data/lib/postfinancecheckout-ruby-sdk/models/rendered_terminal_transaction_summary.rb +241 -0
- data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_list_response.rb +253 -0
- data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_search_response.rb +263 -0
- data/lib/postfinancecheckout-ruby-sdk/postfinancecheckout_sdk_exception.rb +2 -33
- data/lib/postfinancecheckout-ruby-sdk/sdk_exception_error_codes.rb +55 -0
- data/lib/postfinancecheckout-ruby-sdk/service/payment_terminal_transaction_summaries_service.rb +372 -0
- data/lib/postfinancecheckout-ruby-sdk/service/webhook_encryption_keys_service.rb +2 -2
- data/lib/postfinancecheckout-ruby-sdk/utils/encryption_util.rb +5 -5
- data/lib/postfinancecheckout-ruby-sdk/version.rb +1 -1
- data/lib/postfinancecheckout-ruby-sdk.rb +12 -1
- metadata +10 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42bd24175357923ed98acf47171d8eba0536e7d72cd3ce04b42490b57788eed2
|
|
4
|
+
data.tar.gz: 9282f8c77cd066075bba5971c7111abbb50e6d9f5d6e14948a66cd9c2bf85e82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25c78ce4431c448f2f02a04342eb0b86cb2dd42c255bc9380046b55fe9346b1f7ee08991f11bb6b19e105166cd31733a25502b48f306e318187de8918b853139
|
|
7
|
+
data.tar.gz: 9f25ec50222c139167f0419f9672a275c4f72ff2bd3c40faa00e3cfa8e0a6584a990544fe8e823e57b24037176973844019f01ba124b85225b49bbf823661421
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
postfinancecheckout-ruby-sdk (6.
|
|
4
|
+
postfinancecheckout-ruby-sdk (6.3.0)
|
|
5
5
|
concurrent-ruby (~> 1.3.5)
|
|
6
6
|
faraday (~> 2.13.1, < 3.0)
|
|
7
7
|
faraday-multipart (~> 1.1.0)
|
|
@@ -16,7 +16,7 @@ GEM
|
|
|
16
16
|
byebug (12.0.0)
|
|
17
17
|
coderay (1.1.3)
|
|
18
18
|
concurrent-ruby (1.3.5)
|
|
19
|
-
date (3.5.
|
|
19
|
+
date (3.5.1)
|
|
20
20
|
faraday (2.13.4)
|
|
21
21
|
faraday-net_http (>= 2.0, < 3.5)
|
|
22
22
|
json
|
|
@@ -26,7 +26,7 @@ GEM
|
|
|
26
26
|
faraday-net_http (3.4.2)
|
|
27
27
|
net-http (~> 0.5)
|
|
28
28
|
jaro_winkler (1.5.6)
|
|
29
|
-
json (2.
|
|
29
|
+
json (2.18.0)
|
|
30
30
|
jwt (2.10.2)
|
|
31
31
|
base64
|
|
32
32
|
logger (1.7.0)
|
|
@@ -46,7 +46,7 @@ GEM
|
|
|
46
46
|
pry-byebug (3.11.0)
|
|
47
47
|
byebug (~> 12.0)
|
|
48
48
|
pry (>= 0.13, < 0.16)
|
|
49
|
-
psych (5.
|
|
49
|
+
psych (5.3.0)
|
|
50
50
|
date
|
|
51
51
|
stringio
|
|
52
52
|
racc (1.8.1)
|
|
@@ -61,7 +61,7 @@ GEM
|
|
|
61
61
|
ruby-progressbar (~> 1.7)
|
|
62
62
|
unicode-display_width (>= 1.4.0, < 1.6)
|
|
63
63
|
ruby-progressbar (1.13.0)
|
|
64
|
-
stringio (3.1.
|
|
64
|
+
stringio (3.1.9)
|
|
65
65
|
test-unit (3.6.9)
|
|
66
66
|
power_assert
|
|
67
67
|
unicode-display_width (1.5.0)
|
data/README.md
CHANGED
|
@@ -1018,6 +1018,26 @@ Web API client: [*link*](https://checkout.postfinance.ch//api/client)<br>
|
|
|
1018
1018
|
<strong>GET</strong> /payment/sales-channels/search
|
|
1019
1019
|
Search payment sales channels.
|
|
1020
1020
|
<br><br>
|
|
1021
|
+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
|
|
1022
|
+
* <code>get_payment_terminals_transaction_summaries</code>
|
|
1023
|
+
<strong>GET</strong> /payment/terminals/transaction-summaries
|
|
1024
|
+
List all summaries
|
|
1025
|
+
<br><br>
|
|
1026
|
+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
|
|
1027
|
+
* <code>get_payment_terminals_transaction_summaries_id</code>
|
|
1028
|
+
<strong>GET</strong> /payment/terminals/transaction-summaries/{id}
|
|
1029
|
+
Retrieve a summary
|
|
1030
|
+
<br><br>
|
|
1031
|
+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
|
|
1032
|
+
* <code>get_payment_terminals_transaction_summaries_id_receipt</code>
|
|
1033
|
+
<strong>GET</strong> /payment/terminals/transaction-summaries/{id}/receipt
|
|
1034
|
+
Retrieve a rendered summary receipt
|
|
1035
|
+
<br><br>
|
|
1036
|
+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
|
|
1037
|
+
* <code>get_payment_terminals_transaction_summaries_search</code>
|
|
1038
|
+
<strong>GET</strong> /payment/terminals/transaction-summaries/search
|
|
1039
|
+
Search summaries
|
|
1040
|
+
<br><br>
|
|
1021
1041
|
- <strong>PaymentTerminalsService</strong><br>
|
|
1022
1042
|
* <code>delete_payment_terminals_id</code>
|
|
1023
1043
|
<strong>DELETE</strong> /payment/terminals/{id}
|
|
@@ -2704,6 +2724,7 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
|
|
|
2704
2724
|
* <strong>PaymentTerminalConfigurationVersion</strong>
|
|
2705
2725
|
* <strong>PaymentTerminalConfigurationVersionState</strong>
|
|
2706
2726
|
* <strong>PaymentTerminalCreate</strong>
|
|
2727
|
+
* <strong>PaymentTerminalDccTransactionSum</strong>
|
|
2707
2728
|
* <strong>PaymentTerminalLocation</strong>
|
|
2708
2729
|
* <strong>PaymentTerminalLocationState</strong>
|
|
2709
2730
|
* <strong>PaymentTerminalLocationVersion</strong>
|
|
@@ -2711,6 +2732,8 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
|
|
|
2711
2732
|
* <strong>PaymentTerminalPreparing</strong>
|
|
2712
2733
|
* <strong>PaymentTerminalReceiptType</strong>
|
|
2713
2734
|
* <strong>PaymentTerminalState</strong>
|
|
2735
|
+
* <strong>PaymentTerminalTransactionSum</strong>
|
|
2736
|
+
* <strong>PaymentTerminalTransactionSummary</strong>
|
|
2714
2737
|
* <strong>PaymentTerminalTransactionSummaryReference</strong>
|
|
2715
2738
|
* <strong>PaymentTerminalType</strong>
|
|
2716
2739
|
* <strong>PaymentTerminalUpdate</strong>
|
|
@@ -2770,6 +2793,7 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
|
|
|
2770
2793
|
* <strong>RenderedDocument</strong>
|
|
2771
2794
|
* <strong>RenderedTerminalReceipt</strong>
|
|
2772
2795
|
* <strong>RenderedTerminalReceiptListResponse</strong>
|
|
2796
|
+
* <strong>RenderedTerminalTransactionSummary</strong>
|
|
2773
2797
|
* <strong>RestAddressFormat</strong>
|
|
2774
2798
|
* <strong>RestAddressFormatField</strong>
|
|
2775
2799
|
* <strong>RestApiBulkOperationResult</strong>
|
|
@@ -2895,6 +2919,8 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
|
|
|
2895
2919
|
* <strong>TerminalListResponse</strong>
|
|
2896
2920
|
* <strong>TerminalReceiptFormat</strong>
|
|
2897
2921
|
* <strong>TerminalSearchResponse</strong>
|
|
2922
|
+
* <strong>TerminalTransactionSummaryListResponse</strong>
|
|
2923
|
+
* <strong>TerminalTransactionSummarySearchResponse</strong>
|
|
2898
2924
|
* <strong>Token</strong>
|
|
2899
2925
|
* <strong>TokenCreate</strong>
|
|
2900
2926
|
* <strong>TokenListResponse</strong>
|
|
@@ -2975,40 +3001,20 @@ When working with webhooks, the `PostfinancecheckoutRubySdk::PostFinanceCheckout
|
|
|
2975
3001
|
|
|
2976
3002
|
### Error Code Categories
|
|
2977
3003
|
|
|
2978
|
-
| **
|
|
2979
|
-
|
|
2980
|
-
| **
|
|
2981
|
-
| **
|
|
2982
|
-
| **2000–2999** | Server-Side Errors | Errors typically caused by incorrect data provided by the server |
|
|
2983
|
-
|
|
2984
|
-
### Error Code Reference
|
|
2985
|
-
|
|
2986
|
-
| **Code** | **Error Name** | **Description** | **Category** |
|
|
2987
|
-
|----------|----------------|-----------------|--------------|
|
|
2988
|
-
| 404 | `UNKNOWN_WEBHOOK_ENCRYPTION_PUBLIC_KEY` | Unknown webhook signature public key | Not Found |
|
|
2989
|
-
| 1000 | `WEBHOOK_ENCRYPTION_GENERAL_ERROR` | General webhook encryption error | Client-Side |
|
|
2990
|
-
| 1001 | `INVALID_WEBHOOK_ENCRYPTION_PUBLIC_KEY` | Invalid webhook signature public key | Client-Side |
|
|
2991
|
-
| 1002 | `INVALID_WEBHOOK_ENCRYPTION_HEADER_FORMAT` | Invalid webhook signature header | Client-Side |
|
|
2992
|
-
| 1003 | `UNSUPPORTED_WEBHOOK_ENCRYPTION_ALGORYTHM` | Unsupported webhook signature algorithm | Client-Side |
|
|
2993
|
-
| 1004 | `UNKNOWN_WEBHOOK_ENCRYPTION_PROVIDER` | Unknown webhook encryption provider | Client-Side |
|
|
2994
|
-
| 1005 | `WEBHOOK_ENCRYPTION_VERIFIER_INIT_ERROR` | Encryption verifier initialization error | Client-Side |
|
|
2995
|
-
| 1006 | `WEBHOOK_ENCRYPTION_VERIFIER_CONTENT_UPDATE_ERROR` | Error during content update in encryption verifier | Client-Side |
|
|
2996
|
-
| 1007 | `WEBHOOK_ENCRYPTION_SIGNATURE_VERIFICATION_FAILED` | Encryption signature verification failed | Client-Side |
|
|
2997
|
-
| 1008 | `INVALID_WEBHOOK_ENCRYPTION_CONTENT_SIGNATURE` | Invalid webhook content signature | Client-Side |
|
|
2998
|
-
| 2000 | `MISSING_WEBHOOK_ENCRYPTION_ALGORYTHM` | Missing webhook signature algorithm value | Server-Side |
|
|
3004
|
+
| **Exception** | **Description** |
|
|
3005
|
+
|----------------------------|---------------------------------------------------------------------------------------|
|
|
3006
|
+
| **ApiExceptionErrorCodes** | Lists the possible HTTP error codes an `ApiException` can generate |
|
|
3007
|
+
| **SdkExceptionErrorCodes** | Lists the possible error codes a `PostFinanceCheckoutSdkException` can generate |
|
|
2999
3008
|
|
|
3000
3009
|
### Usage Example
|
|
3001
3010
|
```ruby
|
|
3002
3011
|
begin
|
|
3003
|
-
#
|
|
3004
|
-
rescue
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
# Handle invalid public key
|
|
3008
|
-
when 1007
|
|
3009
|
-
# Handle signature verification failure
|
|
3012
|
+
# SDK operation
|
|
3013
|
+
rescue PostfinancecheckoutRubySdk::ApiError => ex
|
|
3014
|
+
if PostfinancecheckoutRubySdk::ApiExceptionErrorCodes.is?(ex, PostfinancecheckoutRubySdk::ApiExceptionErrorCodes::CONFLICT)
|
|
3015
|
+
# Conflict error handling
|
|
3010
3016
|
else
|
|
3011
|
-
#
|
|
3017
|
+
# Other error handling
|
|
3012
3018
|
end
|
|
3013
3019
|
end
|
|
3014
3020
|
```
|
|
@@ -118,7 +118,7 @@ module PostfinancecheckoutRubySdk
|
|
|
118
118
|
http_method = http_method.to_sym.downcase
|
|
119
119
|
|
|
120
120
|
default_headers = {
|
|
121
|
-
'x-meta-sdk-version': "6.
|
|
121
|
+
'x-meta-sdk-version': "6.3.0",
|
|
122
122
|
'x-meta-sdk-language': "ruby",
|
|
123
123
|
'x-meta-sdk-provider': "postfinancecheckout",
|
|
124
124
|
'x-meta-sdk-language-version': RUBY_VERSION
|
|
@@ -0,0 +1,60 @@
|
|
|
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 ApiExceptionErrorCodes
|
|
25
|
+
# This class represents possible HTTP error codes which can be sent by the API.
|
|
26
|
+
# This list corresponds to https://checkout.postfinance.ch/en-us/doc/api/web-service#_errors
|
|
27
|
+
|
|
28
|
+
# The request was not accepted often due to missing or invalid parameters
|
|
29
|
+
BAD_REQUEST = 400
|
|
30
|
+
# The necessary authentication credentials are missing or incorrect
|
|
31
|
+
UNAUTHORIZED = 401
|
|
32
|
+
# The application user is missing the required permissions
|
|
33
|
+
FORBIDDEN = 403
|
|
34
|
+
# The requested resource was not found
|
|
35
|
+
NOT_FOUND = 404
|
|
36
|
+
# The requested response format is not supported
|
|
37
|
+
NOT_ACCEPTABLE = 406
|
|
38
|
+
# The request conflicts with another request often because of to optimistic locking
|
|
39
|
+
CONFLICT = 409
|
|
40
|
+
# Too many operations in a bulk request
|
|
41
|
+
PAYLOAD_TOO_LARGE = 413
|
|
42
|
+
# The request provides unsupported or invalid data
|
|
43
|
+
UNSUPPORTED_MEDIA_TYPE = 415
|
|
44
|
+
# The pagination offset exceeds the limit
|
|
45
|
+
RANGE_NOT_SATISFIABLE = 416
|
|
46
|
+
# The request is well-formed but contains semantic errors. Check the response body for details
|
|
47
|
+
UNPROCESSABLE_ENTITY = 422
|
|
48
|
+
# Too many requests hit the API too quickly
|
|
49
|
+
TOO_MANY_REQUESTS = 429
|
|
50
|
+
# An internal error occurred on the server
|
|
51
|
+
INTERNAL_SERVER_ERROR = 500
|
|
52
|
+
|
|
53
|
+
# Checks if the given exception matches the specific error code.
|
|
54
|
+
# @param exception [ApiException] The exception to check
|
|
55
|
+
# @param code [Integer] The error code to compare against
|
|
56
|
+
def self.is?(exception, code)
|
|
57
|
+
exception.code == code
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -205,12 +205,20 @@ module PostfinancecheckoutRubySdk
|
|
|
205
205
|
invalid_properties.push('invalid value for "mobile_phone_number", the character length must be smaller than or equal to 100.')
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
+
if !@postcode.nil? && @postcode.to_s.length > 12
|
|
209
|
+
invalid_properties.push('invalid value for "postcode", the character length must be smaller than or equal to 12.')
|
|
210
|
+
end
|
|
211
|
+
|
|
208
212
|
if !@dependent_locality.nil? && @dependent_locality.to_s.length > 100
|
|
209
213
|
invalid_properties.push('invalid value for "dependent_locality", the character length must be smaller than or equal to 100.')
|
|
210
214
|
end
|
|
211
215
|
|
|
212
|
-
if !@email_address.nil? && @email_address.to_s.length >
|
|
213
|
-
invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to
|
|
216
|
+
if !@email_address.nil? && @email_address.to_s.length > 80
|
|
217
|
+
invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to 80.')
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if !@phone_number.nil? && @phone_number.to_s.length > 20
|
|
221
|
+
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 20.')
|
|
214
222
|
end
|
|
215
223
|
|
|
216
224
|
if !@sorting_code.nil? && @sorting_code.to_s.length > 100
|
|
@@ -229,8 +237,10 @@ module PostfinancecheckoutRubySdk
|
|
|
229
237
|
def valid?
|
|
230
238
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
231
239
|
return false if !@mobile_phone_number.nil? && @mobile_phone_number.to_s.length > 100
|
|
240
|
+
return false if !@postcode.nil? && @postcode.to_s.length > 12
|
|
232
241
|
return false if !@dependent_locality.nil? && @dependent_locality.to_s.length > 100
|
|
233
|
-
return false if !@email_address.nil? && @email_address.to_s.length >
|
|
242
|
+
return false if !@email_address.nil? && @email_address.to_s.length > 80
|
|
243
|
+
return false if !@phone_number.nil? && @phone_number.to_s.length > 20
|
|
234
244
|
return false if !@sorting_code.nil? && @sorting_code.to_s.length > 100
|
|
235
245
|
return false if !@salutation.nil? && @salutation.to_s.length > 20
|
|
236
246
|
true
|
|
@@ -250,6 +260,20 @@ module PostfinancecheckoutRubySdk
|
|
|
250
260
|
@mobile_phone_number = mobile_phone_number
|
|
251
261
|
end
|
|
252
262
|
|
|
263
|
+
# Custom attribute writer method with validation
|
|
264
|
+
# @param [Object] postcode Value to be assigned
|
|
265
|
+
def postcode=(postcode)
|
|
266
|
+
if postcode.nil?
|
|
267
|
+
fail ArgumentError, 'postcode cannot be nil'
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
if postcode.to_s.length > 12
|
|
271
|
+
fail ArgumentError, 'invalid value for "postcode", the character length must be smaller than or equal to 12.'
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
@postcode = postcode
|
|
275
|
+
end
|
|
276
|
+
|
|
253
277
|
# Custom attribute writer method with validation
|
|
254
278
|
# @param [Object] dependent_locality Value to be assigned
|
|
255
279
|
def dependent_locality=(dependent_locality)
|
|
@@ -271,13 +295,27 @@ module PostfinancecheckoutRubySdk
|
|
|
271
295
|
fail ArgumentError, 'email_address cannot be nil'
|
|
272
296
|
end
|
|
273
297
|
|
|
274
|
-
if email_address.to_s.length >
|
|
275
|
-
fail ArgumentError, 'invalid value for "email_address", the character length must be smaller than or equal to
|
|
298
|
+
if email_address.to_s.length > 80
|
|
299
|
+
fail ArgumentError, 'invalid value for "email_address", the character length must be smaller than or equal to 80.'
|
|
276
300
|
end
|
|
277
301
|
|
|
278
302
|
@email_address = email_address
|
|
279
303
|
end
|
|
280
304
|
|
|
305
|
+
# Custom attribute writer method with validation
|
|
306
|
+
# @param [Object] phone_number Value to be assigned
|
|
307
|
+
def phone_number=(phone_number)
|
|
308
|
+
if phone_number.nil?
|
|
309
|
+
fail ArgumentError, 'phone_number cannot be nil'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if phone_number.to_s.length > 20
|
|
313
|
+
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 20.'
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
@phone_number = phone_number
|
|
317
|
+
end
|
|
318
|
+
|
|
281
319
|
# Custom attribute writer method with validation
|
|
282
320
|
# @param [Object] sorting_code Value to be assigned
|
|
283
321
|
def sorting_code=(sorting_code)
|
|
@@ -0,0 +1,302 @@
|
|
|
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
|
+
# Represents the aggregated summary of Dynamic Currency Conversion (DCC) transactions grouped by brand and currency combinations in a transaction summary receipt.
|
|
28
|
+
class PaymentTerminalDccTransactionSum
|
|
29
|
+
# The original currency of the transactions before DCC conversion (typically the merchant's local currency).
|
|
30
|
+
attr_accessor :transaction_currency
|
|
31
|
+
|
|
32
|
+
# The total sum of all transactions in the original transaction currency (the amount in merchant's local currency before DCC conversion).
|
|
33
|
+
attr_accessor :transaction_amount
|
|
34
|
+
|
|
35
|
+
# The total sum of all transactions in the converted DCC currency (the amount paid by customers in their chosen currency).
|
|
36
|
+
attr_accessor :dcc_amount
|
|
37
|
+
|
|
38
|
+
# A unique identifier for the object.
|
|
39
|
+
attr_accessor :id
|
|
40
|
+
|
|
41
|
+
# The total count of DCC transactions processed for this specific brand and currency combination.
|
|
42
|
+
attr_accessor :transaction_count
|
|
43
|
+
|
|
44
|
+
# The converted currency used in DCC transactions (the currency chosen by the customer for payment).
|
|
45
|
+
attr_accessor :dcc_currency
|
|
46
|
+
|
|
47
|
+
# The payment brand for which these DCC transactions are summarized.
|
|
48
|
+
attr_accessor :brand
|
|
49
|
+
|
|
50
|
+
# The version is used for optimistic locking and incremented whenever the object is updated.
|
|
51
|
+
attr_accessor :version
|
|
52
|
+
|
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
54
|
+
def self.attribute_map
|
|
55
|
+
{
|
|
56
|
+
:'transaction_currency' => :'transactionCurrency',
|
|
57
|
+
:'transaction_amount' => :'transactionAmount',
|
|
58
|
+
:'dcc_amount' => :'dccAmount',
|
|
59
|
+
:'id' => :'id',
|
|
60
|
+
:'transaction_count' => :'transactionCount',
|
|
61
|
+
:'dcc_currency' => :'dccCurrency',
|
|
62
|
+
:'brand' => :'brand',
|
|
63
|
+
:'version' => :'version'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Returns attribute mapping this model knows about
|
|
68
|
+
def self.acceptable_attribute_map
|
|
69
|
+
attribute_map
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns all the JSON keys this model knows about
|
|
73
|
+
def self.acceptable_attributes
|
|
74
|
+
acceptable_attribute_map.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Attribute type mapping.
|
|
78
|
+
def self.openapi_types
|
|
79
|
+
{
|
|
80
|
+
:'transaction_currency' => :'String',
|
|
81
|
+
:'transaction_amount' => :'Float',
|
|
82
|
+
:'dcc_amount' => :'Float',
|
|
83
|
+
:'id' => :'Integer',
|
|
84
|
+
:'transaction_count' => :'Integer',
|
|
85
|
+
:'dcc_currency' => :'String',
|
|
86
|
+
:'brand' => :'String',
|
|
87
|
+
:'version' => :'Integer'
|
|
88
|
+
}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# List of attributes with nullable: true
|
|
92
|
+
def self.openapi_nullable
|
|
93
|
+
Set.new([
|
|
94
|
+
])
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Initializes the object
|
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
|
+
def initialize(attributes = {})
|
|
100
|
+
if (!attributes.is_a?(Hash))
|
|
101
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::PaymentTerminalDccTransactionSum` initialize method"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
105
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
106
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
107
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
108
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::PaymentTerminalDccTransactionSum`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
109
|
+
end
|
|
110
|
+
h[k.to_sym] = v
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'transaction_currency')
|
|
114
|
+
self.transaction_currency = attributes[:'transaction_currency']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'transaction_amount')
|
|
118
|
+
self.transaction_amount = attributes[:'transaction_amount']
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'dcc_amount')
|
|
122
|
+
self.dcc_amount = attributes[:'dcc_amount']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'id')
|
|
126
|
+
self.id = attributes[:'id']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'transaction_count')
|
|
130
|
+
self.transaction_count = attributes[:'transaction_count']
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'dcc_currency')
|
|
134
|
+
self.dcc_currency = attributes[:'dcc_currency']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'brand')
|
|
138
|
+
self.brand = attributes[:'brand']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'version')
|
|
142
|
+
self.version = attributes[:'version']
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
147
|
+
# @return Array for valid properties with the reasons
|
|
148
|
+
def list_invalid_properties
|
|
149
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
150
|
+
invalid_properties = Array.new
|
|
151
|
+
invalid_properties
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Check to see if the all the properties in the model are valid
|
|
155
|
+
# @return true if the model is valid
|
|
156
|
+
def valid?
|
|
157
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
158
|
+
true
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Checks equality by comparing each attribute.
|
|
162
|
+
# @param [Object] Object to be compared
|
|
163
|
+
def ==(o)
|
|
164
|
+
return true if self.equal?(o)
|
|
165
|
+
self.class == o.class &&
|
|
166
|
+
transaction_currency == o.transaction_currency &&
|
|
167
|
+
transaction_amount == o.transaction_amount &&
|
|
168
|
+
dcc_amount == o.dcc_amount &&
|
|
169
|
+
id == o.id &&
|
|
170
|
+
transaction_count == o.transaction_count &&
|
|
171
|
+
dcc_currency == o.dcc_currency &&
|
|
172
|
+
brand == o.brand &&
|
|
173
|
+
version == o.version
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# @see the `==` method
|
|
177
|
+
# @param [Object] Object to be compared
|
|
178
|
+
def eql?(o)
|
|
179
|
+
self == o
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Calculates hash code according to all attributes.
|
|
183
|
+
# @return [Integer] Hash code
|
|
184
|
+
def hash
|
|
185
|
+
[transaction_currency, transaction_amount, dcc_amount, id, transaction_count, dcc_currency, brand, version].hash
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Builds the object from hash
|
|
189
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
190
|
+
# @return [Object] Returns the model itself
|
|
191
|
+
def self.build_from_hash(attributes)
|
|
192
|
+
return nil unless attributes.is_a?(Hash)
|
|
193
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
194
|
+
transformed_hash = {}
|
|
195
|
+
openapi_types.each_pair do |key, type|
|
|
196
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
197
|
+
transformed_hash["#{key}"] = nil
|
|
198
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
199
|
+
# check to ensure the input is an array given that the attribute
|
|
200
|
+
# is documented as an array but the input is not
|
|
201
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
202
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
203
|
+
end
|
|
204
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
205
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
new(transformed_hash)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Deserializes the data based on type
|
|
212
|
+
# @param string type Data type
|
|
213
|
+
# @param string value Value to be deserialized
|
|
214
|
+
# @return [Object] Deserialized data
|
|
215
|
+
def self._deserialize(type, value)
|
|
216
|
+
case type.to_sym
|
|
217
|
+
when :Time
|
|
218
|
+
Time.parse(value)
|
|
219
|
+
when :Date
|
|
220
|
+
Date.parse(value)
|
|
221
|
+
when :String
|
|
222
|
+
value.to_s
|
|
223
|
+
when :Integer
|
|
224
|
+
value.to_i
|
|
225
|
+
when :Float
|
|
226
|
+
value.to_f
|
|
227
|
+
when :Boolean
|
|
228
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
229
|
+
true
|
|
230
|
+
else
|
|
231
|
+
false
|
|
232
|
+
end
|
|
233
|
+
when :Object
|
|
234
|
+
# generic object (usually a Hash), return directly
|
|
235
|
+
value
|
|
236
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
237
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
238
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
239
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
240
|
+
k_type = Regexp.last_match[:k_type]
|
|
241
|
+
v_type = Regexp.last_match[:v_type]
|
|
242
|
+
{}.tap do |hash|
|
|
243
|
+
value.each do |k, v|
|
|
244
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
else # model
|
|
248
|
+
# models (e.g. Pet) or oneOf
|
|
249
|
+
klass = PostfinancecheckoutRubySdk.const_get(type)
|
|
250
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Returns the string representation of the object
|
|
255
|
+
# @return [String] String presentation of the object
|
|
256
|
+
def to_s
|
|
257
|
+
to_hash.to_s
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
|
262
|
+
def to_body
|
|
263
|
+
to_hash
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
if value.nil?
|
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
hash[param] = _to_hash(value)
|
|
278
|
+
end
|
|
279
|
+
hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Outputs non-array value in the form of hash
|
|
283
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
284
|
+
# @param [Object] value Any valid value
|
|
285
|
+
# @return [Hash] Returns the value in the form of hash
|
|
286
|
+
def _to_hash(value)
|
|
287
|
+
if value.is_a?(Array)
|
|
288
|
+
value.compact.map { |v| _to_hash(v) }
|
|
289
|
+
elsif value.is_a?(Hash)
|
|
290
|
+
{}.tap do |hash|
|
|
291
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
292
|
+
end
|
|
293
|
+
elsif value.respond_to? :to_hash
|
|
294
|
+
value.to_hash
|
|
295
|
+
else
|
|
296
|
+
value
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
end
|