Subversion Repositories SmartDukaan

Rev

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

Rev 13573 Rev 13582
Line 1... Line 1...
1
import falcon
1
import falcon
2
import json
2
import json
-
 
3
from dtr import main
3
from dtr.storage import Mongo 
4
from dtr.storage import Mongo 
4
 
5
 
5
 
6
 
6
class CategoryDiscountInfo(object):
7
class CategoryDiscountInfo(object):
7
    
8
    
Line 77... Line 78...
77
                'JSON was incorrect.')
78
                'JSON was incorrect.')
78
            
79
            
79
        result = Mongo.addExceptionalNlc(result_json)
80
        result = Mongo.addExceptionalNlc(result_json)
80
        resp.body = json.dumps(result, encoding='utf-8')
81
        resp.body = json.dumps(result, encoding='utf-8')
81
        
82
        
-
 
83
class StoreOrder():
-
 
84
    def on_post(self, req, resp):
-
 
85
        
-
 
86
        try:
-
 
87
            json = json.loads(req.stream.read(), encoding='utf-8')
-
 
88
        except ValueError:
-
 
89
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
90
                'Malformed JSON',
-
 
91
                'Could not decode the request body. The '
-
 
92
                'JSON was incorrect.')
-
 
93
            
-
 
94
        store = main.getStore(['sourceId'])
-
 
95
        result = store.parseOrderRawHtml(json['orderId'], json['subTagId'], json['userId'], json['rawHtml'], json['orderSuccessUrl'])
-
 
96
        resp.body = json.dumps({"result":result}, encoding='utf-8')
-
 
97
    
-
 
98
    def on_get(self, req, res, userId, page=1, window=50):
-
 
99
        Mongo.getMerchantOrdersByUser(userId, page, window)
-
 
100
        
-
 
101
    
82
102