Subversion Repositories SmartDukaan

Rev

Rev 19850 | Rev 19897 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19850 Rev 19879
Line 2556... Line 2556...
2556
        print traceback.print_exc()
2556
        print traceback.print_exc()
2557
        return False
2557
        return False
2558
    finally:
2558
    finally:
2559
        session.close()
2559
        session.close()
2560
                
2560
                
-
 
2561
 
-
 
2562
class GetItemCashback():
-
 
2563
    def on_get(self ,req,res):
-
 
2564
        itemcashback_id = req.get_param('id')
-
 
2565
        offsetval = req.get_param_as_int('offset')
-
 
2566
        limitval = req.get_param_as_int('limit')
-
 
2567
        allitemcashback = Mongo.getAllItemCasback(itemcashback_id,offsetval,limitval)
-
 
2568
        try: 
-
 
2569
            if allitemcashback:
-
 
2570
                res.body = dumps(allitemcashback)
-
 
2571
        except:
-
 
2572
                res.body = dumps({})
-
 
2573
            
-
 
2574
        
-
 
2575
    def on_post(self,req,res):
-
 
2576
        jsonReq = json.loads(req.stream.read(), encoding='utf-8')
-
 
2577
        item_skuId = jsonReq.get('sku')
-
 
2578
        cb = jsonReq.get('cash_back')
-
 
2579
        cb_description = jsonReq.get('cash_back_description')
-
 
2580
        cb_type = jsonReq.get('cash_back_type')
-
 
2581
        cb_status = jsonReq.get('cash_back_status')
-
 
2582
        response = Mongo.itemCashbackAdd(item_skuId,cb,cb_description,cb_type,cb_status)
-
 
2583
        try:
-
 
2584
            if response:
-
 
2585
                res.body = dumps({"result":"success"})
-
 
2586
        except:
-
 
2587
            res.body = dumps({"result":"failed"})
-
 
2588
                        
2561
def main():
2589
def main():
2562
    a = RetailerDetail()
2590
    a = RetailerDetail()
2563
    retailer = a.getNotActiveRetailer()
2591
    retailer = a.getNotActiveRetailer()
2564
    otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
2592
    otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
2565
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
2593
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
2566
    
2594
    
2567
if __name__ == '__main__':
2595
if __name__ == '__main__':
2568
    #main()
-
 
2569
    print getTinInfo('07740388453')                
-
 
2570
2596
    main()
-
 
2597
                
-
 
2598
2571
2599