| Line 18... |
Line 18... |
| 18 |
|
18 |
|
| 19 |
|
19 |
|
| 20 |
if __name__ == '__main__' and __package__ is None:
|
20 |
if __name__ == '__main__' and __package__ is None:
|
| 21 |
import os
|
21 |
import os
|
| 22 |
sys.path.insert(0, os.getcwd())
|
22 |
sys.path.insert(0, os.getcwd())
|
| 23 |
|
- |
|
| - |
|
23 |
from shop2020.clients.HelperClient import HelperClient
|
| 24 |
from shop2020.thriftpy.model.v1.order.ttypes import RechargeOrderStatus,\
|
24 |
from shop2020.thriftpy.model.v1.order.ttypes import RechargeOrderStatus,\
|
| 25 |
OrderType
|
25 |
OrderType
|
| 26 |
from shop2020.model.v1.order.impl.DataAccessors import get_recharge_orders_for_status, update_recharge_order_status,\
|
26 |
from shop2020.model.v1.order.impl.DataAccessors import get_recharge_orders_for_status, update_recharge_order_status,\
|
| 27 |
update_recharge_transaction_status, get_next_invoice_number
|
27 |
update_recharge_transaction_status, get_next_invoice_number
|
| 28 |
from shop2020.model.v1.order.impl import DataService
|
28 |
from shop2020.model.v1.order.impl import DataService
|
| 29 |
from shop2020.model.v1.order.impl.DataService import RechargeTransaction, HotspotStore,\
|
29 |
from shop2020.model.v1.order.impl.DataService import RechargeTransaction, HotspotStore,\
|
| 30 |
WalletForCompany, WalletHistoryForCompany, RechargeCollection, Company
|
30 |
WalletForCompany, WalletHistoryForCompany, RechargeCollection, Company, HotspotServiceMatrix
|
| 31 |
from shop2020.model.v1.order.impl.model.RechargeOrder import RechargeOrder
|
31 |
from shop2020.model.v1.order.impl.model.RechargeOrder import RechargeOrder
|
| 32 |
from shop2020.model.v1.order.impl.RechargeService import checkTransactionStatus, getRefunds
|
32 |
from shop2020.model.v1.order.impl.RechargeService import checkTransactionStatus, getRefunds
|
| 33 |
|
33 |
|
| 34 |
|
34 |
|
| 35 |
def main():
|
35 |
def main():
|
| Line 191... |
Line 191... |
| 191 |
# if int(dt[0]) != wallet.amount:
|
191 |
# if int(dt[0]) != wallet.amount:
|
| 192 |
# mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Wallet amount: " + str(wallet.amount) + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])
|
192 |
# mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in"], "Wallet amount: " + str(wallet.amount) + " does not match with transaction amount: " + str(int(dt[0])) , "", [], [], [])
|
| 193 |
|
193 |
|
| 194 |
maildata = "<html><body><table border='1'><thead><th>StoreId</th><th>Gross</th><th>Discount</th><th>Net</th></thead><tbody>"
|
194 |
maildata = "<html><body><table border='1'><thead><th>StoreId</th><th>Gross</th><th>Discount</th><th>Net</th></thead><tbody>"
|
| 195 |
trecharge = 0
|
195 |
trecharge = 0
|
| - |
|
196 |
hotspotServiceMatrices = HotspotServiceMatrix.query.all()
|
| - |
|
197 |
hotspotServiceMatrixMap = {}
|
| - |
|
198 |
|
| - |
|
199 |
for hotspotServiceMatrix in hotspotServiceMatrices:
|
| - |
|
200 |
hotspotServiceMatrixMap[hotspotServiceMatrix.storeId] = hotspotServiceMatrix
|
| - |
|
201 |
|
| 196 |
for storeId in storeData.keys():
|
202 |
for storeId in storeData.keys():
|
| 197 |
store = HotspotStore.get_by(id = storeId)
|
203 |
store = HotspotStore.get_by(id = storeId)
|
| - |
|
204 |
if hotspotServiceMatrixMap.has_key(storeId):
|
| - |
|
205 |
del hotspotServiceMatrixMap[storeId]
|
| 198 |
store.collectedAmount = 0
|
206 |
store.collectedAmount = 0
|
| 199 |
store.availableLimit = store.creditLimit
|
207 |
store.availableLimit = store.creditLimit
|
| 200 |
session.commit()
|
208 |
session.commit()
|
| 201 |
|
209 |
|
| 202 |
data = storeData.get(storeId)
|
210 |
data = storeData.get(storeId)
|
| Line 225... |
Line 233... |
| 225 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","gagan.sharma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@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, [])
|
233 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","gagan.sharma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@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, [])
|
| 226 |
try:
|
234 |
try:
|
| 227 |
push_recharge_collection_to_ocr()
|
235 |
push_recharge_collection_to_ocr()
|
| 228 |
except:
|
236 |
except:
|
| 229 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", "", [])
|
237 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing recharge collection to OCR", "", [])
|
| - |
|
238 |
finally:
|
| - |
|
239 |
for storeId in hotspotServiceMatrixMap.keys():
|
| - |
|
240 |
if hotspotServiceMatrixMap.get(storeId).rechargeService:
|
| - |
|
241 |
store = HotspotStore.get_by(id = storeId)
|
| - |
|
242 |
helper_client = HelperClient().get_client()
|
| - |
|
243 |
helper_client.saveUserEmailForSending([store.clusterEmail], "cnc.center@shop2020.in", "No Recharge happened for store " + store.hotspotId + " yesterday", "", "NRM", "NoRechargeMail", [store.email], ["anupam.singh@shop2020.in"])
|
| - |
|
244 |
|
| 230 |
|
245 |
|
| 231 |
def push_recharge_collection_to_ocr():
|
246 |
def push_recharge_collection_to_ocr():
|
| 232 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
247 |
rcs = RechargeCollection.query.filter(RechargeCollection.pushedToOcr == False).all()
|
| 233 |
|
248 |
|
| 234 |
for rc in rcs:
|
249 |
for rc in rcs:
|
| Line 328... |
Line 343... |
| 328 |
maildata = ""
|
343 |
maildata = ""
|
| 329 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Saholic (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
344 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in"], "MIS :- Saholic (Date - " + todate.strftime("%d-%m-%Y") + ") (Wallet Amount - " + str(wallet.amount) + ") (Total Recharge - " + str(tamount) + ")", maildata, [])
|
| 330 |
|
345 |
|
| 331 |
|
346 |
|
| 332 |
if __name__ == '__main__':
|
347 |
if __name__ == '__main__':
|
| 333 |
main()
|
- |
|
| 334 |
|
348 |
main()
|
| - |
|
349 |
|
| - |
|
350 |
|
| 335 |
|
351 |
|