| Line 767... |
Line 767... |
| 767 |
max_discount = min(max_discount, order.lineitems[0].unit_price/10)
|
767 |
max_discount = min(max_discount, order.lineitems[0].unit_price/10)
|
| 768 |
discount = min(round(max_discount),delayedDays*50)
|
768 |
discount = min(round(max_discount),delayedDays*50)
|
| 769 |
promotion_client = PromotionClient().get_client()
|
769 |
promotion_client = PromotionClient().get_client()
|
| 770 |
endOn = order.delivery_timestamp + datetime.timedelta(days = 30)
|
770 |
endOn = order.delivery_timestamp + datetime.timedelta(days = 30)
|
| 771 |
endOn = to_java_date(endOn)
|
771 |
endOn = to_java_date(endOn)
|
| 772 |
arguments = "{\"endOn\":" + str(endOn) + ", \"emails\":[\"" + order.customer_email + "\"], \"couponType\":\"both\", \"discount\":" + str(discount) + "}"
|
772 |
arguments = "{\"endOn\":" + str(endOn) + ", \"emails\":[\"" + order.customer_email + "\"], \"couponType\":\"both\", \"usage_limit_for_user\":1, \"isCod\":False, \"discount\":" + str(discount) + "}"
|
| 773 |
otgCoupon = promotion_client.createCoupon(28, arguments, False, "otg")
|
773 |
otgCoupon = promotion_client.createCoupon(28, arguments, False, "otg")
|
| 774 |
thank_you_html = '$prodName ordered by you has been delivered. We apologise for a delay of $delayedDays business days. As per our <b>On Time Guarantee</b> you have won a Gift Voucher worth <b>Rs.$discount</b>. Your unique Gift Voucher Code is <b>$otgCoupon</b>. You can use the same to buy any Mobile, Camera, Laptop, Tablet, Accessory or Mobile/DTH Recharge from our website.'
|
774 |
thank_you_html = '$prodName ordered by you has been delivered. We apologise for a delay of $delayedDays business days. As per our <b>On Time Guarantee</b> you have won a Gift Voucher worth <b>Rs.$discount</b>. Your unique Gift Voucher Code is <b>$otgCoupon</b>. You can use the same to buy any Mobile, Camera, Laptop, Tablet, Accessory or Mobile/DTH Recharge from our website.'
|
| 775 |
thank_you_html = Template(thank_you_html).substitute(dict(prodName=order.lineitems[0], delayedDays = delayedDays, discount = discount, otgCoupon = otgCoupon))
|
775 |
thank_you_html = Template(thank_you_html).substitute(dict(prodName=order.lineitems[0], delayedDays = delayedDays, discount = discount, otgCoupon = otgCoupon))
|
| 776 |
elif fda:
|
776 |
elif fda:
|
| 777 |
fdaFormattedString = order.first_dlvyatmp_timestamp.strftime("%A, %d. %B %Y")
|
777 |
fdaFormattedString = order.first_dlvyatmp_timestamp.strftime("%A, %d. %B %Y")
|