diff --git a/payments/gateways/__init__.py b/payments/gateways/__init__.py index 2c38824e..9159967f 100644 --- a/payments/gateways/__init__.py +++ b/payments/gateways/__init__.py @@ -1,2 +1,12 @@ class UnknownGatewayError(Exception): pass + + +class AbstractGateway: + @staticmethod + def process_transaction(transaction): + raise NotImplementedError + + @staticmethod + def process_callback(transaction): + raise NotImplementedError diff --git a/payments/signals.py b/payments/signals.py index 79fbd86a..62e6549c 100644 --- a/payments/signals.py +++ b/payments/signals.py @@ -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