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].
This commit is contained in:
Benjamin Dauvergne 2019-09-21 17:10:01 +02:00
parent 4153a0e597
commit d7889675b7
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -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'):