Subversion Repositories SmartDukaan

Rev

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

Rev 13809 Rev 13810
Line 11... Line 11...
11
from dtr.sources.flipkart import todict
11
from dtr.sources.flipkart import todict
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/ref=ox_spc_place_order?ie=UTF8&fromAnywhere=1&hasWorkingJavascript='
16
ORDER_SUCCESS_URL = 'https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html'
17
THANKYOU_URL = ''
17
THANKYOU_URL = ''
18
class Store(MStore):
18
class Store(MStore):
19
 
19
 
20
    def __init__(self,store_id):
20
    def __init__(self,store_id):
21
        super(Store, self).__init__(store_id)
21
        super(Store, self).__init__(store_id)
Line 23... Line 23...
23
    def getName(self):
23
    def getName(self):
24
        return "flipkart"
24
        return "flipkart"
25
    
25
    
26
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
26
    def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
27
        resp = {}
27
        resp = {}
28
        if orderSuccessUrl == ORDER_SUCCESS_URL:
28
        if ORDER_SUCCESS_URL in orderSuccessUrl :
29
            try:
29
            try:
30
                soup = BeautifulSoup(rawHtml)
30
                soup = BeautifulSoup(rawHtml)
31
                orderUrl = soup.find('div', {"id":"thank-you-box-wrapper"}).div.findAll('div', recursive=False)[1].a['href']
31
                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]
32
                orderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
33
                resp["result"] = 'HTML_REQUIRED'
33
                resp["result"] = 'HTML_REQUIRED'