| Line 45... |
Line 45... |
| 45 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
45 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
| 46 |
if(refundToWallet(batchId, userCashbacksMap)):
|
46 |
if(refundToWallet(batchId, userCashbacksMap)):
|
| 47 |
for userCashback in userCashbacksToBeCredited:
|
47 |
for userCashback in userCashbacksToBeCredited:
|
| 48 |
userCashback.status = 'Credited'
|
48 |
userCashback.status = 'Credited'
|
| 49 |
userCashback.batchCreditId = batchId
|
49 |
userCashback.batchCreditId = batchId
|
| - |
|
50 |
userCashback.creditedDate = datetimeNow.date()
|
| 50 |
session.commit()
|
51 |
session.commit()
|
| 51 |
|
52 |
|
| 52 |
for key, value in userCashbacksMap.iteritems():
|
53 |
for key, value in userCashbacksMap.iteritems():
|
| 53 |
get_mongo_connection().Dtr.refund.insert({"userId": key, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":utils.CREDIT_TYPE_APP})
|
54 |
get_mongo_connection().Dtr.refund.insert({"userId": key, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":utils.CREDIT_TYPE_APP})
|
| 54 |
get_mongo_connection().Dtr.user.update({"userId":key}, {"$inc": { "credited": value, utils.CREDIT_TYPE_APP:value}}, upsert=True)
|
55 |
get_mongo_connection().Dtr.user.update({"userId":key}, {"$inc": { "credited": value, utils.CREDIT_TYPE_APP:value}}, upsert=True)
|