Subversion Repositories SmartDukaan

Rev

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

Rev 13802 Rev 13804
Line 89... Line 89...
89
                'JSON was incorrect.')
89
                'JSON was incorrect.')
90
            
90
            
91
        result = Mongo.addExceptionalNlc(result_json)
91
        result = Mongo.addExceptionalNlc(result_json)
92
        resp.body = json.dumps(result, encoding='utf-8')
92
        resp.body = json.dumps(result, encoding='utf-8')
93
        
93
        
94
class StoreOrder():
-
 
95
    def on_post(self, req, resp):
-
 
96
        
-
 
97
        try:
-
 
98
            string1 = req.stream.read()
-
 
99
            req_json = json.loads(string1, encoding='utf-8')
-
 
100
        except ValueError:
-
 
101
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
102
                'Malformed JSON',
-
 
103
                'Could not decode the request body. The '
-
 
104
                'JSON was incorrect.')
-
 
105
            
-
 
106
        store = main.getStore(int(req_json['sourceId']))
-
 
107
        result = store.parseOrderRawHtml(int(req_json['orderId']), req_json['subTagId'], int(req_json['userId']), req_json['rawHtml'], req_json['orderSuccessUrl'])
-
 
108
        resp.body = json.dumps(result, encoding='utf-8')
-
 
109
    
-
 
110
    def on_get(self, req, resp, userId):
-
 
111
        page = req.get_param_as_int("page")
-
 
112
        window = req.get_param_as_int("window")
-
 
113
        result = Mongo.getMerchantOrdersByUser(int(userId), page, window)
-
 
114
        resp.body = json.dumps(result, encoding='utf-8')
-
 
115
        
-
 
116
class Deals():
94
class Deals():
117
    def on_get(self,req, resp, userId):
95
    def on_get(self,req, resp, userId):
118
        categoryId = req.get_param_as_int("categoryId")
96
        categoryId = req.get_param_as_int("categoryId")
119
        offset = req.get_param_as_int("offset")
97
        offset = req.get_param_as_int("offset")
120
        limit = req.get_param_as_int("limit")
98
        limit = req.get_param_as_int("limit")