def orders_bank_notify(request): r = 'OK' if settings.BANK_DRIVER.upper() == 'CYBERPLUS': bp = CyberPlus(request) if request.method == 'POST': bp.process_order() else: r = 'KO' elif settings.BANK_DRIVER.upper() == 'ETRANSACTIONS': bp = eTransactions(request) bp.process_order() elif settings.BANK_DRIVER.upper() == 'CMCIC': bp = cmcic(request) r = bp.process_order() elif settings.BANK_DRIVER.upper() == 'OGONE': bp = ogone(request) r = bp.process_order() return HttpResponse(r, mimetype="text/html")
def orders_etransactions_go(request, order_id=0): try: order = Order.objects.get(user=request.user, id=int(order_id)) except: order = None # only allowed to see its own orders if not order or (order and order.user.id != request.user.id): return HttpResponseRedirect("/resa/orders/details/%d" % (int(order_id))) protocol = request.is_secure() and 'https' or 'http' url = "%s://%s" % (protocol, request.get_host()) ip_addr = request.META['REMOTE_ADDR'] bp = eTransactions(request) r = HttpResponse(mimetype='text/html') r['Cache-Control'] = 'no-cache, no-store' r['Pragma'] = 'no-cache' r.write(bp.form(order, request.user, request.LANGUAGE_CODE, ip_addr, url)) return r
def orders_bank_return(request, tmpl, status=None, order_id=None): msg_err = msg_ok = msg_warn = None if settings.BANK_DRIVER.upper() == 'CYBERPLUS': bp = CyberPlus(request) error, code, canceled, rejected, delayed, accepted, order_id = bp.getreturn() elif settings.BANK_DRIVER.upper() == 'ETRANSACTIONS': bp = eTransactions(request) error, canceled, rejected, delayed, accepted, order_id = bp.getreturn() elif settings.BANK_DRIVER.upper() == 'CMCIC': bp = cmcic(request) canceled, rejected, delayed, accepted, order_id = bp.getreturn(status, order_id) elif settings.BANK_DRIVER.upper() == 'OGONE': bp = ogone(request) canceled, rejected, delayed, accepted, order_id = bp.getreturn(status) if delayed: msg_warn = _(u"Confirmation of your payment by your bank has not been received yet. You should contact your bank before retrying to pay for this order.") elif canceled: msg_warn = _(u"Your payment has been canceled, you could resume it later.") elif rejected: msg_err = _(u"Your payment has been rejected by the bank, you should retry in few days or try another payment method.") elif accepted: try: order = Order.objects.get(id=int(order_id)) except: order = None if order: if order.user.id != request.user.id: msg_err = _(u"This order is not yours.") else: msg_ok = _(u"Your payment has been confirmed by the bank, you should receive a notification by email in a few minutes.") else: msg_err = _(u"Unable to find the order related to this payment.") else: msg_err = _(u"Your payment has failed, you should retry in few days or try another payment method.") return tmpl, locals()