Subversion Repositories SmartDukaan

Rev

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

Rev 13783 Rev 13796
Line 21... Line 21...
21
        
21
        
22
    def getName(self):
22
    def getName(self):
23
        return "flipkart"
23
        return "flipkart"
24
    
24
    
25
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
25
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
26
        response = {}
26
        resp = {}
27
        if orderSuccessUrl == ORDER_SUCCESS_URL:
27
        if orderSuccessUrl == ORDER_SUCCESS_URL:
28
            try:
28
            try:
29
                soup = BeautifulSoup(rawHtml)
29
                soup = BeautifulSoup(rawHtml)
30
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
30
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
31
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
31
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
32
                response["result"] = 'HTML_REQUIRED'
32
                resp["result"] = 'HTML_REQUIRED'
33
                response["url"] = ORDER_REDIRECT_URL % (orderId)
33
                resp["url"] = ORDER_REDIRECT_URL % (orderId)
34
                return response
34
                return resp
35
            except:
35
            except:
36
                response["result"] = 'IGNORED'
36
                resp["result"] = 'IGNORED'
37
                return response
37
                return resp
38
        
38
        
39
        else:
39
        else:
40
            try:
40
            try:
41
                merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
41
                merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
42
                 
42
                 
Line 84... Line 84...
84
                    
84
                    
85
                    
85
                    
86
                        
86
                        
87
                
87
                
88
                
88
                
89
                response['result'] = 'ORDER_CREATED'
89
                resp['result'] = 'ORDER_CREATED'
90
                return response    
90
                return resp    
91
                        #subOrder = SubOrder(productTitle, productUrl, merchantOrder.placedOn, amountPaid, status, quantity)
91
                        #subOrder = SubOrder(productTitle, productUrl, merchantOrder.placedOn, amountPaid, status, quantity)
92
            except:
92
            except:
93
                response['result'] = 'PARSE_ERROR'
93
                resp['result'] = 'PARSE_ERROR'
94
                return response    
94
                return resp    
95
                    
95
                    
96
        
96
        
97
 
97
 
98
def main():
98
def main():
99
    store = getStore(1)
99
    store = getStore(1)