Vérification supplémentaire sur K-Psul
- Ajout d'une exception Checkout.IsProtected - Rend impossible d'utiliser une caisse (Checkout) protégée (is_protected) dans K-Psul Une caisse protégée est, par exemple, la caisse qui recevra les rechargements par CB en ligne.
This commit is contained in:
parent
ffc845aefa
commit
fdb105ab84
2 changed files with 6 additions and 1 deletions
|
@ -186,6 +186,9 @@ class Checkout(models.Model):
|
|||
class Meta:
|
||||
ordering = ['-valid_to']
|
||||
|
||||
class IsProtected(Exception):
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
|
@ -397,7 +397,9 @@ def kpsul_perform_operations(request):
|
|||
try:
|
||||
checkout_pk = request.POST.get('checkout', 0)
|
||||
checkout = Checkout.objects.get(pk=checkout_pk)
|
||||
except (Checkout.DoesNotExist, ValueError):
|
||||
if checkout.is_protected:
|
||||
raise Checkout.IsProtected
|
||||
except (Checkout.DoesNotExist, ValueError, Checkout.IsProtected):
|
||||
data['errors'].append('Caisse invalide')
|
||||
if 'errors' in data:
|
||||
return JsonResponse(data, status=400)
|
||||
|
|
Loading…
Reference in a new issue