Subversion Repositories SmartDukaan

Rev

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

Rev 4327 Rev 4405
Line 1... Line 1...
1
'''
1
'''
2
Created on 06-Dec-2011
2
Created on 06-Dec-2011
3
 
3
 
4
@author: varungupta
4
@author: varungupta
5
'''
-
 
6
 
-
 
7
'''
-
 
8
Created on 24-Oct-2011
-
 
9
 
-
 
10
@author: Varun Gupta
-
 
11
 
5
 
12
raghvendra.saboo@gmail.com will get Rs.200 off on one transaction.
6
raghvendra.saboo@gmail.com will get Rs.200 off on one transaction
13
nishantgandhi@yahoo.com will get Rs.500 off on one transaction.
7
michaelananth.ravichandran@tcs.com will get Rs.200 off on one transaction
14
'''
8
'''
15
 
9
 
16
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException
10
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException
17
from shop2020.clients.UserClient import UserClient
11
from shop2020.clients.UserClient import UserClient
18
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count_by_user
12
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count_by_user
Line 23... Line 17...
23
    user_client = UserClient().get_client()
17
    user_client = UserClient().get_client()
24
    user = user_client.getUserById(cart.userId)
18
    user = user_client.getUserById(cart.userId)
25
    
19
    
26
    email = user.email.lower().strip()
20
    email = user.email.lower().strip()
27
    
21
    
28
    if email == 'raghvendra.saboo@gmail.com':
22
    if email in ('raghvendra.saboo@gmail.com', 'michaelananth.ravichandran@tcs.com'):
29
        discount_value = 200
23
        discount_value = 200
30
    elif email == 'nishantgandhi@yahoo.com':
-
 
31
        discount_value = 500
-
 
32
    elif email == 'akshay.karandikar@rocketmail.com':
-
 
33
        discount_value = 250
-
 
34
    elif email == 'mis@birla.ac.in':
-
 
35
        discount_value = 1889
-
 
36
    else:
24
    else:
37
        raise PromotionException(111, 'You are not allowed to use this coupon')
25
        raise PromotionException(111, 'You are not allowed to use this coupon')
38
    
26
    
39
    #Allow only first 1000 users to use the coupon
27
    #Allow only first 1000 users to use the coupon
40
    count_coupon_usage = get_coupon_usage_count_by_user(coupon_code, cart.userId)
28
    count_coupon_usage = get_coupon_usage_count_by_user(coupon_code, cart.userId)