Subversion Repositories SmartDukaan

Rev

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

Rev 13939 Rev 13990
Line 59... Line 59...
59
                'Malformed JSON',
59
                'Malformed JSON',
60
                'Could not decode the request body. The '
60
                'Could not decode the request body. The '
61
                'JSON was incorrect.')
61
                'JSON was incorrect.')
62
        
62
        
63
class Refunds():
63
class Refunds():
64
    def on_get(self, req, resp):
64
    def on_get(self, req, resp, userId):
65
        try:
65
        try:
66
            userId = req.get_param_as_int("userId")
-
 
67
            page = req.get_param_as_int("page")
66
            page = req.get_param_as_int("page")
68
            window = req.get_param_as_int("window")
67
            window = req.get_param_as_int("window")
69
            result = Mongo.getRefunds(userId,page,window)
68
            result = Mongo.getRefunds(int(userId),page,window)
70
            resp.body = json.dumps(result, encoding='utf-8')
69
            resp.body = json.dumps(result, encoding='utf-8')
71
        except ValueError:
70
        except ValueError:
72
            raise falcon.HTTPError(falcon.HTTP_400,
71
            raise falcon.HTTPError(falcon.HTTP_400,
73
                'Malformed JSON',
72
                'Malformed JSON',
74
                'Could not decode the request body. The '
73
                'Could not decode the request body. The '
75
                'JSON was incorrect.')
74
                'JSON was incorrect.')
76
        
75
        
77
class PendingRefunds():
76
class PendingRefunds():
78
    def on_get(self, req, resp,userId):
77
    def on_get(self, req, resp,userId):
79
        try:
78
        try:
80
            page = req.get_param_as_int("page")
-
 
81
            window = req.get_param_as_int("window")
-
 
82
            result = Mongo.getPendingRefunds(int(userId))
79
            result = Mongo.getPendingRefunds(int(userId))
83
            resp.body = json.dumps(result, encoding='utf-8')
80
            resp.body = json.dumps(result, encoding='utf-8')
84
        except ValueError:
81
        except ValueError:
85
            raise falcon.HTTPError(falcon.HTTP_400,
82
            raise falcon.HTTPError(falcon.HTTP_400,
86
                'Malformed JSON',
83
                'Malformed JSON',