| Line 27... |
Line 27... |
| 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, HotspotServiceMatrix
|
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, getBalance
|
| 33 |
|
33 |
|
| 34 |
|
34 |
|
| 35 |
def main():
|
35 |
def main():
|
| 36 |
parser = optparse.OptionParser()
|
36 |
parser = optparse.OptionParser()
|
| 37 |
parser.add_option("-H", "--host", dest="hostname",
|
37 |
parser.add_option("-H", "--host", dest="hostname",
|
| Line 68... |
Line 68... |
| 68 |
if options.unknown:
|
68 |
if options.unknown:
|
| 69 |
processUnknownTransactions()
|
69 |
processUnknownTransactions()
|
| 70 |
if options.authorized:
|
70 |
if options.authorized:
|
| 71 |
processAuthorizedTransactions(options.txn_id)
|
71 |
processAuthorizedTransactions(options.txn_id)
|
| 72 |
if options.collection:
|
72 |
if options.collection:
|
| - |
|
73 |
wallet = WalletForCompany.query.filter(WalletForCompany.id == 3).one()
|
| - |
|
74 |
oldBalance = wallet.amount
|
| - |
|
75 |
newBalance = getBalance()
|
| - |
|
76 |
wallet.amount = newBalance
|
| - |
|
77 |
session.commit()
|
| - |
|
78 |
|
| 73 |
d = datetime.datetime.now()
|
79 |
d = datetime.datetime.now()
|
| 74 |
d = d + timedelta(days = -1)
|
80 |
d = d + timedelta(days = -1)
|
| 75 |
compute_recharge_collection(d)
|
81 |
compute_recharge_collection(d)
|
| 76 |
compute_website_recharge_collection(d)
|
82 |
compute_website_recharge_collection(d, oldBalance, newBalance)
|
| 77 |
if options.topup:
|
83 |
if options.topup:
|
| 78 |
topup_company_wallet(1,100000)
|
84 |
topup_company_wallet(1,100000)
|
| 79 |
|
85 |
|
| 80 |
def processRefunds():
|
86 |
def processRefunds():
|
| 81 |
todate = datetime.datetime.now()
|
87 |
todate = datetime.datetime.now()
|
| Line 307... |
Line 313... |
| 307 |
|
313 |
|
| 308 |
wallet.amount += amount
|
314 |
wallet.amount += amount
|
| 309 |
session.commit()
|
315 |
session.commit()
|
| 310 |
mail("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"] , company.name + " wallet topped up by " + str(amount) + " rupees.", "", [], [], [])
|
316 |
mail("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"] , company.name + " wallet topped up by " + str(amount) + " rupees.", "", [], [], [])
|
| 311 |
|
317 |
|
| 312 |
def compute_website_recharge_collection(cdate):
|
318 |
def compute_website_recharge_collection(cdate, oldBalance, newBalance):
|
| 313 |
todate = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
319 |
todate = datetime.datetime(cdate.year, cdate.month, cdate.day)
|
| 314 |
tomorrow = todate + timedelta(days=1)
|
320 |
tomorrow = todate + timedelta(days=1)
|
| 315 |
|
321 |
|
| 316 |
txns = session.query(RechargeOrder.status, func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL, RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.PAYMENT_SUCCESSFUL])).filter(RechargeOrder.creationTimestamp >= todate).filter(RechargeOrder.creationTimestamp < tomorrow).group_by(RechargeOrder.status).all()
|
322 |
txns = session.query(RechargeOrder.status, func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status.in_([RechargeOrderStatus.RECHARGE_SUCCESSFUL, RechargeOrderStatus.RECHARGE_FAILED_REFUNDED, RechargeOrderStatus.PAYMENT_SUCCESSFUL])).filter(RechargeOrder.creationTimestamp >= todate).filter(RechargeOrder.creationTimestamp < tomorrow).group_by(RechargeOrder.status).all()
|
| 317 |
|
323 |
|
| Line 338... |
Line 344... |
| 338 |
wh.description = "Wallet Credited"
|
344 |
wh.description = "Wallet Credited"
|
| 339 |
wallet.amount = wallet.amount - tamount
|
345 |
wallet.amount = wallet.amount - tamount
|
| 340 |
session.commit()
|
346 |
session.commit()
|
| 341 |
|
347 |
|
| 342 |
|
348 |
|
| 343 |
maildata = ""
|
349 |
maildata = "Old Wallet Amount is : " + str(oldBalance) + "<br>New Wallet Amount is : " + str(newBalance)
|
| 344 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "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, [])
|
350 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["pardeep.panwar@spiceretail.co.in>", "amit.tyagi@spiceretail.co.in", "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, [])
|
| 345 |
|
351 |
|
| 346 |
|
352 |
|
| 347 |
if __name__ == '__main__':
|
353 |
if __name__ == '__main__':
|
| 348 |
main()
|
354 |
main()
|