lingo: return different message for cancelled transaction (#47497)
This commit is contained in:
parent
20f0556792
commit
edd13a2b66
|
@ -958,7 +958,7 @@ class TransactionStatusApiView(View):
|
|||
return JsonResponse(data=data)
|
||||
|
||||
if transaction.status in (
|
||||
eopayment.CANCELLED, eopayment.ERROR, eopayment.DENIED, EXPIRED
|
||||
eopayment.ERROR, eopayment.DENIED, EXPIRED
|
||||
):
|
||||
data = {
|
||||
'wait': True,
|
||||
|
@ -967,6 +967,14 @@ class TransactionStatusApiView(View):
|
|||
}
|
||||
return JsonResponse(data=data)
|
||||
|
||||
if transaction.status == eopayment.CANCELLED:
|
||||
data = {
|
||||
'wait': True,
|
||||
'error': False,
|
||||
'error_msg': _('Payment cancelled, you can continue and make another payment')
|
||||
}
|
||||
return JsonResponse(data=data)
|
||||
|
||||
data = {
|
||||
'wait': True,
|
||||
'error': False,
|
||||
|
|
|
@ -1443,6 +1443,21 @@ def test_transaction_status_api(app, regie, user):
|
|||
'error_msg': ''
|
||||
}
|
||||
|
||||
# transaction cancelled
|
||||
transaction = Transaction.objects.create(
|
||||
amount=Decimal('10.0'), regie=regie, status=eopayment.CANCELLED
|
||||
)
|
||||
url = reverse(
|
||||
'api-transaction-status',
|
||||
kwargs={'transaction_signature': signing_dumps(transaction.pk)}
|
||||
)
|
||||
resp = app.get(url)
|
||||
assert resp.json == {
|
||||
'wait': True,
|
||||
'error': False,
|
||||
'error_msg': 'Payment cancelled, you can continue and make another payment'
|
||||
}
|
||||
|
||||
|
||||
def test_request_payment_exception(app, basket_page, regie, user):
|
||||
item = BasketItem.objects.create(user=user, regie=regie,
|
||||
|
|
Loading…
Reference in New Issue