Subversion Repositories SmartDukaan

Rev

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

Rev 20457 Rev 20695
Line 38... Line 38...
38
from shop2020.clients.CatalogClient import CatalogClient  
38
from shop2020.clients.CatalogClient import CatalogClient  
39
from pyquery import PyQuery as pq
39
from pyquery import PyQuery as pq
40
import time
40
import time
41
from dtr.main import refundToWallet
41
from dtr.main import refundToWallet
42
import random
42
import random
-
 
43
try:
43
from dtr.utils.AutoSuggest import getSuggestions
44
    from dtr.utils.AutoSuggest import getSuggestions
-
 
45
except:
-
 
46
    pass
44
alphalist = list(string.uppercase)
47
alphalist = list(string.uppercase)
45
alphalist.remove('O')
48
alphalist.remove('O')
46
alphalist.remove('I')
49
alphalist.remove('I')
47
alphalist.remove('L')
50
alphalist.remove('L')
48
numList = ['2','3','4','5','6','7','8','9']
51
numList = ['2','3','4','5','6','7','8','9']
Line 268... Line 271...
268
        addToExisting = req.get_param_as_int("addToExisting")
271
        addToExisting = req.get_param_as_int("addToExisting")
269
        multi = req.get_param_as_int("multi")
272
        multi = req.get_param_as_int("multi")
270
        
273
        
271
        try:
274
        try:
272
            result_json = json.loads(req.stream.read(), encoding='utf-8')
275
            result_json = json.loads(req.stream.read(), encoding='utf-8')
273
        except ValueError:
276
        except:
-
 
277
            traceback.print_exc()
274
            raise falcon.HTTPError(falcon.HTTP_400,
278
            raise falcon.HTTPError(falcon.HTTP_400,
275
                'Malformed JSON',
279
                'Malformed JSON',
276
                'Could not decode the request body. The '
280
                'Could not decode the request body. The '
277
                'JSON was incorrect.')
281
                'JSON was incorrect.')
278
            
282
            
Line 290... Line 294...
290
    def on_get(self,req, resp):
294
    def on_get(self,req, resp):
291
        identifier = req.get_param("identifier")
295
        identifier = req.get_param("identifier")
292
        source_id = req.get_param_as_int("source_id")
296
        source_id = req.get_param_as_int("source_id")
293
        try:
297
        try:
294
            result = Mongo.getCashBackDetails(identifier, source_id)
298
            result = Mongo.getCashBackDetails(identifier, source_id)
-
 
299
            if result is None:
-
 
300
                result = {}
295
            json_docs = json.dumps(result, default=json_util.default)
301
            json_docs = json.dumps(result, default=json_util.default)
296
            resp.body = json_docs
302
            resp.body = json_docs
297
        except:
303
        except:
298
            json_docs = json.dumps({}, default=json_util.default)
304
            json_docs = json.dumps({}, default=json_util.default)
299
            resp.body = json_docs
305
            resp.body = json_docs