Subversion Repositories SmartDukaan

Rev

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

Rev 13582 Rev 13603
Line 82... Line 82...
82
        
82
        
83
class StoreOrder():
83
class StoreOrder():
84
    def on_post(self, req, resp):
84
    def on_post(self, req, resp):
85
        
85
        
86
        try:
86
        try:
87
            json = json.loads(req.stream.read(), encoding='utf-8')
87
            req_json = json.loads(req.stream.read(), encoding='utf-8')
88
        except ValueError:
88
        except ValueError:
89
            raise falcon.HTTPError(falcon.HTTP_400,
89
            raise falcon.HTTPError(falcon.HTTP_400,
90
                'Malformed JSON',
90
                'Malformed JSON',
91
                'Could not decode the request body. The '
91
                'Could not decode the request body. The '
92
                'JSON was incorrect.')
92
                'JSON was incorrect.')
93
            
93
            
94
        store = main.getStore(['sourceId'])
94
        store = main.getStore(req_json['sourceId'])
95
        result = store.parseOrderRawHtml(json['orderId'], json['subTagId'], json['userId'], json['rawHtml'], json['orderSuccessUrl'])
95
        result = store.parseOrderRawHtml(req_json['orderId'], req_json['subTagId'], req_json['userId'], req_json['rawHtml'], req_json['orderSuccessUrl'])
96
        resp.body = json.dumps({"result":result}, encoding='utf-8')
96
        resp.body = json.dumps({"result":result}, encoding='utf-8')
97
    
97
    
98
    def on_get(self, req, res, userId, page=1, window=50):
98
    def on_get(self, req, resp, userId):
-
 
99
        page = req.get_param_as_int("page")
-
 
100
        window = req.get_param_as_int("window")
99
        Mongo.getMerchantOrdersByUser(userId, page, window)
101
        result = Mongo.getMerchantOrdersByUser(int(userId), page, window)
-
 
102
        print result
-
 
103
        resp.body = json.dumps(result, encoding='utf-8')
100
        
104
        
101
    
105
    
102
106