fix
This commit is contained in:
parent
2274bac99e
commit
02f919f296
@ -19,7 +19,7 @@ import PIL.Image
|
|||||||
import random
|
import random
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from .models import User, ALKATOR_CHOICES_DICT, ALKATOR_CLASSES, Profile, Racer, Invoice, Product
|
from .models import User, ALKATOR_CHOICES_DICT, ALKATOR_CLASSES, Profile, Racer, Invoice, Product, InvoiceProduct
|
||||||
from alkator.settings import COMGATE_MERCHANT, COMGATE_SECRET, COMGATE_TEST
|
from alkator.settings import COMGATE_MERCHANT, COMGATE_SECRET, COMGATE_TEST
|
||||||
|
|
||||||
|
|
||||||
@ -113,8 +113,6 @@ def register_racer(request):
|
|||||||
if product.quantity <= 0:
|
if product.quantity <= 0:
|
||||||
return HttpResponse('{"reason":"Jsme vyprodaní!"}', status=400, content_type='application/json')
|
return HttpResponse('{"reason":"Jsme vyprodaní!"}', status=400, content_type='application/json')
|
||||||
|
|
||||||
product.quantity -= 1
|
|
||||||
product.save()
|
|
||||||
|
|
||||||
invoice = Invoice(
|
invoice = Invoice(
|
||||||
invoice_id=invoice_id,
|
invoice_id=invoice_id,
|
||||||
@ -148,7 +146,7 @@ def register_racer(request):
|
|||||||
'label': 'Startovné na závod Alkátor Race Dolní Čermná 2025',
|
'label': 'Startovné na závod Alkátor Race Dolní Čermná 2025',
|
||||||
'email': user.email,
|
'email': user.email,
|
||||||
'fullName': f"{profile.first_name} {profile.last_name}",
|
'fullName': f"{profile.first_name} {profile.last_name}",
|
||||||
'refId': f'{racer.invoice_id}',
|
'refId': f'{invoice.invoice_id}',
|
||||||
'secret': COMGATE_SECRET,
|
'secret': COMGATE_SECRET,
|
||||||
'prepareOnly': 'true',
|
'prepareOnly': 'true',
|
||||||
}
|
}
|
||||||
@ -161,6 +159,9 @@ def register_racer(request):
|
|||||||
invoice.delete()
|
invoice.delete()
|
||||||
return HttpResponse('{"reason":"Chyba na straně platební brány: ' + result['message'][0] + ', zkuste prosím registraci později."}', status=400, content_type='application/json')
|
return HttpResponse('{"reason":"Chyba na straně platební brány: ' + result['message'][0] + ', zkuste prosím registraci později."}', status=400, content_type='application/json')
|
||||||
|
|
||||||
|
product.quantity -= 1
|
||||||
|
product.save()
|
||||||
|
|
||||||
invoice.trans_id = result['transId'][0]
|
invoice.trans_id = result['transId'][0]
|
||||||
invoice.save()
|
invoice.save()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user