Subversion Repositories SmartDukaan

Rev

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

Rev 21311 Rev 21312
Line 366... Line 366...
366
                "_id":affiliateorderitemid
366
                "_id":affiliateorderitemid
367
        }
367
        }
368
        return saleMap
368
        return saleMap
369
            
369
            
370
            
370
            
371
def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
371
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
372
    resp= {}
372
        resp= {}
373
    try:
373
        try:
374
        url = ORDER_TRACK_URL + urlparse(orderSuccessUrl).query 
374
            url = ORDER_TRACK_URL + urlparse(orderSuccessUrl).query 
375
        merchantOrderId = re.findall('reference_id=(.*?)&', orderSuccessUrl,re.IGNORECASE)[0]
375
            merchantOrderId = re.findall('reference_id=(.*?)&', orderSuccessUrl,re.IGNORECASE)[0]
376
    
376
        
377
        merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
377
            merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
378
        merchantOrder.closed = False
378
            merchantOrder.closed = False
379
        merchantOrder.merchantOrderId = merchantOrderId
379
            merchantOrder.merchantOrderId = merchantOrderId
380
        merchantOrder.orderTrackingUrl = url
380
            merchantOrder.orderTrackingUrl = url
381
        merchantOrder.requireDetail = True
381
            merchantOrder.requireDetail = True
382
        if self._saveToOrder(todict(merchantOrder)):
382
            if self._saveToOrder(todict(merchantOrder)):
383
            resp['result'] = 'ORDER_CREATED'
383
                resp['result'] = 'ORDER_CREATED'
384
        else:
384
            else:
385
            resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
385
                resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
386
            
386
                
387
        return resp 
387
            return resp 
388
    except:
388
        except:
389
        traceback.print_exc()
389
            traceback.print_exc()
390
        resp['result'] = 'ORDER_NOT_CREATED'
390
            resp['result'] = 'ORDER_NOT_CREATED'
391
        return resp 
391
            return resp 
392
        
392
        
393
 
393
 
394
            
394
            
395
    def _getStatusFromDetailedStatus(self, detailedStatus):
395
    def _getStatusFromDetailedStatus(self, detailedStatus):
396
        for key, value in Store.OrderStatusMap.iteritems():
396
        for key, value in Store.OrderStatusMap.iteritems():
Line 409... Line 409...
409
    m = hashlib.md5()
409
    m = hashlib.md5()
410
    print(m.digest())
410
    print(m.digest())
411
 
411
 
412
def main():
412
def main():
413
    store = getStore(2)
413
    store = getStore(2)
414
    store.parseOrderRawHtml(1, '1234', 14, '', 'https://www.flipkart.com/rv/orderConfirmation/orderresponse?pr=1&reference_id=OD1088257258903640&src=or&type=physical&token=e0fa1db468ba77bfb8cdac938e051ef3')
414
    store.parseOrderRawHtml(1, '1234', 14, '', 'https://www.flipkart.com/rv/orderConfirmation/orderresponse?pr=1&reference_id=OD1090350248246880&src=or&type=physical&token=3f720f955fc94219e7fef31992302b38')
415
    #store.scrapeStoreOrders()
415
    #store.scrapeStoreOrders()
416
 
416
 
417
if __name__ == '__main__':
417
if __name__ == '__main__':
418
        main()
418
        main()
419
    
419
    
420
420