Subversion Repositories SmartDukaan

Rev

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

Rev 14352 Rev 14427
Line 2... Line 2...
2
Created on Feb 12, 2015
2
Created on Feb 12, 2015
3
 
3
 
4
@author: amit
4
@author: amit
5
'''
5
'''
6
from dtr import main
6
from dtr import main
7
from dtr.storage import Mongo
7
from dtr.storage import Mongo, Mysql
8
import datetime
8
import datetime
9
import falcon
9
import falcon
10
import json
10
import json
11
import urlparse
11
import urlparse
12
class StoreOrder():
12
class StoreOrder():
Line 111... Line 111...
111
        except ValueError:
111
        except ValueError:
112
            raise falcon.HTTPError(falcon.HTTP_400,
112
            raise falcon.HTTPError(falcon.HTTP_400,
113
                'Malformed JSON',
113
                'Malformed JSON',
114
                'Could not decode the request body. The '
114
                'Could not decode the request body. The '
115
                'JSON was incorrect.')
115
                'JSON was incorrect.')
-
 
116
        
-
 
117
class Transactions():
-
 
118
    def on_get(self, req, resp):
-
 
119
        try:
-
 
120
            page = req.get_param_as_int("page")
-
 
121
            window = req.get_param_as_int("window")
-
 
122
            result = Mysql.getOrders(page, window)
-
 
123
            resp.body = result
-
 
124
            resp.content_type = 'text/html'
-
 
125
        except ValueError:
-
 
126
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
127
                'Malformed JSON',
-
 
128
                'Could not decode the request body. The '
-
 
129
                'JSON was incorrect.')
-
 
130
        
-
 
131
class RawHtml():
-
 
132
    def on_get(self, req, resp, orderId):
-
 
133
        try:
-
 
134
            result = Mysql.getOrderHtml(orderId)
-
 
135
            resp.body = result
-
 
136
            resp.content_type = 'text/html'
-
 
137
        except ValueError:
-
 
138
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
139
                'Malformed JSON',
-
 
140
                'Could not decode the request body. The '
-
 
141
                'JSON was incorrect.')
116
        
142
        
117
class PendingRefunds():
143
class PendingRefunds():
118
    def on_get(self, req, resp,userId):
144
    def on_get(self, req, resp,userId):
119
        try:
145
        try:
120
            result = Mongo.getPendingRefunds(int(userId))
146
            result = Mongo.getPendingRefunds(int(userId))