Subversion Repositories SmartDukaan

Rev

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

Rev 13729 Rev 13781
Line 29... Line 29...
29
    try:
29
    try:
30
        module = importlib.import_module("dtr.sources." + sourceMap[source_id])
30
        module = importlib.import_module("dtr.sources." + sourceMap[source_id])
31
        store = getattr(module, "Store")(source_id)
31
        store = getattr(module, "Store")(source_id)
32
        return store
32
        return store
33
    except:
33
    except:
34
        #traceback.print_exc()
34
        traceback.print_exc()
35
        return None
35
        return None
36
 
36
 
37
class ScrapeException(Exception):
37
class ScrapeException(Exception):
38
    """Exception raised for errors in the input.
38
    """Exception raised for errors in the input.
39
 
39
 
Line 140... Line 140...
140
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
140
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
141
        
141
        
142
        pass
142
        pass
143
    
143
    
144
    def _updateOrdersPayBackStatus(self, searchMap, updateMap):
144
    def _updateOrdersPayBackStatus(self, searchMap, updateMap):
145
        searchMap['subOrders.cashbackStatus'] = Store.CB_INIT
145
        searchMap['subOrders.missingAff'] = False
146
        updateMap['subOrders.$.cashbackStatus'] = Store.CB_PENDING
146
        updateMap['subOrders.$.missingAff'] = True
147
        self.db.merchantOrder.update(searchMap, { '$set': updateMap })
147
        self.db.merchantOrder.update(searchMap, { '$set': updateMap })
148
        
148
        
149
    def _getActiveOrders(self):
149
    def _getActiveOrders(self, searchMap={}, collectionMap={}):
150
        collection = self.db.merchantOrder
150
        collection = self.db.merchantOrder
-
 
151
        searchMap = dict(searchMap.items()+ {"closed": False, "storeId" : self.store_id}.items()) 
151
        collectionMap =  {"orderSuccessUrl":1, "orderId":1,"subOrders":1}
152
        collectionMap =  dict(collectionMap.items() + {"orderSuccessUrl":1, "orderId":1,"subOrders":1, "placedOn":1}.items())
152
        stores = collection.find({"closed": False, "storeId" : self.store_id, "subOrders.closed":False}, collectionMap)
153
        stores = collection.find(searchMap, collectionMap)
153
        return [store for store in stores]
154
        return [store for store in stores]
154
    
155
    
155
    def _isSubOrderActive(self,order, merchantSubOrderId):
156
    def _isSubOrderActive(self,order, merchantSubOrderId):
156
        subOrders = order.get("subOrders")
157
        subOrders = order.get("subOrders")
157
        for subOrder in subOrders:
158
        for subOrder in subOrders: