| Line 20... |
Line 20... |
| 20 |
from shop2020.utils.Utils import to_java_date, to_py_date
|
20 |
from shop2020.utils.Utils import to_java_date, to_py_date
|
| 21 |
from shop2020.clients.PaymentClient import PaymentClient
|
21 |
from shop2020.clients.PaymentClient import PaymentClient
|
| 22 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
22 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
| 23 |
|
23 |
|
| 24 |
from shop2020.clients.TransactionClient import TransactionClient
|
24 |
from shop2020.clients.TransactionClient import TransactionClient
|
| - |
|
25 |
import sys
|
| 25 |
|
26 |
|
| 26 |
|
27 |
|
| 27 |
if __name__ == '__main__' and __package__ is None:
|
28 |
if __name__ == '__main__' and __package__ is None:
|
| 28 |
import os
|
29 |
import os
|
| 29 |
sys.path.insert(0, os.getcwd())
|
30 |
sys.path.insert(0, os.getcwd())
|
| Line 88... |
Line 89... |
| 88 |
if options.authorized:
|
89 |
if options.authorized:
|
| 89 |
processAuthorizedTransactions(options.txn_id)
|
90 |
processAuthorizedTransactions(options.txn_id)
|
| 90 |
if options.collection:
|
91 |
if options.collection:
|
| 91 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == 3).one()
|
92 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == 3).one()
|
| 92 |
oldBalance = wallet.amount
|
93 |
oldBalance = wallet.amount
|
| - |
|
94 |
try:
|
| - |
|
95 |
newBalance = getBalance()
|
| - |
|
96 |
except:
|
| 93 |
newBalance = getBalance()
|
97 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.gupta@saholic.com", "kshitij.sood@saholic.com", "manoj.bajaj@spiceretail.co.in","amit.tyagi@spiceretail.co.in","pradeep.panwar@spiceretail.co.in"], "Unable to fetch balance from spice digital api.Collection not created.", "", [])
|
| - |
|
98 |
sys.exit(1)
|
| 94 |
wallet.amount = newBalance
|
99 |
wallet.amount = newBalance
|
| 95 |
session.commit()
|
100 |
session.commit()
|
| 96 |
|
101 |
|
| 97 |
d = datetime.datetime.now()
|
102 |
d = datetime.datetime.now()
|
| 98 |
d = d + timedelta(days = -1)
|
103 |
d = d + timedelta(days = -1)
|
| Line 515... |
Line 520... |
| 515 |
wamt = int(dit2[0])- int(dit[0])
|
520 |
wamt = int(dit2[0])- int(dit[0])
|
| 516 |
wallet.amount = wamt
|
521 |
wallet.amount = wamt
|
| 517 |
session.commit()
|
522 |
session.commit()
|
| 518 |
|
523 |
|
| 519 |
maildata += "</tbody></table></body></html>"
|
524 |
maildata += "</tbody></table></body></html>"
|
| 520 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["kshitij.sood@shop2020.in","pardeep.panwar@spiceretail.co.in","adarsh.verma@spiceretail.co.in","j.p.gupta@shop2020.in", "amit.tyagi@spiceretail.co.in"], "MIS :- SpiceRetail (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(trecharge) + ")", maildata, [])
|
525 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.gupta@saholic.com", "kshitij.sood@saholic.com", "manoj.bajaj@spiceretail.co.in","amit.tyagi@spiceretail.co.in","pradeep.panwar@spiceretail.co.in"], "MIS :- SpiceRetail (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(trecharge) + ")", maildata, [])
|
| 521 |
try:
|
526 |
try:
|
| 522 |
push_recharge_collection_to_ocr()
|
527 |
push_recharge_collection_to_ocr()
|
| 523 |
except:
|
528 |
except:
|
| 524 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["anikendra.das@saholic.com", "kshitij.sood@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", "", [])
|
529 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.gupta@saholic.com", "kshitij.sood@saholic.com", "manoj.bajaj@spiceretail.co.in","amit.tyagi@spiceretail.co.in","pradeep.panwar@spiceretail.co.in"], "Problem while pushing recharge collection to OCR", "", [])
|
| 525 |
finally:
|
530 |
finally:
|
| 526 |
msg = "<html><body>"
|
531 |
msg = "<html><body>"
|
| 527 |
for storeId in hotspotServiceMatrixMap.keys():
|
532 |
for storeId in hotspotServiceMatrixMap.keys():
|
| 528 |
if hotspotServiceMatrixMap.get(storeId).rechargeService:
|
533 |
if hotspotServiceMatrixMap.get(storeId).rechargeService:
|
| 529 |
store = HotspotStore.get_by(id = storeId)
|
534 |
store = HotspotStore.get_by(id = storeId)
|
| 530 |
msg = msg + str(store.hotspotId) + ' - ' + str(store.email) + '<br>'
|
535 |
msg = msg + str(store.hotspotId) + ' - ' + str(store.email) + '<br>'
|
| 531 |
msg = msg + '</body></html>'
|
536 |
msg = msg + '</body></html>'
|
| 532 |
helper_client = HelperClient().get_client()
|
537 |
helper_client = HelperClient().get_client()
|
| 533 |
helper_client.saveUserEmailForSending(["adarsh.verma@spiceretail.co.in"], "cnc.center@shop2020.in", "No Recharge happened for these stores on " + str(date.today()-timedelta(days=1)), msg, "NRM", "NoRechargeMail", ["kshitij.sood@shop2020.in"], ["kshitij.sood@shop2020.in"], 1)
|
538 |
helper_client.saveUserEmailForSending(["manoj.bajaj@spiceretail.co.in"], "cnc.center@shop2020.in", "No Recharge happened for these stores on " + str(date.today()-timedelta(days=1)), msg, "NRM", "NoRechargeMail", ["kshitij.sood@shop2020.in"], ["kshitij.sood@shop2020.in"], 1)
|
| 534 |
|
539 |
|
| 535 |
|
540 |
|
| 536 |
|
541 |
|
| 537 |
def push_recharge_collection_to_ocr():
|
542 |
def push_recharge_collection_to_ocr():
|
| 538 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
543 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
| Line 632... |
Line 637... |
| 632 |
wallet.amount = wallet.amount - tamount
|
637 |
wallet.amount = wallet.amount - tamount
|
| 633 |
session.commit()
|
638 |
session.commit()
|
| 634 |
|
639 |
|
| 635 |
|
640 |
|
| 636 |
maildata = ""
|
641 |
maildata = ""
|
| 637 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "anikendra.das@saholic.com", "kshitij.sood@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Saholic (Date - " + startTime.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
642 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.gupta@saholic.com", "kshitij.sood@saholic.com", "manoj.bajaj@spiceretail.co.in","amit.tyagi@spiceretail.co.in","pradeep.panwar@spiceretail.co.in"], "MIS :- Saholic (Date - " + startTime.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
| 638 |
|
643 |
|
| 639 |
rAmount = 0
|
644 |
rAmount = 0
|
| 640 |
ramount = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.transactionTime >= startTime).filter(WalletHistoryForCompany.amount >= 100000).one()
|
645 |
ramount = session.query(func.sum(WalletHistoryForCompany.amount)).filter(WalletHistoryForCompany.transactionTime >= startTime).filter(WalletHistoryForCompany.amount >= 100000).one()
|
| 641 |
if ramount[0]:
|
646 |
if ramount[0]:
|
| 642 |
rAmount = int(ramount[0])
|
647 |
rAmount = int(ramount[0])
|
| 643 |
rcs = session.query(func.sum(RechargeCollection.grossAmount)).filter(RechargeCollection.reconDate == int(startTime.strftime("%Y%m%d"))).one()
|
648 |
rcs = session.query(func.sum(RechargeCollection.grossAmount)).filter(RechargeCollection.reconDate == int(startTime.strftime("%Y%m%d"))).one()
|
| 644 |
hamount = int(rcs[0])
|
649 |
hamount = int(rcs[0])
|
| 645 |
|
650 |
|
| 646 |
maildata = "(A) Old Wallet Amount is : " + str(oldBalance) + "<br>(B) New Wallet Amount is : " + str(newBalance) + "<br>(C) Recharge Amount is : " + str(rAmount) + "<br>---------------------------<br>(D) Total Debit Amount for Recharge(A-B+C) is : " + str(oldBalance - newBalance + rAmount) + "<br><br><br>(E) Saholic Recharge Amount is :" + str(tamount) + "<br>(F) Hotspot Recharge Amount is :" + str(hamount) + "<br>---------------------------<br>(G) Total Recharge Amount (E+F) is : " + str(tamount + hamount)
|
651 |
maildata = "(A) Old Wallet Amount is : " + str(oldBalance) + "<br>(B) New Wallet Amount is : " + str(newBalance) + "<br>(C) Recharge Amount is : " + str(rAmount) + "<br>---------------------------<br>(D) Total Debit Amount for Recharge(A-B+C) is : " + str(oldBalance - newBalance + rAmount) + "<br><br><br>(E) Saholic Recharge Amount is :" + str(tamount) + "<br>(F) Hotspot Recharge Amount is :" + str(hamount) + "<br>---------------------------<br>(G) Total Recharge Amount (E+F) is : " + str(tamount + hamount)
|
| 647 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.tyagi@spiceretail.co.in", "karanpanchal@spiceretail.co.in", "kshitij.sood@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Wallet and Recharge (Date - " + startTime.strftime("%d-%m-%Y") + ")", maildata, [])
|
652 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["amit.gupta@saholic.com", "kshitij.sood@saholic.com", "manoj.bajaj@spiceretail.co.in","amit.tyagi@spiceretail.co.in","pradeep.panwar@spiceretail.co.in"], "MIS :- Wallet and Recharge (Date - " + startTime.strftime("%d-%m-%Y") + ")", maildata, [])
|
| 648 |
|
653 |
|
| 649 |
if __name__ == '__main__':
|
654 |
if __name__ == '__main__':
|
| 650 |
main()
|
655 |
main()
|
| 651 |
|
656 |
|