Subversion Repositories SmartDukaan

Rev

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

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