| Line 3433... |
Line 3433... |
| 3433 |
|
3433 |
|
| 3434 |
|
3434 |
|
| 3435 |
def allocate_gift_voucher(recharge_order):
|
3435 |
def allocate_gift_voucher(recharge_order):
|
| 3436 |
totalAmount = recharge_order.totalAmount
|
3436 |
totalAmount = recharge_order.totalAmount
|
| 3437 |
gvs = {}
|
3437 |
gvs = {}
|
| 3438 |
if totalAmount > 100:
|
3438 |
if totalAmount >= 100:
|
| 3439 |
totalAmount=500 if totalAmount > 500 else totalAmount
|
3439 |
totalAmount=500 if totalAmount >= 500 else totalAmount
|
| 3440 |
try:
|
3440 |
try:
|
| 3441 |
pc = PromotionClient().get_client()
|
3441 |
pc = PromotionClient().get_client()
|
| 3442 |
enddate = datetime.datetime.now() + datetime.timedelta(days=60)
|
3442 |
enddate = datetime.datetime.now() + datetime.timedelta(days=45)
|
| 3443 |
while totalAmount > 0:
|
3443 |
while totalAmount > 0:
|
| 3444 |
gvAmount = totalAmount if totalAmount < 250 else 250
|
3444 |
gvAmount = totalAmount if totalAmount <= 250 else 250
|
| 3445 |
totalAmount = totalAmount - gvAmount
|
3445 |
totalAmount = totalAmount - gvAmount
|
| 3446 |
gv = pc.createCoupon(26, to_java_date(enddate), recharge_order.userEmailId, gvAmount, 1)
|
3446 |
gv = pc.createCoupon(26, to_java_date(enddate), recharge_order.userEmailId, gvAmount, 1)
|
| 3447 |
gvs[gv] = gvAmount
|
3447 |
gvs[gv] = gvAmount
|
| 3448 |
except:
|
3448 |
except:
|
| 3449 |
print "Not able to create gift voucher for user " + recharge_order.userEmailId
|
3449 |
print "Not able to create gift voucher for user " + recharge_order.userEmailId
|
| Line 3708... |
Line 3708... |
| 3708 |
status = "Recharge Failed, Amount Refunded"
|
3708 |
status = "Recharge Failed, Amount Refunded"
|
| 3709 |
message = """
|
3709 |
message = """
|
| 3710 |
It seems operator could not process your recharge request. We are crediting the refund amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
3710 |
It seems operator could not process your recharge request. We are crediting the refund amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
| 3711 |
"""
|
3711 |
"""
|
| 3712 |
if len(gvs) > 0:
|
3712 |
if len(gvs) > 0:
|
| 3713 |
message = message + '<br /> You have been awarded with following Gift Voucher(s). You can redeem Gift Voucher(s) using to purchase any product above 5000.'
|
3713 |
message = message + '<br /> You have been awarded with following Gift Voucher(s). You can redeem Gift Voucher(s) to purchase any product for Rs. 5000 and above using credit/debit card and net banking. <a href="href="$source_url/static/giftvoucher-offer>More details</a>'
|
| 3714 |
message = message + " <br /> Voucher Code Amount"
|
3714 |
message = message + " <br /> <b>Voucher Code            Amount</b>"
|
| 3715 |
for gv in gvs.keys():
|
3715 |
for gv in gvs.keys():
|
| 3716 |
gvAmount = gvs.get(gv)
|
3716 |
gvAmount = gvs.get(gv)
|
| 3717 |
message = message + " <br /> " + gv + " " + gvAmount
|
3717 |
message = message + " <br /> <b>" + gv + "           Rs. " + str(gvAmount) + "</b>"
|
| 3718 |
|
3718 |
|
| 3719 |
message = message + '<br /> In case of any problem, please <a href="$source_url/contact-us">contact us</a>'
|
3719 |
message = message + '<br /> In case of any problem, please <a href="$source_url/contact-us">contact us</a>'
|
| 3720 |
|
3720 |
|
| 3721 |
html_header = html_header + message
|
3721 |
html_header = html_header + message
|
| 3722 |
html_footer = """
|
3722 |
html_footer = """
|