def giftcert_pay_ship_process_form(request, contact, working_cart, payment_module, allow_skip): if request.method == "POST": new_data = request.POST.copy() form = GiftCertPayShipForm(request, payment_module, new_data) if form.is_valid(): data = form.cleaned_data # Create a new order. newOrder = get_or_create_order(request, working_cart, contact, data) newOrder.add_variable(GIFTCODE_KEY, data['giftcode']) request.session['orderID'] = newOrder.id url = None gift_certificate = GiftCertificate.objects.get(code=data['giftcode'], valid=True, site=Site.objects.get_current()) # Check to see if the giftcertificate is not enough # If it isn't, then process it and prompt for next payment method if gift_certificate.balance < newOrder.balance: controller = confirm.ConfirmController(request, gc) controller.confirm() url = reverse('satchmo_balance_remaining') else: url = lookup_url(payment_module, 'satchmo_checkout-step3') return (True, http.HttpResponseRedirect(url)) else: form = GiftCertPayShipForm(request, payment_module) return (False, form)
def confirm_info(request, template='shop/checkout/sagepay/confirm.html', extra_context={}): payment_module = config_get_group('PAYMENT_SAGEPAY') controller = confirm.ConfirmController(request, payment_module) controller.templates['CONFIRM'] = template controller.extra_context = extra_context controller.onForm = secure3d_form_handler controller.confirm() return controller.response
def confirm_info(request, template="shop/checkout/giftcertificate/confirm.html"): try: order = Order.objects.get(id=request.session['orderID']) giftcert = GiftCertificate.objects.from_order(order) except (Order.DoesNotExist, GiftCertificate.DoesNotExist, KeyError): giftcert = None controller = confirm.ConfirmController(request, gc) controller.templates['CONFIRM'] = template controller.extra_context={'giftcert' : giftcert} controller.confirm() return controller.response
def confirm_secure3d( request, secure3d_template='shop/checkout/sagepay/secure3d_form.html', confirm_template='shop/checkout/confirm.html', extra_context={}): """Handles confirming an order and processing the charges when secured by secure3d. """ payment_module = config_get_group('PAYMENT_SAGEPAY') controller = confirm.ConfirmController(request, payment_module, extra_context=extra_context) controller.template['CONFIRM'] = confirm_template if not controller.sanity_check(): return controller.response auth3d = request.session.get('3D', None) if not auth3d: controller.processorMessage = _( '3D Secure transaction expired. Please try again.') else: if request.method == "POST": returnMD = request.POST.get('MD', None) if not returnMD: template = lookup_template(payment_module, secure3d_template) ctx = RequestContext(request, { 'order': controller.order, 'auth': auth3d }) return render_to_response(template, context_instance=ctx) elif returnMD == auth3d['MD']: pares = request.POST.get('PaRes', None) controller.processor.prepare_data(controller.order) controller.processor.prepare_data3d(returnMD, pares) if controller.process(): return controller.onSuccess(controller) else: controller.processorMessage = _( '3D Secure transaction was not approved by payment gateway. Please contact us.' ) else: template = lookup_template(payment_module, secure3d_template) ctx = RequestContext(request, { 'order': controller.order, 'auth': auth3d }) return render_to_response(template, context_instance=ctx) return secure3d_form_handler(controller)
def confirm_info(request): payment_module = config_get_group('PAYMENT_GOOGLE') controller = confirm.ConfirmController(request, payment_module) if not controller.sanity_check(): return controller.response live = gateway_live(payment_module) gcart = GoogleCart(controller.order, payment_module, live) log.debug("CART:\n%s", gcart.cart_xml) post_url = auth.get_url() default_view_tax = config_value('TAX', 'DEFAULT_VIEW_TAX') ctx = { 'post_url': post_url, 'google_cart': gcart.encoded_cart(), 'google_signature': gcart.encoded_signature(), 'PAYMENT_LIVE': live } controller.extra_context = ctx controller.confirm() return controller.response