Subversion Repositories SmartDukaan

Rev

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

Rev 3713 Rev 4155
Line 3... Line 3...
3
 
3
 
4
@author: Varun Gupta
4
@author: Varun Gupta
5
 
5
 
6
Max uses: 100
6
Max uses: 100
7
 
7
 
-
 
8
Apple 16GB iPad 2 Wi-Fi+3G Rs.900 off
-
 
9
Apple 32GB iPad 2 Wi-Fi+3G Rs.900 off
-
 
10
Apple 64GB iPad 2 Wi-Fi+3G Rs.900 off
8
BB Playbook 16GB     1090 off
11
BlackBerry playbook 32gb Rs.250 off
9
BB Playbook 64GB     1690 off
12
BlackBerry playbook 64gb Rs.2500 off
10
HTC P510e Flyer     500 off
13
HTC P510e Flyer Rs.500 off
11
Motorola Xoom WiFi 3G     1700 off
14
Motorola MZ601 Xoom Rs.2000 off
-
 
15
Samsung N7000 Galaxy Note Rs.2500 off
-
 
16
Samsung P7300 Tablet 8.9" Rs.1500 off
12
Samsung P7500 Galaxy Tab     2500 off
17
Samsung P7500 Galaxy Tab 750 Rs.1800 off
13
Spice Mi-720 Tab     1500 off
18
Spice Mi-720 Tab Rs.1200 off
14
'''
19
'''
15
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException, Discount
20
from shop2020.thriftpy.model.v1.user.ttypes import PromotionException, Discount
16
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count, get_coupon_usage_count_by_user
21
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count, get_coupon_usage_count_by_user
17
from shop2020.clients.CatalogClient import CatalogClient
22
from shop2020.clients.CatalogClient import CatalogClient
18
 
23
 
Line 35... Line 40...
35
        for line in cart.lines:
40
        for line in cart.lines:
36
            
41
            
37
            line.discountedPrice = line.actualPrice
42
            line.discountedPrice = line.actualPrice
38
            discount_value = 0
43
            discount_value = 0
39
            
44
            
40
            if line.itemId == 1543:  #Playbook 16GB
45
            if line.itemId in [2177, 2178, 2179, 2180, 2181, 2182]:  #iPad 16GB, iPad 32GB, iPad 64GB
41
                
46
                
42
                has_qualified_model = True
47
                has_qualified_model = True
43
                
48
                
44
                if line.actualPrice:
49
                if line.actualPrice:
45
                    line.discountedPrice = line.actualPrice - 1090
50
                    line.discountedPrice = line.actualPrice - 900
46
                    discount_value = 1090
51
                    discount_value = 900
47
            
52
            
48
            elif line.itemId == 1550:   #Playbook 64GB
53
            elif line.itemId == 2199:   #BlackBerry PlayBook 32GB
49
                
54
                
50
                has_qualified_model = True
55
                has_qualified_model = True
51
                
56
                
52
                if line.actualPrice:
57
                if line.actualPrice:
53
                    line.discountedPrice = line.actualPrice - 1690
58
                    line.discountedPrice = line.actualPrice - 250
54
                    discount_value = 1690
59
                    discount_value = 250
55
            
60
            
-
 
61
            elif line.itemId == 1550:   #BlackBerry PlayBook 64GB
-
 
62
                
-
 
63
                has_qualified_model = True
-
 
64
                
-
 
65
                if line.actualPrice:
-
 
66
                    line.discountedPrice = line.actualPrice - 2500
-
 
67
                    discount_value = 2500
-
 
68
            
56
            elif line.itemId == 1551:   #HTC Flyer P510e
69
            elif line.itemId == 1551:   #HTC P510e Flyer
57
                
70
                
58
                has_qualified_model = True
71
                has_qualified_model = True
59
                
72
                
60
                if line.actualPrice:
73
                if line.actualPrice:
61
                    line.discountedPrice = line.actualPrice - 500
74
                    line.discountedPrice = line.actualPrice - 500
62
                    discount_value = 500
75
                    discount_value = 500
63
            
76
            
64
            elif line.itemId == 1552:   #Motorola Xoom WiFi 3G
77
            elif line.itemId == 1552:   #Motorola MZ601 Xoom
65
                
78
                
66
                has_qualified_model = True
79
                has_qualified_model = True
67
                
80
                
68
                if line.actualPrice:
81
                if line.actualPrice:
69
                    line.discountedPrice = line.actualPrice - 1700
82
                    line.discountedPrice = line.actualPrice - 2000
70
                    discount_value = 1700
83
                    discount_value = 2000
71
            
84
            
72
            elif line.itemId == 2005:   #Samsung P7500 Galaxy Tab
85
            elif line.itemId == 2215:   #Samsung N7000 Galaxy Note
73
                
86
                
74
                has_qualified_model = True
87
                has_qualified_model = True
75
                
88
                
76
                if line.actualPrice:
89
                if line.actualPrice:
77
                    line.discountedPrice = line.actualPrice - 2500
90
                    line.discountedPrice = line.actualPrice - 2500
78
                    discount_value = 2500
91
                    discount_value = 2500
79
            
92
            
80
            elif line.itemId == 2022:   #Spice Mi-720 Tab
93
            elif line.itemId == 2230:   #Samsung P7300 Galaxy Tab
81
                
94
                
82
                has_qualified_model = True
95
                has_qualified_model = True
83
                
96
                
84
                if line.actualPrice:
97
                if line.actualPrice:
85
                    line.discountedPrice = line.actualPrice - 1500
98
                    line.discountedPrice = line.actualPrice - 1500
86
                    discount_value = 1500
99
                    discount_value = 1500
87
            
100
            
-
 
101
            elif line.itemId == 2005:   #Samsung P7500 Galaxy Tab
-
 
102
                
-
 
103
                has_qualified_model = True
-
 
104
                
-
 
105
                if line.actualPrice:
-
 
106
                    line.discountedPrice = line.actualPrice - 1700
-
 
107
                    discount_value = 1700
-
 
108
            
-
 
109
            elif line.itemId == 2022:   #Spice Mi-720 Tab
-
 
110
                
-
 
111
                has_qualified_model = True
-
 
112
                
-
 
113
                if line.actualPrice:
-
 
114
                    line.discountedPrice = line.actualPrice - 1200
-
 
115
                    discount_value = 1200
-
 
116
            
88
            total_selling_price += line.actualPrice * line.quantity
117
            total_selling_price += line.actualPrice * line.quantity
89
            total_discounted_price += line.discountedPrice * line.quantity
118
            total_discounted_price += line.discountedPrice * line.quantity
90
        
119
        
91
            if discount_value > 0:
120
            if discount_value > 0:
92
                discount = Discount()
121
                discount = Discount()