Exemple #1
0
def payments_process_view(request, event):
    order = get_order(request, event)
    event = order.event

    if not order.is_confirmed:
        messages.error(request, u"Yritetty maksaa keskeneräinen tilaus.")
        return redirect('tickets_confirm_view', event.slug)

    if order.is_paid:
        messages.error(request, u"Tilaus on jo maksettu.")
        return redirect('tickets_thanks_view', event.slug)

    try:
        payment_info = Payment(event=event)
        payment_info = PaymentForm(request.GET, instance=payment_info).save()
    except ValueError:
        messages.error(request, u"Maksu epäonnistui.")
        return redirect('tickets_confirm_view', event.slug)

    if payment_info.STATUS in PaymentStatus.CANCELLED_STATUSES:
        messages.warning(request, u"Maksu peruttiin.")
        return redirect('tickets_confirm_view', event.slug)

    if payment_info.STATUS == PaymentStatus.OK:
        order.confirm_payment() # send_email=True
        return redirect('tickets_thanks_view', event.slug)
    else:
        messages.error(request, u"Emme saaneet maksuoperaattorilta vahvistusta maksustasi.")
        return redirect('tickets_thanks_view', event.slug)
Exemple #2
0
def payments_process_view(request, event):
    order = get_order(request, event)
    event = order.event

    if not order.is_confirmed:
        messages.error(request, "Yritetty maksaa keskeneräinen tilaus.")
        return redirect('tickets_confirm_view', event.slug)

    if order.is_paid:
        messages.error(request, "Tilaus on jo maksettu.")
        return redirect('tickets_thanks_view', event.slug)

    try:
        payment_info = Payment(event=event)
        payment_info = PaymentForm(request.GET, instance=payment_info).save()
    except ValueError:
        messages.error(request, "Maksu epäonnistui.")
        return redirect('tickets_confirm_view', event.slug)

    if payment_info.STATUS in PaymentStatus.CANCELLED_STATUSES:
        messages.warning(request, "Maksu peruttiin.")
        return redirect('tickets_confirm_view', event.slug)

    if payment_info.STATUS == PaymentStatus.OK:
        order.confirm_payment()  # send_email=True
        return redirect('tickets_thanks_view', event.slug)
    else:
        messages.error(
            request,
            "Emme saaneet maksuoperaattorilta vahvistusta maksustasi.")
        return redirect('tickets_thanks_view', event.slug)
Exemple #3
0
def payments_redirect_view(request, event):
    order = get_order(request, event)
    meta = event.payments_event_meta

    if meta.checkout_merchant == EVENT_META_DEFAULTS['checkout_merchant'] and not settings.DEBUG:
        raise ValueError('Bogus Checkout merchant configured for event {}'.format(event.slug))

    if not order.is_confirmed:
        messages.error(request, u'Ole hyvä ja tee tilauksesi ensin valmiiksi.')
        return redirect('tickets_confirm_view', event.slug)

    if order.is_paid:
        messages.error(request, u'Tilaus on jo maksettu. Klikkaa "Uusi tilaus", jos haluat tilata lisää lippuja.')
        return redirect('tickets_thanks_view', event.slug)

    vars = dict(
        order=order,
        checkout_mac=order.checkout_mac(request),
        checkout_return_url=order.checkout_return_url(request),
        checkout_merchant=meta.checkout_merchant,
        checkout_delivery_date=meta.checkout_delivery_date,
        CHECKOUT_PARAMS=settings.CHECKOUT_PARAMS,
    )

    return render(request, 'payments_redirect_view.jade', vars)
Exemple #4
0
def payments_redirect_view(request, event):
    order = get_order(request, event)
    meta = event.payments_event_meta

    if meta.checkout_merchant == EVENT_META_DEFAULTS[
            'checkout_merchant'] and not settings.DEBUG:
        raise ValueError(
            'Bogus Checkout merchant configured for event {}'.format(
                event.slug))

    if not order.is_confirmed:
        messages.error(request, 'Ole hyvä ja tee tilauksesi ensin valmiiksi.')
        return redirect('tickets_confirm_view', event.slug)

    if order.is_paid:
        messages.error(
            request,
            'Tilaus on jo maksettu. Klikkaa "Uusi tilaus", jos haluat tilata lisää lippuja.'
        )
        return redirect('tickets_thanks_view', event.slug)

    vars = dict(
        order=order,
        checkout_mac=order.checkout_mac(request),
        checkout_return_url=order.checkout_return_url(request),
        checkout_merchant=meta.checkout_merchant,
        checkout_delivery_date=meta.checkout_delivery_date,
        CHECKOUT_PARAMS=settings.CHECKOUT_PARAMS,
    )

    return render(request, 'payments_redirect_view.jade', vars)