Subversion Repositories SmartDukaan

Rev

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

Rev 5996 Rev 6011
Line 39... Line 39...
39
 
39
 
40
def apply_coupon(coupon_code, cart_id):
40
def apply_coupon(coupon_code, cart_id):
41
    coupon = Coupon.get_by(coupon_code = coupon_code)
41
    coupon = Coupon.get_by(coupon_code = coupon_code)
42
    
42
    
43
    if coupon:
43
    if coupon:
-
 
44
        todate = datetime.datetime.now()
-
 
45
        if not (coupon.promotion.start_on <=  todate and coupon.promotion.end_on >= todate):
-
 
46
            raise PromotionException(101, 'Promotion has been expired')
-
 
47
    
44
        user_client = UserClient().get_client()
48
        user_client = UserClient().get_client()
45
        cart = user_client.getCart(cart_id)
49
        cart = user_client.getCart(cart_id)
46
        
50
        
47
        coupon_module = coupon.promotion.rule_execution_src.strip()
51
        coupon_module = coupon.promotion.rule_execution_src.strip()
48
        
52