| Line 35... |
Line 35... |
| 35 |
class Store(MStore):
|
35 |
class Store(MStore):
|
| 36 |
OrderStatusMap = {
|
36 |
OrderStatusMap = {
|
| 37 |
main.Store.ORDER_PLACED : ['Approval', 'Processing'],
|
37 |
main.Store.ORDER_PLACED : ['Approval', 'Processing'],
|
| 38 |
main.Store.ORDER_DELIVERED : ['Shipping'],
|
38 |
main.Store.ORDER_DELIVERED : ['Shipping'],
|
| 39 |
main.Store.ORDER_SHIPPED : ['In Transit'],
|
39 |
main.Store.ORDER_SHIPPED : ['In Transit'],
|
| 40 |
main.Store.ORDER_CANCELLED : ['']
|
40 |
main.Store.ORDER_CANCELLED : ['shipment is returned']
|
| 41 |
|
41 |
|
| 42 |
}
|
42 |
}
|
| 43 |
def __init__(self,store_id):
|
43 |
def __init__(self,store_id):
|
| 44 |
client = MongoClient('mongodb://localhost:27017/')
|
44 |
client = MongoClient('mongodb://localhost:27017/')
|
| 45 |
self.db = client.dtr
|
45 |
self.db = client.dtr
|
| Line 94... |
Line 94... |
| 94 |
divs = orderItem.findAll('div', recursive=False)
|
94 |
divs = orderItem.findAll('div', recursive=False)
|
| 95 |
orderTracking = divs[2]
|
95 |
orderTracking = divs[2]
|
| 96 |
orderTrackingDetDiv = divs[3].find('div',{'class':'c-tabs-content m-top active'})
|
96 |
orderTrackingDetDiv = divs[3].find('div',{'class':'c-tabs-content m-top active'})
|
| 97 |
orderTrackingDet = orderTrackingDetDiv.find('div',{'class':re.compile('tracking-remark')}).text
|
97 |
orderTrackingDet = orderTrackingDetDiv.find('div',{'class':re.compile('tracking-remark')}).text
|
| 98 |
updateMap["subOrders.$.detailedStatus"] = orderTrackingDet
|
98 |
updateMap["subOrders.$.detailedStatus"] = orderTrackingDet
|
| - |
|
99 |
status = self._getStatusFromDetailedStatus(orderTrackingDet)
|
| 99 |
tr = orderTracking.findAll("div",{"class":"tap-bullet-area c-tab-trigger"})
|
100 |
tr = orderTracking.findAll("div",{"class":"tap-bullet-area c-tab-trigger"})
|
| 100 |
|
101 |
|
| 101 |
cashbackStatus = subOrder.get("cashBackStatus")
|
102 |
cashbackStatus = subOrder.get("cashBackStatus")
|
| 102 |
if "approveDetails-complete" in str(tr):
|
103 |
if "approveDetails-complete" in str(tr):
|
| 103 |
if "processingDetails-complete" in str(tr):
|
104 |
if "processingDetails-complete" in str(tr):
|
| Line 120... |
Line 121... |
| 120 |
status = MStore.ORDER_PLACED
|
121 |
status = MStore.ORDER_PLACED
|
| 121 |
else:
|
122 |
else:
|
| 122 |
status = MStore.ORDER_PLACED
|
123 |
status = MStore.ORDER_PLACED
|
| 123 |
elif str(tr) in ["approveDetails-ongoing"]:
|
124 |
elif str(tr) in ["approveDetails-ongoing"]:
|
| 124 |
status=MStore.ORDER_PLACED
|
125 |
status=MStore.ORDER_PLACED
|
| 125 |
if "dead" in str(tr):
|
126 |
if "dead" in str(tr) or status==MStore.ORDER_CANCELLED:
|
| 126 |
status = MStore.ORDER_CANCELLED
|
127 |
status = MStore.ORDER_CANCELLED
|
| 127 |
closedStatus = True
|
128 |
closedStatus = True
|
| 128 |
if cashbackStatus == Store.CB_PENDING:
|
129 |
if cashbackStatus == Store.CB_PENDING:
|
| 129 |
cashbackStatus = Store.CB_CANCELLED
|
130 |
cashbackStatus = Store.CB_CANCELLED
|
| 130 |
|
131 |
|
| Line 323... |
Line 324... |
| 323 |
except:
|
324 |
except:
|
| 324 |
traceback.print_exc()
|
325 |
traceback.print_exc()
|
| 325 |
resp['result'] = 'ORDER_NOT_CREATED'
|
326 |
resp['result'] = 'ORDER_NOT_CREATED'
|
| 326 |
return resp
|
327 |
return resp
|
| 327 |
|
328 |
|
| - |
|
329 |
def _getStatusFromDetailedStatus(self, detailedStatus):
|
| - |
|
330 |
for key, value in Store.OrderStatusMap.iteritems():
|
| - |
|
331 |
if detailedStatus.lower() in value.lower():
|
| - |
|
332 |
return key
|
| - |
|
333 |
print "Detailed Status need to be mapped", detailedStatus
|
| - |
|
334 |
raise ParseException("_getStatusFromDetailedStatus", "Found new order status" + detailedStatus)
|
| 328 |
|
335 |
|
| 329 |
def flipkartOrderTracking(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
336 |
def flipkartOrderTracking(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
| 330 |
br = getBrowserObject()
|
337 |
br = getBrowserObject()
|
| 331 |
url = ORDER_TRACK_URL + re.findall('.*(\?.*?)$', orderSuccessUrl,re.IGNORECASE)[0]
|
338 |
url = ORDER_TRACK_URL + re.findall('.*(\?.*?)$', orderSuccessUrl,re.IGNORECASE)[0]
|
| 332 |
|
339 |
|