Skip to content

Commit f94de15

Browse files
Release 6.3.0
1 parent c825154 commit f94de15

22 files changed

+2249
-125
lines changed

README.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,26 @@ Web Api client: [*link*](https://checkout.postfinance.ch//api/client)<br>
10381038
&nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/sales-channels/search
10391039
&nbsp;&nbsp;&nbsp;&nbsp;Search payment sales channels.
10401040
<br><br>
1041+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
1042+
&nbsp;&nbsp;* <code>get_payment_terminals_transaction_summaries</code>
1043+
&nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/terminals/transaction-summaries
1044+
&nbsp;&nbsp;&nbsp;&nbsp;List all summaries
1045+
<br><br>
1046+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
1047+
&nbsp;&nbsp;* <code>get_payment_terminals_transaction_summaries_id</code>
1048+
&nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/terminals/transaction-summaries/{id}
1049+
&nbsp;&nbsp;&nbsp;&nbsp;Retrieve a summary
1050+
<br><br>
1051+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
1052+
&nbsp;&nbsp;* <code>get_payment_terminals_transaction_summaries_id_receipt</code>
1053+
&nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/terminals/transaction-summaries/{id}/receipt
1054+
&nbsp;&nbsp;&nbsp;&nbsp;Retrieve a rendered summary receipt
1055+
<br><br>
1056+
- <strong>PaymentTerminalTransactionSummariesService</strong><br>
1057+
&nbsp;&nbsp;* <code>get_payment_terminals_transaction_summaries_search</code>
1058+
&nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/terminals/transaction-summaries/search
1059+
&nbsp;&nbsp;&nbsp;&nbsp;Search summaries
1060+
<br><br>
10411061
- <strong>PaymentTerminalsService</strong><br>
10421062
&nbsp;&nbsp;* <code>delete_payment_terminals_id</code>
10431063
&nbsp;&nbsp;&nbsp;&nbsp;<strong>DELETE</strong> /payment/terminals/{id}
@@ -2725,13 +2745,16 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
27252745
* <strong>PaymentTerminalConfigurationVersion</strong>
27262746
* <strong>PaymentTerminalConfigurationVersionState</strong>
27272747
* <strong>PaymentTerminalCreate</strong>
2748+
* <strong>PaymentTerminalDccTransactionSum</strong>
27282749
* <strong>PaymentTerminalLocation</strong>
27292750
* <strong>PaymentTerminalLocationState</strong>
27302751
* <strong>PaymentTerminalLocationVersion</strong>
27312752
* <strong>PaymentTerminalLocationVersionState</strong>
27322753
* <strong>PaymentTerminalPreparing</strong>
27332754
* <strong>PaymentTerminalReceiptType</strong>
27342755
* <strong>PaymentTerminalState</strong>
2756+
* <strong>PaymentTerminalTransactionSum</strong>
2757+
* <strong>PaymentTerminalTransactionSummary</strong>
27352758
* <strong>PaymentTerminalTransactionSummaryReference</strong>
27362759
* <strong>PaymentTerminalType</strong>
27372760
* <strong>PaymentTerminalUpdate</strong>
@@ -2791,6 +2814,7 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
27912814
* <strong>RenderedDocument</strong>
27922815
* <strong>RenderedTerminalReceipt</strong>
27932816
* <strong>RenderedTerminalReceiptListResponse</strong>
2817+
* <strong>RenderedTerminalTransactionSummary</strong>
27942818
* <strong>RestAddressFormat</strong>
27952819
* <strong>RestAddressFormatField</strong>
27962820
* <strong>RestApiBulkOperationResult</strong>
@@ -2916,6 +2940,8 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
29162940
* <strong>TerminalListResponse</strong>
29172941
* <strong>TerminalReceiptFormat</strong>
29182942
* <strong>TerminalSearchResponse</strong>
2943+
* <strong>TerminalTransactionSummaryListResponse</strong>
2944+
* <strong>TerminalTransactionSummarySearchResponse</strong>
29192945
* <strong>Token</strong>
29202946
* <strong>TokenCreate</strong>
29212947
* <strong>TokenListResponse</strong>
@@ -2996,44 +3022,20 @@ When working with webhooks, the `PostFinanceCheckoutSdkException` may throw erro
29963022

29973023
### Error Code Categories
29983024

2999-
| **Range** | **Category** | **Description** |
3000-
|-----------|--------------|-----------------|
3001-
| **404** | Not Found | Indicates that the requested resource could not be found or the endpoint returned an empty response |
3002-
| **1000–1999** | Client-Side Errors | Errors typically caused by invalid input |
3003-
| **2000–2999** | Server-Side Errors | Errors typically caused by incorrect data provided by the server |
3004-
3005-
### Error Code Reference
3006-
3007-
| **Code** | **Error Name** | **Description** | **Category** |
3008-
|----------|----------------|-----------------|--------------|
3009-
| 404 | `UNKNOWN_WEBHOOK_ENCRYPTION_PUBLIC_KEY` | Unknown webhook signature public key | Not Found |
3010-
| 1000 | `WEBHOOK_ENCRYPTION_GENERAL_ERROR` | General webhook encryption error | Client-Side |
3011-
| 1001 | `INVALID_WEBHOOK_ENCRYPTION_PUBLIC_KEY` | Invalid webhook signature public key | Client-Side |
3012-
| 1002 | `INVALID_WEBHOOK_ENCRYPTION_HEADER_FORMAT` | Invalid webhook signature header | Client-Side |
3013-
| 1003 | `UNSUPPORTED_WEBHOOK_ENCRYPTION_ALGORYTHM` | Unsupported webhook signature algorithm | Client-Side |
3014-
| 1004 | `UNKNOWN_WEBHOOK_ENCRYPTION_PROVIDER` | Unknown webhook encryption provider | Client-Side |
3015-
| 1005 | `WEBHOOK_ENCRYPTION_VERIFIER_INIT_ERROR` | Encryption verifier initialization error | Client-Side |
3016-
| 1006 | `WEBHOOK_ENCRYPTION_VERIFIER_CONTENT_UPDATE_ERROR` | Error during content update in encryption verifier | Client-Side |
3017-
| 1007 | `WEBHOOK_ENCRYPTION_SIGNATURE_VERIFICATION_FAILED` | Encryption signature verification failed | Client-Side |
3018-
| 1008 | `INVALID_WEBHOOK_ENCRYPTION_CONTENT_SIGNATURE` | Invalid webhook content signature | Client-Side |
3019-
| 2000 | `MISSING_WEBHOOK_ENCRYPTION_ALGORYTHM` | Missing webhook signature algorithm value | Server-Side |
3025+
| **Exception** | **Description** |
3026+
|----------------------------|---------------------------------------------------------------------------------------|
3027+
| **ApiExceptionErrorCodes** | Lists the possible HTTP error codes an `ApiException` can generate |
3028+
| **SdkExceptionErrorCodes** | Lists the possible error codes a `PostFinanceCheckoutSdkException` can generate |
30203029

30213030
### Usage Example
30223031
```python
3023-
from postfinancecheckout.postfinancecheckout_sdk_exception import PostFinanceCheckoutSdkException
3024-
30253032
try:
3026-
# Webhook SDK operation
3027-
except PostFinanceCheckoutSdkException as e:
3028-
if e.code == 1001: # INVALID_WEBHOOK_ENCRYPTION_PUBLIC_KEY
3029-
# Handle invalid public key
3030-
pass
3031-
elif e.code == 1007: # WEBHOOK_ENCRYPTION_SIGNATURE_VERIFICATION_FAILED
3032-
# Handle signature verification failure
3033-
pass
3033+
# SDK operation
3034+
except ApiException as ex:
3035+
if ApiExceptionErrorCodes.CONFLICT.matches(ex):
3036+
# Handle Conflict
30343037
else:
3035-
# Handle other errors
3036-
pass
3038+
# Other handling
30373039
```
30383040

30393041
## Author

postfinancecheckout/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"""
2626

2727

28-
__version__ = "6.2.0"
28+
__version__ = "6.3.0"
2929

3030
# import apis into sdk package
3131
from postfinancecheckout.service.accounts_service import AccountsService
@@ -70,6 +70,7 @@
7070
from postfinancecheckout.service.payment_processor_configurations_service import PaymentProcessorConfigurationsService
7171
from postfinancecheckout.service.payment_processors_service import PaymentProcessorsService
7272
from postfinancecheckout.service.payment_sales_channels_service import PaymentSalesChannelsService
73+
from postfinancecheckout.service.payment_terminal_transaction_summaries_service import PaymentTerminalTransactionSummariesService
7374
from postfinancecheckout.service.payment_terminals_service import PaymentTerminalsService
7475
from postfinancecheckout.service.permissions_service import PermissionsService
7576
from postfinancecheckout.service.refund_bank_transactions_service import RefundBankTransactionsService
@@ -126,6 +127,8 @@
126127
from postfinancecheckout.exceptions import ApiKeyError
127128
from postfinancecheckout.exceptions import ApiAttributeError
128129
from postfinancecheckout.exceptions import ApiException
130+
from postfinancecheckout.api_exception_error_codes import ApiExceptionErrorCodes
131+
from postfinancecheckout.sdk_exception_error_codes import SdkExceptionErrorCodes
129132
from postfinancecheckout.postfinancecheckout_sdk_exception import PostFinanceCheckoutSdkException
130133

131134
# import utils into sdk package
@@ -409,13 +412,16 @@
409412
from postfinancecheckout.models.payment_terminal_configuration_version import PaymentTerminalConfigurationVersion
410413
from postfinancecheckout.models.payment_terminal_configuration_version_state import PaymentTerminalConfigurationVersionState
411414
from postfinancecheckout.models.payment_terminal_create import PaymentTerminalCreate
415+
from postfinancecheckout.models.payment_terminal_dcc_transaction_sum import PaymentTerminalDccTransactionSum
412416
from postfinancecheckout.models.payment_terminal_location import PaymentTerminalLocation
413417
from postfinancecheckout.models.payment_terminal_location_state import PaymentTerminalLocationState
414418
from postfinancecheckout.models.payment_terminal_location_version import PaymentTerminalLocationVersion
415419
from postfinancecheckout.models.payment_terminal_location_version_state import PaymentTerminalLocationVersionState
416420
from postfinancecheckout.models.payment_terminal_preparing import PaymentTerminalPreparing
417421
from postfinancecheckout.models.payment_terminal_receipt_type import PaymentTerminalReceiptType
418422
from postfinancecheckout.models.payment_terminal_state import PaymentTerminalState
423+
from postfinancecheckout.models.payment_terminal_transaction_sum import PaymentTerminalTransactionSum
424+
from postfinancecheckout.models.payment_terminal_transaction_summary import PaymentTerminalTransactionSummary
419425
from postfinancecheckout.models.payment_terminal_transaction_summary_reference import PaymentTerminalTransactionSummaryReference
420426
from postfinancecheckout.models.payment_terminal_type import PaymentTerminalType
421427
from postfinancecheckout.models.payment_terminal_update import PaymentTerminalUpdate
@@ -475,6 +481,7 @@
475481
from postfinancecheckout.models.rendered_document import RenderedDocument
476482
from postfinancecheckout.models.rendered_terminal_receipt import RenderedTerminalReceipt
477483
from postfinancecheckout.models.rendered_terminal_receipt_list_response import RenderedTerminalReceiptListResponse
484+
from postfinancecheckout.models.rendered_terminal_transaction_summary import RenderedTerminalTransactionSummary
478485
from postfinancecheckout.models.rest_address_format import RestAddressFormat
479486
from postfinancecheckout.models.rest_address_format_field import RestAddressFormatField
480487
from postfinancecheckout.models.rest_api_bulk_operation_result import RestApiBulkOperationResult
@@ -600,6 +607,8 @@
600607
from postfinancecheckout.models.terminal_list_response import TerminalListResponse
601608
from postfinancecheckout.models.terminal_receipt_format import TerminalReceiptFormat
602609
from postfinancecheckout.models.terminal_search_response import TerminalSearchResponse
610+
from postfinancecheckout.models.terminal_transaction_summary_list_response import TerminalTransactionSummaryListResponse
611+
from postfinancecheckout.models.terminal_transaction_summary_search_response import TerminalTransactionSummarySearchResponse
603612
from postfinancecheckout.models.token import Token
604613
from postfinancecheckout.models.token_create import TokenCreate
605614
from postfinancecheckout.models.token_list_response import TokenListResponse

postfinancecheckout/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def param_serialize(
181181

182182
# predefined default headers
183183
default_headers = {
184-
'x-meta-sdk-version': '6.2.0',
184+
'x-meta-sdk-version': '6.3.0',
185185
'x-meta-sdk-language': 'python',
186186
'x-meta-sdk-provider': 'postfinancecheckout',
187187
'x-meta-sdk-language-version': platform.python_version()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# coding: utf-8
2+
3+
"""
4+
PostFinance Python SDK
5+
6+
This library allows to interact with the PostFinance payment service.
7+
8+
Copyright owner: Wallee AG
9+
Website: https://www.postfinance.ch/en/private.html
10+
Developer email: ecosystem-team@wallee.com
11+
12+
Licensed under the Apache License, Version 2.0 (the "License");
13+
you may not use this file except in compliance with the License.
14+
You may obtain a copy of the License at
15+
16+
http://www.apache.org/licenses/LICENSE-2.0
17+
18+
Unless required by applicable law or agreed to in writing, software
19+
distributed under the License is distributed on an "AS IS" BASIS,
20+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
See the License for the specific language governing permissions and
22+
limitations under the License.
23+
"""
24+
25+
26+
from enum import Enum
27+
28+
class ApiExceptionErrorCodes(Enum):
29+
"""
30+
This class represents possible HTTP error codes which can be sent by the API.
31+
This list corresponds to https://checkout.postfinance.ch/en-us/doc/api/web-service#_errors
32+
"""
33+
# The request was not accepted often due to missing or invalid parameters
34+
BAD_REQUEST = 400
35+
# The necessary authentication credentials are missing or incorrect
36+
UNAUTHORIZED = 401
37+
# The application user is missing the required permissions
38+
FORBIDDEN = 403
39+
# The requested resource was not found
40+
NOT_FOUND = 404
41+
# The requested response format is not supported
42+
NOT_ACCEPTABLE = 406
43+
# The request conflicts with another request often because of to optimistic locking
44+
CONFLICT = 409
45+
# Too many operations in a bulk request
46+
PAYLOAD_TOO_LARGE = 413
47+
# The request provides unsupported or invalid data
48+
UNSUPPORTED_MEDIA_TYPE = 415
49+
# The pagination offset exceeds the limit
50+
RANGE_NOT_SATISFIABLE = 416
51+
# The request is well-formed but contains semantic errors
52+
UNPROCESSABLE_ENTITY = 422
53+
# Too many requests hit the API too quickly
54+
TOO_MANY_REQUESTS = 429
55+
# An internal error occurred on the server
56+
INTERNAL_SERVER_ERROR = 500
57+
58+
def __init__(self, http_code):
59+
self._http_code = http_code
60+
61+
@property
62+
def http_code(self):
63+
return self._http_code
64+
65+
def matches(self, api_exception):
66+
"""
67+
Checks if the given exception matches this error code.
68+
"""
69+
return api_exception.status == self.http_code

postfinancecheckout/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def to_debug_report(self) -> str:
347347
"OS: {env}\n"\
348348
"Python Version: {pyversion}\n"\
349349
"Version of the API: 2.0\n"\
350-
"SDK Package Version: 6.2.0".\
350+
"SDK Package Version: 6.3.0".\
351351
format(env=sys.platform, pyversion=sys.version)
352352

353353
def get_host_settings(self) -> List[HostSetting]:

postfinancecheckout/error_code.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

postfinancecheckout/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,16 @@
302302
from postfinancecheckout.models.payment_terminal_configuration_version import PaymentTerminalConfigurationVersion
303303
from postfinancecheckout.models.payment_terminal_configuration_version_state import PaymentTerminalConfigurationVersionState
304304
from postfinancecheckout.models.payment_terminal_create import PaymentTerminalCreate
305+
from postfinancecheckout.models.payment_terminal_dcc_transaction_sum import PaymentTerminalDccTransactionSum
305306
from postfinancecheckout.models.payment_terminal_location import PaymentTerminalLocation
306307
from postfinancecheckout.models.payment_terminal_location_state import PaymentTerminalLocationState
307308
from postfinancecheckout.models.payment_terminal_location_version import PaymentTerminalLocationVersion
308309
from postfinancecheckout.models.payment_terminal_location_version_state import PaymentTerminalLocationVersionState
309310
from postfinancecheckout.models.payment_terminal_preparing import PaymentTerminalPreparing
310311
from postfinancecheckout.models.payment_terminal_receipt_type import PaymentTerminalReceiptType
311312
from postfinancecheckout.models.payment_terminal_state import PaymentTerminalState
313+
from postfinancecheckout.models.payment_terminal_transaction_sum import PaymentTerminalTransactionSum
314+
from postfinancecheckout.models.payment_terminal_transaction_summary import PaymentTerminalTransactionSummary
312315
from postfinancecheckout.models.payment_terminal_transaction_summary_reference import PaymentTerminalTransactionSummaryReference
313316
from postfinancecheckout.models.payment_terminal_type import PaymentTerminalType
314317
from postfinancecheckout.models.payment_terminal_update import PaymentTerminalUpdate
@@ -368,6 +371,7 @@
368371
from postfinancecheckout.models.rendered_document import RenderedDocument
369372
from postfinancecheckout.models.rendered_terminal_receipt import RenderedTerminalReceipt
370373
from postfinancecheckout.models.rendered_terminal_receipt_list_response import RenderedTerminalReceiptListResponse
374+
from postfinancecheckout.models.rendered_terminal_transaction_summary import RenderedTerminalTransactionSummary
371375
from postfinancecheckout.models.rest_address_format import RestAddressFormat
372376
from postfinancecheckout.models.rest_address_format_field import RestAddressFormatField
373377
from postfinancecheckout.models.rest_api_bulk_operation_result import RestApiBulkOperationResult
@@ -493,6 +497,8 @@
493497
from postfinancecheckout.models.terminal_list_response import TerminalListResponse
494498
from postfinancecheckout.models.terminal_receipt_format import TerminalReceiptFormat
495499
from postfinancecheckout.models.terminal_search_response import TerminalSearchResponse
500+
from postfinancecheckout.models.terminal_transaction_summary_list_response import TerminalTransactionSummaryListResponse
501+
from postfinancecheckout.models.terminal_transaction_summary_search_response import TerminalTransactionSummarySearchResponse
496502
from postfinancecheckout.models.token import Token
497503
from postfinancecheckout.models.token_create import TokenCreate
498504
from postfinancecheckout.models.token_list_response import TokenListResponse

0 commit comments

Comments
 (0)