From 873788f0d5dd85b900ceb538654ce83adcc77727 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 14 Oct 2020 11:31:20 +0200 Subject: [PATCH 2/3] misc: declare an optional method on Payment, payment_status(**kwargs) Set as None to ease checks by client code of the availability of this method. --- eopayment/__init__.py | 5 +++++ eopayment/common.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/eopayment/__init__.py b/eopayment/__init__.py index bcee943..db7c01e 100644 --- a/eopayment/__init__.py +++ b/eopayment/__init__.py @@ -228,3 +228,8 @@ class Payment(object): continue res.append(param) return res + + def payment_status(self, transaction_id, **kwargs): + if not self.backend.payment_status: + raise NotImplementedError('payment_status is not implemented on this backend') + return self.backend.payment_status(transaction_id=transaction_id, **kwargs) diff --git a/eopayment/common.py b/eopayment/common.py index 3cdba8f..019af0d 100644 --- a/eopayment/common.py +++ b/eopayment/common.py @@ -183,6 +183,8 @@ class PaymentCommon(object): amount = amount.to_integral_value(ROUND_DOWN) return str(amount) + payment_status = None + class Form(object): def __init__(self, url, method, fields, encoding='utf-8', -- 2.28.0