diff --git a/alkatorapi/views.py b/alkatorapi/views.py index 5e05b2b..8ca7a63 100644 --- a/alkatorapi/views.py +++ b/alkatorapi/views.py @@ -402,6 +402,9 @@ def cart_buy(request): if cp.quantity > cp.product.quantity: return HttpResponse('{"status": "failed", "reason": "Nemáme dostatek ' + cp.product.name + ' na skladě!"}', status=400, content_type='application/json') + if not cart.address: + return HttpResponse('{"status": "failed", "reason": "Je potřeba vybrat výběrní místo!"}', status=400, content_type='application/json') + invoice = Invoice( user=user, address=cart.address, @@ -423,7 +426,7 @@ def cart_buy(request): total_price += cp.quantity * cp.product.price ip.save() - if total_price <= 0: + if total_price <= 79: return HttpResponse('{"status": "failed", "reason": "Prosím přidejte svoje položky do košíku!"}', status=400, content_type='application/json') payment_data = {