Projet

Général

Profil

0002-misc-declare-an-optional-method-on-Payment-payment_s.patch

Benjamin Dauvergne, 14 octobre 2020 12:43

Télécharger (1,35 ko)

Voir les différences:

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(+)
eopayment/__init__.py
228 228
                continue
229 229
            res.append(param)
230 230
        return res
231

  
232
    def payment_status(self, transaction_id, **kwargs):
233
        if not self.backend.payment_status:
234
            raise NotImplementedError('payment_status is not implemented on this backend')
235
        return self.backend.payment_status(transaction_id=transaction_id, **kwargs)
eopayment/common.py
183 183
            amount = amount.to_integral_value(ROUND_DOWN)
184 184
        return str(amount)
185 185

  
186
    payment_status = None
187

  
186 188

  
187 189
class Form(object):
188 190
    def __init__(self, url, method, fields, encoding='utf-8',
189
-