pokus o result
This commit is contained in:
parent
6c2895b02a
commit
d024364e00
@ -16,7 +16,7 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from alkatorapi.views import register, results, photos, payment_result
|
from alkatorapi.views import register, results, photos, payment_result, payment_state
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
@ -24,4 +24,5 @@ urlpatterns = [
|
|||||||
path('api/results', results),
|
path('api/results', results),
|
||||||
path('api/photos', photos),
|
path('api/photos', photos),
|
||||||
path('api/payment_result', payment_result),
|
path('api/payment_result', payment_result),
|
||||||
|
path('api/payment_state', payment_state),
|
||||||
]
|
]
|
||||||
|
@ -36,4 +36,4 @@ class User(models.Model):
|
|||||||
paid = models.BooleanField(default=False)
|
paid = models.BooleanField(default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"<User {self.starting_number} {self.first_name} {self.last_name} {self.email} {self.duration} {self.alkator_category} {ALKATOR_CLASSES_DICT[self.alkator_class]}>"
|
return f"<User {self.starting_number} {self.first_name} {self.last_name} {self.email} {self.duration} {ALKATOR_CHOICES_DICT[self.alkator_category]} {ALKATOR_CLASSES_DICT[self.alkator_class]} {self.paid}>"
|
||||||
|
@ -92,6 +92,14 @@ def payment_result(request):
|
|||||||
return HttpResponse(status=200)
|
return HttpResponse(status=200)
|
||||||
|
|
||||||
|
|
||||||
|
def payment_state(request):
|
||||||
|
id = request.GET['refId']
|
||||||
|
if User.objects.get(id=id).paid:
|
||||||
|
return HttpResponse('{"status":"success", "reason":"Úspěšná platba"}', content_type='application/json')
|
||||||
|
else:
|
||||||
|
return HttpResponse('{"status":"failed", "reason":"Zatím nemáme informace o provedené platbě. Zkuste reload nebo zkontrolujte email."}', content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
def results(request):
|
def results(request):
|
||||||
results = []
|
results = []
|
||||||
n = 1
|
n = 1
|
||||||
|
@ -30,6 +30,11 @@ class Main extends Component {
|
|||||||
fetch(addr_prefix + "/api/photos").then(resp => resp.json()).then(json => {
|
fetch(addr_prefix + "/api/photos").then(resp => resp.json()).then(json => {
|
||||||
this.setState({photos: json})
|
this.setState({photos: json})
|
||||||
})
|
})
|
||||||
|
if(window.location.search){
|
||||||
|
fetch(addr_prefix + "/api/payment_state" + window.location.search).then(resp => resp.json()).then(json =>{
|
||||||
|
this.setState({status: json.status, text: json.reason})
|
||||||
|
})
|
||||||
|
}
|
||||||
window.addEventListener("hashchange", (e) => {this.onHashChange(e)})
|
window.addEventListener("hashchange", (e) => {this.onHashChange(e)})
|
||||||
}
|
}
|
||||||
closePhoto = () => {
|
closePhoto = () => {
|
||||||
@ -288,7 +293,7 @@ class Main extends Component {
|
|||||||
<input type="checkbox" class="form-check-input" id="agreement" name="agreement" />
|
<input type="checkbox" class="form-check-input" id="agreement" name="agreement" />
|
||||||
<label class="form-check-label" for="agreement">Souhlas se <a href="/public/ochrana_osobnich_udaju.pdf">zpracováním osobních údajů</a> a <a href="/public/reverz.pdf">podmínkami závodu</a>.</label>
|
<label class="form-check-label" for="agreement">Souhlas se <a href="/public/ochrana_osobnich_udaju.pdf">zpracováním osobních údajů</a> a <a href="/public/reverz.pdf">podmínkami závodu</a>.</label>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Odeslat</button>
|
<button type="submit" class="btn btn-primary">Odeslat a zaplatit</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="container text-center social">
|
<div class="container text-center social">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user