Subversion Repositories SmartDukaan

Rev

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

Rev 5430 Rev 5434
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
    total_amount = 0
-
 
463
    if cart:
462
    if cart:
464
        if cart.coupon_code and cart.coupon_code.lower() == 'searlybird':
463
        if cart.coupon_code and cart.coupon_code.lower() == 'searlybird':
465
            cod_option = False
464
            cod_option = False
466
        
465
        
467
        elif cart.lines:
466
        elif cart.lines:
468
            for line in cart.lines:
467
            for line in cart.lines:
469
                logistics_info = logistics_client.getLogisticsEstimation(line.item_id, pincode, DeliveryType.PREPAID)
468
                logistics_info = logistics_client.getLogisticsEstimation(line.item_id, pincode, DeliveryType.PREPAID)
470
                total_amount = total_amount + line.actual_price
-
 
471
                if not logistics_info.codAllowed:
469
                if not logistics_info.codAllowed:
472
                    cod_option = False
470
                    cod_option = False
473
                    break
471
                    break
474
            if total_amount > 20000 or total_amount < 250:
472
            if cart.total_price > 20000 or cart.total_price <= 250:
475
                cod_option = False
473
                cod_option = False
476
    return cod_option
474
    return cod_option
477
    
475
    
478
def close_session():
476
def close_session():
479
    if session.is_active:
477
    if session.is_active: