def inner_func(request): class Collection: pass checkout_data = Collection() payment_module = config_get_group('PAYMENT_BANKPASSWEB') checkout_data.payment_module = payment_module checkout_data.processor = processing_module.PaymentProcessor( payment_module) # Are we really processing an order? try: order = Order.objects.from_request(request) except Order.DoesNotExist: url = lookup_url(payment_module, 'satchmo_checkout-step1') return HttpResponseRedirect(url) # Does our order have items in its cart? tempCart = Cart.objects.from_request(request) if tempCart.numItems == 0: template = lookup_template(payment_module, 'checkout/empty_cart.html') return render_to_response(template, RequestContext(request)) # Is our order still valid? if not order.validate(request): context = RequestContext( request, {'message': _('Your order is no longer valid.')}) return render_to_response('shop_404.html', context) # Finally call the view checkout_data.order = order checkout_data.cart = tempCart return func(request, checkout_data)
def inner_func(request): class Collection: pass checkout_data = Collection() payment_module = config_get_group('PAYMENT_BANKPASSWEB') checkout_data.payment_module = payment_module checkout_data.processor = processing_module.PaymentProcessor(payment_module) # Are we really processing an order? try: order = Order.objects.from_request(request) except Order.DoesNotExist: url = lookup_url(payment_module, 'satchmo_checkout-step1') return HttpResponseRedirect(url) # Does our order have items in its cart? tempCart = Cart.objects.from_request(request) if tempCart.numItems == 0: template = lookup_template(payment_module, 'checkout/empty_cart.html') return render_to_response(template, RequestContext(request)) # Is our order still valid? if not order.validate(request): context = RequestContext(request, {'message': _('Your order is no longer valid.')}) return render_to_response('shop_404.html', context) # Finally call the view checkout_data.order = order checkout_data.cart = tempCart return func(request, checkout_data)
def confirm_info(request, checkout): # Then we can go. # template = lookup_template(checkout.payment_module, 'checkout/bankpassweb/confirm.html') checkout.processor.prepare_data(checkout.order) log.info('Creating a PENDING transaction for order %s' % checkout.order) create_pending_payment(checkout.order, checkout.payment_module, amount=checkout.order.balance) ctx = RequestContext(request, {'order': checkout.order, 'start_url': checkout.processor.start_url, 'PAYMENT_LIVE': checkout.processor.live, 'invoice': checkout.order.id, }) return render_to_response(template, ctx)
def confirm_info(request, checkout): # Then we can go. # template = lookup_template(checkout.payment_module, 'checkout/bankpassweb/confirm.html') checkout.processor.prepare_data(checkout.order) log.info('Creating a PENDING transaction for order %s' % checkout.order) create_pending_payment(checkout.order, checkout.payment_module, amount=checkout.order.balance) ctx = RequestContext( request, { 'order': checkout.order, 'start_url': checkout.processor.start_url, 'PAYMENT_LIVE': checkout.processor.live, 'invoice': checkout.order.id, }) return render_to_response(template, ctx)