lingo: add payment_url property to basket item (#46503)
This commit is contained in:
parent
c5662aa6b6
commit
3faa37405b
|
@ -51,6 +51,8 @@ from combo.data.library import register_cell_class
|
|||
from combo.utils import NothingInCacheException, aes_hex_encrypt, requests
|
||||
from combo.apps.notifications.models import Notification
|
||||
|
||||
from .utils import signing_dumps
|
||||
|
||||
try:
|
||||
from mellon.models import UserSAMLIdentifier
|
||||
except ImportError:
|
||||
|
@ -439,6 +441,11 @@ class BasketItem(models.Model):
|
|||
def total_amount(self):
|
||||
return self.amount
|
||||
|
||||
@property
|
||||
def payment_url(self):
|
||||
signature = signing_dumps(self.pk)
|
||||
return reverse('basket-item-pay-view', kwargs={'item_signature': signature })
|
||||
|
||||
|
||||
class RemoteItem(object):
|
||||
payment_date = None
|
||||
|
|
|
@ -221,13 +221,8 @@ class AddBasketItemApiView(View):
|
|||
if item.regie.extra_fees_ws_url:
|
||||
BadRequestJsonResponse('can not compute extra fees with anonymous user')
|
||||
|
||||
payment_url = reverse(
|
||||
'basket-item-pay-view',
|
||||
kwargs={
|
||||
'item_signature': signing_dumps(item.pk)
|
||||
})
|
||||
return JsonResponse({'result': 'success', 'id': str(item.id),
|
||||
'payment_url': request.build_absolute_uri(payment_url)})
|
||||
'payment_url': request.build_absolute_uri(item.payment_url)})
|
||||
|
||||
|
||||
class RemoveBasketItemApiView(View):
|
||||
|
|
Loading…
Reference in New Issue