From fc49c4585beaafb74807691ddf4c31878e5580ce Mon Sep 17 00:00:00 2001 From: Joseph Grimer <88033574+joegrimeringresso@users.noreply.github.com> Date: Mon, 23 May 2022 15:09:21 +0100 Subject: [PATCH] Add internal_error_comment to PurchaseResult (#113) --- CHANGELOG.md | 4 ++++ docs/conf.py | 4 ++-- pyticketswitch/__init__.py | 2 +- pyticketswitch/purchase_result.py | 6 +++++- setup.py | 2 +- tests/test_purchase_result.py | 2 ++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d16530b9..b24192ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [2.11.0] - 2022-05-20 +### Added +- Added internal_error_comment to PurchaseResult class + ## [2.10.0] - 2022-05-10 ### Added - Added reserve_failure_comment to Order class diff --git a/docs/conf.py b/docs/conf.py index 0f30772f..5765740a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,10 +64,10 @@ # # The short X.Y version. -version = '2.10.0' +version = '2.11.0' # The full version, including alpha/beta/rc tags. -release = '2.10.0' +release = '2.11.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pyticketswitch/__init__.py b/pyticketswitch/__init__.py index d9881611..2d1d0890 100644 --- a/pyticketswitch/__init__.py +++ b/pyticketswitch/__init__.py @@ -1,4 +1,4 @@ from pyticketswitch.client import Client # NOQA -__version__ = "2.10.0" +__version__ = "2.11.0" diff --git a/pyticketswitch/purchase_result.py b/pyticketswitch/purchase_result.py index fee8286d..a4cba0e3 100644 --- a/pyticketswitch/purchase_result.py +++ b/pyticketswitch/purchase_result.py @@ -14,6 +14,8 @@ class PurchaseResult(JSONMixin, object): non uniform as they can come from a varitiy of sources. failure_reason (string): description of the failure reason, if there is one. Not for display to customers. + internal_error_comment (str): Extra details that come with the error. + Not for frontend use, but may aid issue resolution is_partial (bool): indicates if the success is only partial for multi- bundle transactions where one may succeed and the other fail. is_semi_credit (bool): Marks the purchase as provisionally completed but @@ -23,7 +25,7 @@ class PurchaseResult(JSONMixin, object): def __init__(self, success=False, failed_3d_secure=False, failed_avs=False, failed_cv_two=False, error=None, failure_reason=None, - is_partial=False, is_semi_credit=False): + is_partial=False, is_semi_credit=False, internal_error_comment=None): self.success = success self.failed_3d_secure = failed_3d_secure @@ -31,6 +33,7 @@ def __init__(self, success=False, failed_3d_secure=False, failed_avs=False, self.failed_cv_two = failed_cv_two self.error = error self.failure_reason = failure_reason + self.internal_error_comment = internal_error_comment self.is_partial = is_partial self.is_semi_credit = is_semi_credit @@ -57,6 +60,7 @@ def from_api_data(cls, data): 'failed_cv_two': data.get('failed_cv_two'), 'error': data.get('purchase_error'), 'failure_reason': data.get('failure_reason'), + 'internal_error_comment': data.get('internal_error_comment'), 'is_partial': data.get('is_partial'), 'is_semi_credit': data.get('is_semi_credit'), } diff --git a/setup.py b/setup.py index 23f5b56c..0ddb4af3 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='pyticketswitch', - version='2.10.0', + version='2.11.0', author='Ingresso', author_email='systems@ingresso.co.uk', url='https://github.com/ingresso-group/pyticketswitch/', diff --git a/tests/test_purchase_result.py b/tests/test_purchase_result.py index 8e2a1e95..4c58e79f 100644 --- a/tests/test_purchase_result.py +++ b/tests/test_purchase_result.py @@ -12,6 +12,7 @@ def test_from_api_data(self): "purchase_error": "too much donk", "success": True, "failure_reason": "unknown", + "internal_error_comment": "Even more error info", "is_partial": True, "is_semi_credit": False, } @@ -24,5 +25,6 @@ def test_from_api_data(self): assert purchase_result.failed_cv_two is True assert purchase_result.error == 'too much donk' assert purchase_result.failure_reason == 'unknown' + assert purchase_result.internal_error_comment == 'Even more error info' assert purchase_result.is_partial assert not purchase_result.is_semi_credit