| Line 2392... |
Line 2392... |
| 2392 |
value = int(jsonReq.get('amount'))
|
2392 |
value = int(jsonReq.get('amount'))
|
| 2393 |
userAmountMap = {}
|
2393 |
userAmountMap = {}
|
| 2394 |
datetimeNow = datetime.now()
|
2394 |
datetimeNow = datetime.now()
|
| 2395 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
2395 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
| 2396 |
userAmountMap[user_id] = value
|
2396 |
userAmountMap[user_id] = value
|
| 2397 |
Mongo.updateCrmWalletStatus(status, _id,user_id,None)
|
2397 |
Mongo.updateCrmWalletStatus(status, _id,user_id,None,None)
|
| 2398 |
if refundToWallet(batchId,userAmountMap):
|
2398 |
if refundToWallet(batchId,userAmountMap):
|
| 2399 |
refundType = jsonReq.get('type')
|
2399 |
refundType = jsonReq.get('type')
|
| - |
|
2400 |
approved_by = jsonReq.get('approved_by')
|
| - |
|
2401 |
print approved_by
|
| 2400 |
get_mongo_connection().Dtr.refund.insert({"userId": user_id, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":refundType})
|
2402 |
get_mongo_connection().Dtr.refund.insert({"userId": user_id, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":refundType})
|
| 2401 |
get_mongo_connection().Dtr.user.update({"userId":user_id}, {"$inc": { "credited": value, refundType:value}}, upsert=True)
|
2403 |
get_mongo_connection().Dtr.user.update({"userId":user_id}, {"$inc": { "credited": value, refundType:value}}, upsert=True)
|
| 2402 |
Mongo.updateCrmWalletStatus(utils.REFUND_ADJUSTMENT_MAP.get(3), _id,user_id,batchId)
|
2404 |
Mongo.updateCrmWalletStatus(utils.REFUND_ADJUSTMENT_MAP.get(3), _id,user_id,batchId,approved_by)
|
| 2403 |
print user_id,value
|
2405 |
print user_id,value
|
| 2404 |
Mongo.sendNotification([user_id], 'Batch Credit', 'Cashback Credited for %ss'%(str(refundType)), 'Rs.%s has been added to your wallet'%(value),'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(user_id), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback Credited for %ss. Rs.%s has been added to your wallet"%(refundType,value))
|
2406 |
Mongo.sendNotification([user_id], 'Batch Credit', 'Cashback Credited for %ss'%(str(refundType)), 'Rs.%s has been added to your wallet'%(value),'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(user_id), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback Credited for %ss. Rs.%s has been added to your wallet"%(refundType,value))
|
| 2405 |
resp.body = "{\"result\":\"success\"}"
|
2407 |
resp.body = "{\"result\":\"success\"}"
|
| 2406 |
else:
|
2408 |
else:
|
| 2407 |
resp.body = "{\"result\":\"failed\"}"
|
2409 |
resp.body = "{\"result\":\"failed\"}"
|
| 2408 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
2410 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
| 2409 |
Mongo.updateCrmWalletStatus(status, _id,user_id,None)
|
2411 |
Mongo.updateCrmWalletStatus(status, _id,user_id,None,None)
|
| 2410 |
resp.body = "{\"result\":\"success\"}"
|
2412 |
resp.body = "{\"result\":\"success\"}"
|
| 2411 |
else:
|
2413 |
else:
|
| 2412 |
resp.body = "{\"result\":\"failed\"}"
|
2414 |
resp.body = "{\"result\":\"failed\"}"
|
| 2413 |
|
2415 |
|
| 2414 |
class DetailsBatchId():
|
2416 |
class DetailsBatchId():
|