Subversion Repositories SmartDukaan

Rev

Rev 5351 | Rev 5430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5351 Rev 5429
Line 457... Line 457...
457
 
457
 
458
def show_cod_option(cartId, sourceId, pincode):
458
def show_cod_option(cartId, sourceId, pincode):
459
    cart = Cart.get_by(id = cartId)
459
    cart = Cart.get_by(id = cartId)
460
    cod_option = True
460
    cod_option = True
461
    logistics_client = LogisticsClient().get_client()
461
    logistics_client = LogisticsClient().get_client()
462
    
462
    total_amount = 0
463
    if cart:
463
    if cart:
464
        if cart.coupon_code and cart.coupon_code.lower() == 'searlybird':
464
        if cart.coupon_code and cart.coupon_code.lower() == 'searlybird':
465
            cod_option = False
465
            cod_option = False
466
        
466
        
467
        elif cart.lines:
467
        elif cart.lines:
468
            for line in cart.lines:
468
            for line in cart.lines:
469
                logistics_info = logistics_client.getLogisticsEstimation(line.item_id, pincode, DeliveryType.PREPAID)
469
                logistics_info = logistics_client.getLogisticsEstimation(line.item_id, pincode, DeliveryType.PREPAID)
470
                
470
                total_amount = total_amount + line.actual_price
471
                if not logistics_info.codAllowed:
471
                if not logistics_info.codAllowed:
472
                    cod_option = False
472
                    cod_option = False
473
                    break
473
                    break
-
 
474
            if total_amount > 20000 or total_amount < 250:
474
    
475
                 cod_option = False
475
    return cod_option
476
    return cod_option
476
    
477
    
477
def close_session():
478
def close_session():
478
    if session.is_active:
479
    if session.is_active:
479
        print "session is active. closing it."
480
        print "session is active. closing it."