Subversion Repositories SmartDukaan

Rev

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

Rev 13813 Rev 13821
Line 12... Line 12...
12
import re
12
import re
13
import traceback
13
import traceback
14
 
14
 
15
ORDER_REDIRECT_URL = 'https://www.amazon.in/gp/css/summary/edit.html?orderID=%s'
15
ORDER_REDIRECT_URL = 'https://www.amazon.in/gp/css/summary/edit.html?orderID=%s'
16
ORDER_SUCCESS_URL = 'https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html'
16
ORDER_SUCCESS_URL = 'https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html'
17
THANKYOU_URL = ''
17
THANKYOU_URL = ' https://www.amazon.in/gp/buy/thankyou/handlers/display.html'
18
class Store(MStore):
18
class Store(MStore):
-
 
19
    
-
 
20
    orderStatusRegexMap = { MStore.ORDER_PLACED : ['Ordered from', 'Not Yet Distpatched','Dispatching Now'],
-
 
21
                            MStore.ORDER_SHIPPED : ['Dispatched on'],
-
 
22
                            MStore.ORDER_CANCELLED : ['']
-
 
23
                           }
19
 
24
 
20
    def __init__(self,store_id):
25
    def __init__(self,store_id):
21
        super(Store, self).__init__(store_id)
26
        super(Store, self).__init__(store_id)
22
        
27
        
23
    def getName(self):
28
    def getName(self):
24
        return "flipkart"
29
        return "flipkart"
25
    
30
    
26
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
31
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
27
        resp = {}
32
        resp = {}
28
        if ORDER_SUCCESS_URL in orderSuccessUrl :
33
        if ORDER_SUCCESS_URL in orderSuccessUrl or THANKYOU_URL in orderSuccessUrl:
29
            try:
34
            try:
30
                soup = BeautifulSoup(rawHtml)
35
                soup = BeautifulSoup(rawHtml)
31
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
36
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
32
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
37
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
33
                resp["result"] = 'HTML_REQUIRED'
38
                resp["result"] = 'HTML_REQUIRED'