Features: 1) Add AbstractGateway base class with process_transaction and process_callback methods.
Fixes: 1) Correct gateway status handling logic in `payments/signals.py`. Extra: 1) Remove redundant condition checks in `payments/signals.py`.
This commit is contained in:
parent
b92e7e28f1
commit
489ceeaa2a
2 changed files with 14 additions and 3 deletions
|
|
@ -1,2 +1,12 @@
|
|||
class UnknownGatewayError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class AbstractGateway:
|
||||
@staticmethod
|
||||
def process_transaction(transaction):
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def process_callback(transaction):
|
||||
raise NotImplementedError
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ def process_transaction_changes(instance, created, **_kwargs):
|
|||
except Exception as e: # noqa:
|
||||
instance.process = {"status": "NOGATEWAY", "error": str(e)}
|
||||
if not created:
|
||||
if "success" in str(instance.process).lower() and "notify" in str(instance.process).lower():
|
||||
status = instance.process.get("status", "").lower()
|
||||
success = instance.process.get("success", False)
|
||||
|
||||
if "success" in status or success:
|
||||
balance_deposit_email.delay(instance.uuid)
|
||||
if "fail" in str(instance.process).lower() and "notify" in str(instance.process).lower():
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue