Projet

Général

Profil

0001-tipi-confound-order_id-transaction_id-with-refdet-36.patch

Benjamin Dauvergne, 21 septembre 2019 17:16

Télécharger (2,15 ko)

Voir les différences:

Subject: [PATCH] tipi: confound order_id/transaction_id with refdet (#36322)

TIPI has no concept of a transaction_id and our main user (lingo
application in combo) use only order_id. PaymentResponse documentation
should be changed to deprecate transaction_id, and first return value of
.request() should be renamed order_id to make things understandable as
with all backend what you get in PaymentResponse.order_id is what is
returned by backend.request()[0].
 eopayment/tipi.py  | 7 ++++---
 tests/test_tipi.py | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)
eopayment/tipi.py
161 161
            raise ResponseError('missing refdet or resultrans')
162 162
        for key, value in fields.items():
163 163
            fields[key] = value[0]
164
        transaction_id = fields.get('refdet')
165
        if transaction_id is None:
164
        refdet = fields.get('refdet')
165
        if refdet is None:
166 166
            raise ResponseError('refdet is missing')
167 167

  
168 168
        result = fields.get('resultrans')
......
186 186
            bank_status=bank_status,
187 187
            signed=True,
188 188
            bank_data=fields,
189
            transaction_id=transaction_id,
189
            order_id=refdet,
190
            transaction_id=refdet,
190 191
            test=test)
tests/test_tipi.py
31 31
        'objet=tout+a+fait&montant=12312&saisie=T&mel=info%40entrouvert.com'
32 32
        '&numcli=12345&exer=9999&refdet=999900000000999999&resultrans=P')
33 33
    assert response.signed  # ...
34
    assert response.order_id == '999900000000999999'
35
    assert response.transaction_id == '999900000000999999'
34 36
    assert response.result == eopayment.PAID
35 37

  
36 38
    with pytest.raises(eopayment.ResponseError, match='missing refdet or resultrans'):
37
-