Subversion Repositories SmartDukaan

Rev

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

Rev 14173 Rev 14202
Line 33... Line 33...
33
        super(Store, self).__init__(store_id)
33
        super(Store, self).__init__(store_id)
34
        
34
        
35
    def getName(self):
35
    def getName(self):
36
        return "flipkart"
36
        return "flipkart"
37
    
37
    
38
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl, insert=True):
38
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl, insert=False):
39
        resp = {}
39
        resp = {}
40
        if ORDER_SUCCESS_URL in orderSuccessUrl or THANKYOU_URL in orderSuccessUrl:
40
        if ORDER_SUCCESS_URL in orderSuccessUrl or THANKYOU_URL in orderSuccessUrl:
41
            try:
41
            try:
42
                soup = BeautifulSoup(rawHtml)
42
                soup = BeautifulSoup(rawHtml)
43
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
43
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
44
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
44
                merchantOrderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
45
                resp["result"] = 'HTML_REQUIRED'
45
                resp["result"] = 'HTML_REQUIRED'
-
 
46
                self.db.merchantOrder.insert({"merchantOrderId":merchantOrderId, "requireDetails":True, "storeId":1, "userId":userId, "orderId":orderId})
46
                resp["url"] = ORDER_REDIRECT_URL % (orderId)
47
                resp["url"] = ORDER_REDIRECT_URL % (merchantOrderId)
47
                return resp
48
                return resp
48
            except:
49
            except:
49
                resp["result"] = 'IGNORED'
50
                resp["result"] = 'IGNORED'
50
                return resp
51
                return resp
51
        
52