Subversion Repositories SmartDukaan

Rev

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

Rev 17716 Rev 17717
Line 47... Line 47...
47
        
47
        
48
    def getName(self):
48
    def getName(self):
49
        return "amazon"
49
        return "amazon"
50
    
50
    
51
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl, track=False):
51
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl, track=False):
52
        rawHtml = unicode(rawHtml, errors='ignore')
52
        rawHtml = rawHtml.encode('utf-8')
53
        parseString = "Tracking" if track else "Transacted"
53
        parseString = "Tracking" if track else "Transacted"
54
        print parseString, "Order Id to be parsed is :", orderId
54
        print parseString, "Order Id to be parsed is :", orderId
55
        resp = {}
55
        resp = {}
56
        resp['result'] = 'ORDER_NOT_CREATED'
56
        resp['result'] = 'ORDER_NOT_CREATED'
57
        if ORDER_SUCCESS_URL in orderSuccessUrl or THANKYOU_URL in orderSuccessUrl:
57
        if ORDER_SUCCESS_URL in orderSuccessUrl or THANKYOU_URL in orderSuccessUrl:
Line 124... Line 124...
124
                soup = BeautifulSoup(rawHtml)
124
                soup = BeautifulSoup(rawHtml)
125
                if not soup.body:
125
                if not soup.body:
126
                    resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
126
                    resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
127
                else:   
127
                else:   
128
                    try:
128
                    try:
-
 
129
                        print "soup.prettify()"
-
 
130
                        print soup.prettify()
129
                        self.parseNewStlye(merchantOrder, soup)
131
                        self.parseNewStlye(merchantOrder, soup)
130
                        resp['result'] = 'DETAIL_CREATED'
132
                        resp['result'] = 'DETAIL_CREATED'
131
                    except:
133
                    except:
132
                        try:
134
                        try:
133
                            traceback.print_exc()
135
                            traceback.print_exc()
Line 471... Line 473...
471
            return missingOrderUrls + ['https://www.amazon.in/gp/css/order-history', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled&startIndex=10']
473
            return missingOrderUrls + ['https://www.amazon.in/gp/css/order-history', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled&startIndex=10']
472
        else: 
474
        else: 
473
            return missingOrderUrls
475
            return missingOrderUrls
474
            
476
            
475
    def trackOrdersForUser(self, userId, url, rawHtml):
477
    def trackOrdersForUser(self, userId, url, rawHtml):
476
        rawHtml = unicode(rawHtml, errors='ignore')
478
        rawHtml = rawHtml.encode('utf-8')
477
        directory = "/AmazonTrack/User" + str(userId)
479
        directory = "/AmazonTrack/User" + str(userId)
478
        if not os.path.exists(directory):
480
        if not os.path.exists(directory):
479
            os.makedirs(directory)
481
            os.makedirs(directory)
480
        
482
        
481
        
483