Subversion Repositories SmartDukaan

Rev

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

Rev 5974 Rev 5975
Line 6... Line 6...
6
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException, Discount
6
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException, Discount
7
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count, get_coupon_usage_count_by_user
7
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count, get_coupon_usage_count_by_user
8
from shop2020.clients.UserClient import UserClient
8
from shop2020.clients.UserClient import UserClient
9
 
9
 
10
def execute(cart, coupon_code, args):
10
def execute(cart, coupon_code, args):
11
    print "Amit is here"
-
 
12
    if 'items' not in args or 'discount' not in args or 'handset_display_name' not in args:
11
    if 'items' not in args or 'discount' not in args or 'handset_display_name' not in args:
13
        raise PromotionException(109, 'Error in rule arguments.')
12
        raise PromotionException(109, 'Error in rule arguments.')
14
        
13
        
15
    if 'usage_limit' in args and args['usage_limit'] is not None:
14
    if 'usage_limit' in args and args['usage_limit'] is not None:
16
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
15
        if args['usage_limit'] <= get_coupon_usage_count(coupon_code):
Line 28... Line 27...
28
    
27
    
29
    total_selling_price = 0
28
    total_selling_price = 0
30
    total_discounted_price = 0
29
    total_discounted_price = 0
31
    cart_has_specified_item = False
30
    cart_has_specified_item = False
32
    discounts = []
31
    discounts = []
33
    print "Amit is here too"
-
 
34
    for line in cart.lines:
32
    for line in cart.lines:
35
        total_selling_price += line.actualPrice * line.quantity
33
        total_selling_price += line.actualPrice * line.quantity
36
        discount_value = 0
34
        discount_value = 0
37
        
35
        
38
        if line.itemId in args['items']:
36
        if line.itemId in args['items']: