summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-09-21 15:10:01 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-09-21 15:15:49 (GMT)
commitd7889675b7be5d5622ee90ee697cf4245dd72cc4 (patch)
tree638eeffffa66b45cbebe59ecd970423787ffcbb8
parent4153a0e597a642f3d792e35d907a48b21c08251c (diff)
downloadeopayment-d7889675b7be5d5622ee90ee697cf4245dd72cc4.zip
eopayment-d7889675b7be5d5622ee90ee697cf4245dd72cc4.tar.gz
eopayment-d7889675b7be5d5622ee90ee697cf4245dd72cc4.tar.bz2
tipi: confound order_id/transaction_id with refdet (#36322)v1.37
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].
-rw-r--r--eopayment/tipi.py7
-rw-r--r--tests/test_tipi.py2
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'):