Subversion Repositories SmartDukaan

Rev

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

Rev 2465 Rev 4856
Line 13... Line 13...
13
    if 'usage_limit' in args and args['usage_limit'] is not None:
13
    if 'usage_limit' in args and args['usage_limit'] is not None:
14
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
14
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
15
            raise PromotionException(112, 'This promotion is over.')
15
            raise PromotionException(112, 'This promotion is over.')
16
    
16
    
17
    if 'usage_limit_for_user' in args and args['usage_limit_for_user'] is not None:
17
    if 'usage_limit_for_user' in args and args['usage_limit_for_user'] is not None:
18
        if args['usage_limit_for_user'] <= get_coupon_usage_count_by_user(coupon_code):
18
        if args['usage_limit_for_user'] <= get_coupon_usage_count_by_user(coupon_code, cart.userId):
19
            raise PromotionException(111, 'You have already used this coupon maximum possible times.')
19
            raise PromotionException(111, 'You have already used this coupon maximum possible times.')
20
    
20
    
21
    if not cart.lines:
21
    if not cart.lines:
22
        #TODO: Cart has no lines.
22
        #TODO: Cart has no lines.
23
        return cart
23
        return cart