Пример #1
0
def pay_ship_info( request ):
    payment_module = coposweb

    # Copied from payship.base_pay_ship_info
    results = payship.pay_ship_info_verify( request, payment_module )

    if not results[0]:
        return results[1]

    contact = results[1]
    working_cart = results[2]

    # Check if there's anything to pay
    try:
        order = Order.objects.from_request( request )
    except Order.DoesNotExist:
        return HttpResponseRedirect( lookup_url( payment_module, 'satchmo_checkout-step1' ) )

    if order.paid_in_full:
        form_handler = payship.simple_pay_ship_process_form
        template = 'shop/checkout/coposweb/pay_ship_free.html'
    else:
        form_handler = payship.credit_pay_ship_process_form
        template = 'shop/checkout/coposweb/pay_ship.html'

    results = form_handler( request, contact, working_cart, payment_module, allow_skip=False )
    if results[0]:
        return results[1]

    form = results[1]
    return payship.pay_ship_render_form( request, form, template, payment_module, working_cart )
Пример #2
0
def pay_ship_info(request):
    template = 'satchmo_stripe/pay_ship.html'
    payment_module = stripe
    form_handler = stripe_pay_ship_process_form
    result = payship.pay_ship_info_verify(request, payment_module)

    if not result[0]:
        return result[1]

    contact = result[1]
    working_cart = result[2]

    success, form = form_handler(request, contact, working_cart, payment_module)
    if success:
        return form

    template = lookup_template(payment_module, template)
    live = gateway_live(payment_module)

    ctx = RequestContext(request, {
        'form': form,
        'PAYMENT_LIVE': live,        
        })

    return render_to_response(template, context_instance=ctx)
Пример #3
0
def pay_ship_info(request):
    template = 'satchmo_stripe/pay_ship.html'
    payment_module = stripe_config
    form_handler = stripe_pay_ship_process_form
    result = payship.pay_ship_info_verify(request, payment_module)

    if not result[0]:
        return result[1]

    contact = result[1]
    working_cart = result[2]

    success, form = form_handler(request, contact, working_cart, payment_module)
    if success:
        return form

    template = lookup_template(payment_module, template)
    live = gateway_live(payment_module)

    last4=''
    cc_type=''
    user = threadlocals.get_current_user()
    if user and user.is_authenticated:
      stripe_id = utils.check_stripe_customer(threadlocals.get_current_user())
      if stripe_id:
        customer = utils.get_customer(stripe_id)
        if customer:
          last4 = customer.active_card.last4
          cc_type = customer.active_card.type
          if utils.card_is_about_to_expire(customer.active_card):
#Raise message telling user that the card is about to expire
            message = "The %s card ending in %s will expire in less than %d days, please enter a new card" % (cc_type,last4,payment_module.MIN_DAYS.value)
            messages.add_message(request, messages.WARNING, message)
            cc_type = ''
            last4=''


    ctx = RequestContext(request, {
        'form': form,
        'PAYMENT_LIVE': live,        
        'saved_card' : last4,
        'cc_type' : cc_type,
        'show_save_option' : payment_module.CAPTURE.value,
        })

    return render_to_response(template, context_instance=ctx)
def pay_ship_info(request, template='shop/checkout/paymentspro/shipping.html'):
    
    results = payship.pay_ship_info_verify(request, PAYMENT_MODULE)
    if not results[0]:
        return results[1]

    contact = results[1]
    working_cart = results[2]

    results = payship.simple_pay_ship_process_form(
        request,
        contact,
        working_cart,
        PAYMENT_MODULE,
        allow_skip=False)
    
    if results[0]:
        return results[1]

    form = results[1]
    return payship.pay_ship_render_form(request, form, template, 
                                        PAYMENT_MODULE, working_cart)