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()