Subversion Repositories SmartDukaan

Rev

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

Rev 6470 Rev 6471
Line 11... Line 11...
11
 
11
 
12
def execute(cart, coupon_code, args):
12
def execute(cart, coupon_code, args):
13
    if 'items' not in args or 'handset_display_name' not in args:
13
    if 'items' not in args or 'handset_display_name' not in args:
14
        raise PromotionException(109, 'Error in rule arguments.')
14
        raise PromotionException(109, 'Error in rule arguments.')
15
        
15
        
16
    if 'end_on' in args and datetime.datetime.strptime(args['end_on'], '%Y%m%d') <= datetime.datetime.now():
16
    if 'end_on' in args and datetime.datetime.strptime(args['end_on'], '%Y-%m-%d') <= datetime.datetime.now():
17
        raise PromotionException(112, 'This promotion is expired.')
17
        raise PromotionException(112, 'This promotion is expired.')
18
         
18
         
19
    if 'usage_limit' in args and args['usage_limit'] is not None:
19
    if 'usage_limit' in args and args['usage_limit'] is not None:
20
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
20
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
21
            raise PromotionException(112, 'This promotion is over.')
21
            raise PromotionException(112, 'This promotion is over.')