| Line 74... |
Line 74... |
| 74 |
discount1.discount = 0
|
74 |
discount1.discount = 0
|
| 75 |
discounts.append(discount1)
|
75 |
discounts.append(discount1)
|
| 76 |
discount1.discount += round(200/discount1.quantity, 0)
|
76 |
discount1.discount += round(200/discount1.quantity, 0)
|
| 77 |
cart.discountedPrice -= round(200/discount1.quantity, 0)*discount1.quantity
|
77 |
cart.discountedPrice -= round(200/discount1.quantity, 0)*discount1.quantity
|
| 78 |
else:
|
78 |
else:
|
| 79 |
if cart.totalPrice >= 1999:
|
- |
|
| 80 |
counter = privateDealUser.counter
|
79 |
counter = privateDealUser.counter
|
| 81 |
if counter is not None:
|
- |
|
| 82 |
if datetime.datetime.now() - counter.createdOn < datetime.timedelta(30) and counter.lastPurchasedOn is None:
|
80 |
if cart.totalPrice >= 1999 and counter is not None and datetime.datetime.now() - counter.createdOn < datetime.timedelta(30) and counter.lastPurchasedOn is None:
|
| 83 |
firstLine = cart.lines[0]
|
81 |
firstLine = cart.lines[0]
|
| 84 |
discount1 = Discount()
|
82 |
discount1 = Discount()
|
| 85 |
discount1.cart_id = cart.id
|
83 |
discount1.cart_id = cart.id
|
| 86 |
discount1.item_id = firstLine.itemId
|
84 |
discount1.item_id = firstLine.itemId
|
| 87 |
discount1.quantity = firstLine.quantity
|
85 |
discount1.quantity = firstLine.quantity
|
| 88 |
discount1.discount = 0
|
86 |
discount1.discount = 0
|
| 89 |
discounts.append(discount1)
|
87 |
discount1.discount += round(200/discount1.quantity, 0)
|
| 90 |
discount1.discount += round(200/discount1.quantity, 0)
|
88 |
discounts.append(discount1)
|
| 91 |
cart.discountedPrice = cart.totalPrice - discount1.discount*discount1.quantity
|
89 |
cart.discountedPrice = cart.totalPrice - discount1.discount*discount1.quantity
|
| 92 |
else:
|
90 |
else:
|
| 93 |
raise PromotionException(115, 'None of the products have valid Private Deal')
|
91 |
raise PromotionException(115, 'None of the products have valid Private Deal')
|
| 94 |
|
92 |
|
| 95 |
return cart, discounts
|
93 |
return cart, discounts
|
| 96 |
else:
|
94 |
else:
|