Skip to content

Commit

Permalink
Add internal_error_comment to PurchaseResult (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
joegrimeringresso committed May 23, 2022
1 parent 9523ced commit fc49c45
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyticketswitch/__init__.py
@@ -1,4 +1,4 @@
from pyticketswitch.client import Client # NOQA


__version__ = "2.10.0"
__version__ = "2.11.0"
6 changes: 5 additions & 1 deletion pyticketswitch/purchase_result.py
Expand Up @@ -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
Expand All @@ -23,14 +25,15 @@ 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
self.failed_avs = failed_avs
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

Expand All @@ -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'),
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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/',
Expand Down
2 changes: 2 additions & 0 deletions tests/test_purchase_result.py
Expand Up @@ -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,
}
Expand All @@ -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

0 comments on commit fc49c45

Please sign in to comment.