| Line 229... |
Line 229... |
| 229 |
offset = req.get_param_as_int("offset")
|
229 |
offset = req.get_param_as_int("offset")
|
| 230 |
limit = req.get_param_as_int("limit")
|
230 |
limit = req.get_param_as_int("limit")
|
| 231 |
sort = req.get_param("sort")
|
231 |
sort = req.get_param("sort")
|
| 232 |
direction = req.get_param_as_int("direction")
|
232 |
direction = req.get_param_as_int("direction")
|
| 233 |
filterData = req.get_param('filterData')
|
233 |
filterData = req.get_param('filterData')
|
| - |
|
234 |
if categoryId!=6:
|
| 234 |
result = Mongo.getNewDeals(int(userId), categoryId, offset, limit, sort, direction, filterData)
|
235 |
result = Mongo.getNewDeals(int(userId), categoryId, offset, limit, sort, direction, filterData)
|
| - |
|
236 |
else:
|
| - |
|
237 |
result = Mongo.getAccesoryDeals(int(userId), categoryId, offset, limit, sort, direction, filterData)
|
| 235 |
resp.body = dumps(result)
|
238 |
resp.body = dumps(result)
|
| 236 |
|
239 |
|
| 237 |
class MasterData():
|
240 |
class MasterData():
|
| 238 |
def on_get(self,req, resp, skuId):
|
241 |
def on_get(self,req, resp, skuId):
|
| 239 |
showDp = req.get_param_as_int("showDp")
|
242 |
showDp = req.get_param_as_int("showDp")
|
| Line 2370... |
Line 2373... |
| 2370 |
|
2373 |
|
| 2371 |
def on_get(self,req,resp):
|
2374 |
def on_get(self,req,resp):
|
| 2372 |
offset = req.get_param_as_int("offset")
|
2375 |
offset = req.get_param_as_int("offset")
|
| 2373 |
limit = req.get_param_as_int("limit")
|
2376 |
limit = req.get_param_as_int("limit")
|
| 2374 |
status = req.get_param("status")
|
2377 |
status = req.get_param("status")
|
| 2375 |
userRefundDetails = Mongo.fetchCrmRefundUsers(status,offset,limit)
|
2378 |
userRefundDetails = Mongo.fetchCrmRefundUsers(status,offset,limit)
|
| 2376 |
print userRefundDetails
|
- |
|
| 2377 |
if userRefundDetails is not None:
|
2379 |
if userRefundDetails is not None:
|
| 2378 |
resp.body = dumps(userRefundDetails)
|
2380 |
resp.body = dumps(userRefundDetails)
|
| 2379 |
else:
|
2381 |
else:
|
| 2380 |
resp.body ="{}"
|
2382 |
resp.body ="{}"
|
| 2381 |
|
2383 |
|
| 2382 |
class RefundWalletStatus():
|
2384 |
class RefundWalletStatus():
|
| 2383 |
def on_post(self,req,resp):
|
2385 |
def on_post(self,req,resp):
|
| 2384 |
status = req.get_param('status')
|
2386 |
status = req.get_param('status')
|
| 2385 |
jsonReq = json.loads(req.stream.read(), encoding='utf-8')
|
2387 |
jsonReq = json.loads(req.stream.read(), encoding='utf-8')
|
| 2386 |
print jsonReq
|
2388 |
print jsonReq
|
| 2387 |
print status
|
- |
|
| 2388 |
userId = jsonReq.get('user_id')
|
2389 |
userId = jsonReq.get('user_id')
|
| 2389 |
_id = jsonReq.get('_id')
|
2390 |
_id = jsonReq.get('_id')
|
| 2390 |
#conn = get_mongo_connection()
|
2391 |
conn = get_mongo_connection()
|
| 2391 |
if status == utils.REFUND_ADJUSTMENT_MAP.get(1):
|
2392 |
if status == utils.REFUND_ADJUSTMENT_MAP.get(1):
|
| 2392 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
2393 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
| - |
|
2394 |
value = jsonReq.get('amount')
|
| - |
|
2395 |
datetimeNow = datetime.now()
|
| - |
|
2396 |
batchId = int(time.mktime(datetimeNow.timetuple()))
|
| - |
|
2397 |
user_id = jsonReq.get('user_id')
|
| - |
|
2398 |
value = jsonReq.get('amount')
|
| - |
|
2399 |
type = jsonReq.get('type')
|
| - |
|
2400 |
conn.refund.insert({"userId": user_id, "batch":batchId, "userAmount":value, "timestamp":datetime.strftime(datetimeNow,"%Y-%m-%d %H:%M:%S"), "type":type})
|
| - |
|
2401 |
conn.Dtr.user.update({"userId":user_id}, {"$inc": { "credited": value, type:value}}, upsert=True)
|
| - |
|
2402 |
resp.body = "{\"result\":\"success\"}"
|
| 2393 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
2403 |
elif status == utils.REFUND_ADJUSTMENT_MAP.get(2):
|
| 2394 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
2404 |
Mongo.updateCrmWalletStatus(status, _id,userId)
|
| - |
|
2405 |
resp.body = "{\"result\":\"success\"}"
|
| 2395 |
|
2406 |
else:
|
| 2396 |
resp.body = "{\"result\":\"success\"}"
|
2407 |
resp.body = "{\"result\":\"failed\"}"
|
| - |
|
2408 |
|
| 2397 |
|
2409 |
|
| 2398 |
def main():
|
2410 |
def main():
|
| 2399 |
a = RetailerDetail()
|
2411 |
a = RetailerDetail()
|
| 2400 |
retailer = a.getNotActiveRetailer()
|
2412 |
retailer = a.getNotActiveRetailer()
|
| 2401 |
otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
|
2413 |
otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
|