0003-lingo-add-payment_url-property-to-basket-item-46503.patch
combo/apps/lingo/models.py | ||
---|---|---|
51 | 51 |
from combo.utils import NothingInCacheException, aes_hex_encrypt, requests |
52 | 52 |
from combo.apps.notifications.models import Notification |
53 | 53 | |
54 |
from .utils import signing_dumps |
|
55 | ||
54 | 56 |
try: |
55 | 57 |
from mellon.models import UserSAMLIdentifier |
56 | 58 |
except ImportError: |
... | ... | |
439 | 441 |
def total_amount(self): |
440 | 442 |
return self.amount |
441 | 443 | |
444 |
@property |
|
445 |
def payment_url(self): |
|
446 |
signature = signing_dumps(self.pk) |
|
447 |
return reverse('basket-item-pay-view', kwargs={'item_signature': signature }) |
|
448 | ||
442 | 449 | |
443 | 450 |
class RemoteItem(object): |
444 | 451 |
payment_date = None |
combo/apps/lingo/views.py | ||
---|---|---|
221 | 221 |
if item.regie.extra_fees_ws_url: |
222 | 222 |
BadRequestJsonResponse('can not compute extra fees with anonymous user') |
223 | 223 | |
224 |
payment_url = reverse( |
|
225 |
'basket-item-pay-view', |
|
226 |
kwargs={ |
|
227 |
'item_signature': signing_dumps(item.pk) |
|
228 |
}) |
|
229 | 224 |
return JsonResponse({'result': 'success', 'id': str(item.id), |
230 |
'payment_url': request.build_absolute_uri(payment_url)}) |
|
225 |
'payment_url': request.build_absolute_uri(item.payment_url)})
|
|
231 | 226 | |
232 | 227 | |
233 | 228 |
class RemoveBasketItemApiView(View): |
234 |
- |