| Line 761... |
Line 761... |
| 761 |
thank_you_html = """As Promised """ + str(order.lineitems[0]) +""" ordered by you has been <b>Delivered On Time.</b>"""
|
761 |
thank_you_html = """As Promised """ + str(order.lineitems[0]) +""" ordered by you has been <b>Delivered On Time.</b>"""
|
| 762 |
elif delayed:
|
762 |
elif delayed:
|
| 763 |
max_discount = 500
|
763 |
max_discount = 500
|
| 764 |
delayedDays = get_business_days_count(order.expected_delivery_time, fda_datetime)
|
764 |
delayedDays = get_business_days_count(order.expected_delivery_time, fda_datetime)
|
| 765 |
max_discount = min(max_discount, order.lineitems[0].unit_price/10)
|
765 |
max_discount = min(max_discount, order.lineitems[0].unit_price/10)
|
| 766 |
discount = min(max_discount,delayedDays*50)
|
766 |
discount = min(round(max_discount),delayedDays*50)
|
| 767 |
promotion_client = PromotionClient().get_client()
|
767 |
promotion_client = PromotionClient().get_client()
|
| 768 |
endOn = order.delivery_timestamp + datetime.timedelta(days = 30)
|
768 |
endOn = order.delivery_timestamp + datetime.timedelta(days = 30)
|
| 769 |
endOn = to_java_date(endOn)
|
769 |
endOn = to_java_date(endOn)
|
| 770 |
arguments = "{\"endOn\":" + str(endOn) + ", \"email\":\"" + order.customer_email + "\", \"couponType\":\"physical\", \"discount\":" + str(discount) + "}"
|
770 |
arguments = "{\"endOn\":" + str(endOn) + ", \"emails\":[\"" + order.customer_email + "\"], \"couponType\":\"both\", \"discount\":" + str(discount) + "}"
|
| 771 |
otgCoupon = promotion_client.createCoupon(28, arguments, False, "otg")
|
771 |
otgCoupon = promotion_client.createCoupon(28, arguments, False, "otg")
|
| 772 |
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.'
|
772 |
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.'
|
| 773 |
thank_you_html = Template(thank_you_html).substitute(dict(prodName=order.lineitems[0], delayedDays = delayedDays, discount = discount, otgCoupon = otgCoupon))
|
773 |
thank_you_html = Template(thank_you_html).substitute(dict(prodName=order.lineitems[0], delayedDays = delayedDays, discount = discount, otgCoupon = otgCoupon))
|
| 774 |
elif fda:
|
774 |
elif fda:
|
| 775 |
fdaFormattedString = order.first_dlvyatmp_timestamp.strftime("%A, %d. %B %Y")
|
775 |
fdaFormattedString = order.first_dlvyatmp_timestamp.strftime("%A, %d. %B %Y")
|