| Line 2386... |
Line 2386... |
| 2386 |
status = req.get_param('status')
|
2386 |
status = req.get_param('status')
|
| 2387 |
jsonReq = json.loads(req.stream.read(), encoding='utf-8')
|
2387 |
jsonReq = json.loads(req.stream.read(), encoding='utf-8')
|
| 2388 |
print jsonReq
|
2388 |
print jsonReq
|
| 2389 |
userId = jsonReq.get('user_id')
|
2389 |
userId = jsonReq.get('user_id')
|
| 2390 |
_id = jsonReq.get('_id')
|
2390 |
_id = jsonReq.get('_id')
|
| 2391 |
conn = get_mongo_connection().Dtr
|
- |
|
| 2392 |
if status == utils.REFUND_ADJUSTMENT_MAP.get(1):
|
2391 |
if status == utils.REFUND_ADJUSTMENT_MAP.get(1):
|
| 2393 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
2392 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
| 2394 |
value = jsonReq.get('amount')
|
- |
|
| 2395 |
datetimeNow = datetime.now()
|
2393 |
datetimeNow = datetime.now()
|
| 2396 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
2394 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
| 2397 |
user_id = int(jsonReq.get('user_id'))
|
2395 |
user_id = jsonReq.get('user_id')
|
| 2398 |
value = int(jsonReq.get('amount'))
|
2396 |
value = int(jsonReq.get('amount'))
|
| - |
|
2397 |
print value
|
| - |
|
2398 |
print user_id
|
| 2399 |
type = jsonReq.get('type')
|
2399 |
refundType = jsonReq.get('type')
|
| - |
|
2400 |
print refundType
|
| 2400 |
conn.refund.insert({"userId": user_id, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":type})
|
2401 |
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 |
conn.user.update({"userId":user_id}, {"$inc": { "credited": value, type:value}}, upsert=True)
|
2402 |
get_mongo_connection().Dtr.user.update({"userId":user_id}, {"$inc": { "credited": value, refundType:value}}, upsert=True)
|
| 2402 |
resp.body = "{\"result\":\"success\"}"
|
2403 |
resp.body = "{\"result\":\"success\"}"
|
| 2403 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
2404 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
| 2404 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
2405 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
| 2405 |
resp.body = "{\"result\":\"success\"}"
|
2406 |
resp.body = "{\"result\":\"success\"}"
|
| 2406 |
else:
|
2407 |
else:
|