From d7889675b7be5d5622ee90ee697cf4245dd72cc4 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 21 Sep 2019 17:10:01 +0200 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(-) diff --git a/eopayment/tipi.py b/eopayment/tipi.py index 78857a3..9a7e75b 100644 --- a/eopayment/tipi.py +++ b/eopayment/tipi.py @@ -161,8 +161,8 @@ class Payment(PaymentCommon): raise ResponseError('missing refdet or resultrans') for key, value in fields.items(): fields[key] = value[0] - transaction_id = fields.get('refdet') - if transaction_id is None: + refdet = fields.get('refdet') + if refdet is None: raise ResponseError('refdet is missing') result = fields.get('resultrans') @@ -186,5 +186,6 @@ class Payment(PaymentCommon): bank_status=bank_status, signed=True, bank_data=fields, - transaction_id=transaction_id, + order_id=refdet, + transaction_id=refdet, test=test) diff --git a/tests/test_tipi.py b/tests/test_tipi.py index 31a6792..9e2660c 100644 --- a/tests/test_tipi.py +++ b/tests/test_tipi.py @@ -31,6 +31,8 @@ def test_tipi(): 'objet=tout+a+fait&montant=12312&saisie=T&mel=info%40entrouvert.com' '&numcli=12345&exer=9999&refdet=999900000000999999&resultrans=P') assert response.signed # ... + assert response.order_id == '999900000000999999' + assert response.transaction_id == '999900000000999999' assert response.result == eopayment.PAID with pytest.raises(eopayment.ResponseError, match='missing refdet or resultrans'):