| Line 691... |
Line 691... |
| 691 |
def enqueue_transaction_info_email(transaction_id):
|
691 |
def enqueue_transaction_info_email(transaction_id):
|
| 692 |
transaction = get_transaction(transaction_id)
|
692 |
transaction = get_transaction(transaction_id)
|
| 693 |
|
693 |
|
| 694 |
#Dear Customer, thanks for placing order of Spice Stellar Mi-535 Black and 5 other items amounting Rs. 25000. Check your email for details.
|
694 |
#Dear Customer, thanks for placing order of Spice Stellar Mi-535 Black and 5 other items amounting Rs. 25000. Check your email for details.
|
| 695 |
|
695 |
|
| 696 |
smsText = "Dear Customer, thanks for placing order of "
|
696 |
smsText = "Dear Customer, Thanks for placing order of "
|
| 697 |
mobileNo = None
|
697 |
mobileNo = None
|
| 698 |
customerId = 0
|
698 |
customerId = 0
|
| 699 |
sendSms = True
|
699 |
sendSms = True
|
| 700 |
transactionAmount = 0.0
|
700 |
transactionAmount = 0.0
|
| 701 |
orderQuantity = 0
|
701 |
orderQuantity = 0
|
| - |
|
702 |
totalQuantity = 0
|
| - |
|
703 |
itemQuantityMap = {}
|
| - |
|
704 |
itemNameMap = {}
|
| - |
|
705 |
oneProduct = ""
|
| 702 |
|
706 |
|
| 703 |
subject = source_name + " - Order Details"
|
707 |
subject = source_name + " - Order Details"
|
| 704 |
orders = transaction.orders
|
708 |
orders = transaction.orders
|
| 705 |
advance_amount = orders[0].advanceAmount
|
709 |
advance_amount = orders[0].advanceAmount
|
| 706 |
saddress = ""
|
710 |
saddress = ""
|
| Line 708... |
Line 712... |
| 708 |
for order in orders:
|
712 |
for order in orders:
|
| 709 |
if order.pickupStoreId:
|
713 |
if order.pickupStoreId:
|
| 710 |
sendSms= False
|
714 |
sendSms= False
|
| 711 |
transactionAmount = transactionAmount + order.total_amount
|
715 |
transactionAmount = transactionAmount + order.total_amount
|
| 712 |
for lineitem in order.lineitems:
|
716 |
for lineitem in order.lineitems:
|
| - |
|
717 |
if itemQuantityMap.has_key(lineitem.item_id):
|
| - |
|
718 |
quantity = itemQuantityMap.get(lineitem.item_id)
|
| 713 |
orderQuantity = orderQuantity + lineitem.quantity
|
719 |
quantity = quantity + lineitem.quantity
|
| 714 |
|
- |
|
| 715 |
oneProduct = str(orders[0].lineitems[0])
|
720 |
itemQuantityMap[lineitem.item_id] = quantity
|
| 716 |
|
721 |
else:
|
| 717 |
smsText = smsText + oneProduct
|
722 |
itemQuantityMap[lineitem.item_id] = lineitem.quantity
|
| 718 |
|
723 |
|
| 719 |
orderQuantity = orderQuantity - 1
|
724 |
if not itemNameMap.has_key(lineitem.item_id):
|
| - |
|
725 |
itemNameMap[lineitem.item_id] = str(lineitem)
|
| 720 |
|
726 |
|
| - |
|
727 |
if len(itemNameMap) == 1:
|
| - |
|
728 |
for itemId, itemName in itemNameMap.iteritems():
|
| - |
|
729 |
oneProduct = itemName
|
| - |
|
730 |
orderQuantity = itemQuantityMap.get(itemId)
|
| - |
|
731 |
if len(oneProduct) > 30:
|
| - |
|
732 |
oneProduct = oneProduct[0:28]+"..."
|
| - |
|
733 |
smsText = smsText + oneProduct +". Total "+ str(long(orderQuantity)) +"pc(s), amount Rs " + str(long(transactionAmount))
|
| - |
|
734 |
|
| - |
|
735 |
if len(itemNameMap) >1:
|
| - |
|
736 |
for itemId, itemName in itemNameMap.iteritems():
|
| - |
|
737 |
oneProduct = itemName
|
| - |
|
738 |
totalQuantity = totalQuantity + itemQuantityMap.get(lineitem.item_id)
|
| - |
|
739 |
itemQuantityMap.pop(lineitem.item_id)
|
| - |
|
740 |
break
|
| - |
|
741 |
for itemId, quantity in itemQuantityMap.iteritems():
|
| 721 |
if orderQuantity !=0 and orderQuantity >0:
|
742 |
orderQuantity = orderQuantity + quantity
|
| 722 |
smsText = smsText + " and " + str(orderQuantity) + " other items"
|
743 |
totalQuantity = totalQuantity + quantity
|
| - |
|
744 |
|
| - |
|
745 |
if len(oneProduct) > 30:
|
| - |
|
746 |
oneProduct = oneProduct[0:28]+"..."
|
| - |
|
747 |
|
| - |
|
748 |
smsText = smsText + oneProduct +" and "+str(long(orderQuantity))+ " other item(s). Total " + str(long(totalQuantity)) +"pcs, amount Rs "+ str(long(transactionAmount))
|
| 723 |
|
749 |
|
| 724 |
smsText = smsText +" amounting Rs. "+str(transactionAmount)+ ". Check your email for details."
|
750 |
smsText = smsText + ". Check your email for details."
|
| 725 |
|
751 |
|
| 726 |
bcc = []
|
752 |
bcc = []
|
| 727 |
if advance_amount > 0:
|
753 |
if advance_amount > 0:
|
| 728 |
store = get_hotspot_store(orders[0].storeId, "")
|
754 |
store = get_hotspot_store(orders[0].storeId, "")
|
| 729 |
bcc = bcc + store.approvalEmail.split(';') + [store.email, "amit.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.sirohi@shop2020.in"]
|
755 |
bcc = bcc + store.approvalEmail.split(';') + [store.email, "amit.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.sirohi@shop2020.in"]
|
| Line 906... |
Line 932... |
| 906 |
email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
|
932 |
email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
|
| 907 |
|
933 |
|
| 908 |
try:
|
934 |
try:
|
| 909 |
helper_client = HelperClient().get_client()
|
935 |
helper_client = HelperClient().get_client()
|
| 910 |
helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
|
936 |
helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
|
| 911 |
'''
|
937 |
|
| 912 |
if sendSms:
|
938 |
if sendSms:
|
| 913 |
send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)
|
939 |
send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)
|
| 914 |
'''
|
940 |
|
| 915 |
return True
|
941 |
return True
|
| 916 |
except Exception as e:
|
942 |
except Exception as e:
|
| 917 |
print e
|
943 |
print e
|
| 918 |
return False
|
944 |
return False
|
| 919 |
|
945 |
|