| Line 501... |
Line 501... |
| 501 |
url = ORDER_TRACK_URL +'&'+ order['orderTrackingUrl'].split('trackOrder?')[1]
|
501 |
url = ORDER_TRACK_URL +'&'+ order['orderTrackingUrl'].split('trackOrder?')[1]
|
| 502 |
print url
|
502 |
print url
|
| 503 |
page = fetchResponseUsingProxy(url)
|
503 |
page = fetchResponseUsingProxy(url)
|
| 504 |
soup = BeautifulSoup(page)
|
504 |
soup = BeautifulSoup(page)
|
| 505 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
505 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
| - |
|
506 |
subbulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
| 506 |
closed = True
|
507 |
closed = True
|
| 507 |
orderIdSpan = soup.body.find("span", {'class':'price ord_no'})
|
508 |
orderIdSpan = soup.body.find("span", {'class':'price ord_no'})
|
| 508 |
if orderIdSpan is not None:
|
509 |
if orderIdSpan is not None:
|
| 509 |
orderStatusList = soup.findAll(attrs={'class' : 'price ord_status'})
|
510 |
orderStatusList = soup.findAll(attrs={'class' : 'price ord_status'})
|
| 510 |
if orderStatusList is not None and len(orderStatusList)>0:
|
511 |
if orderStatusList is not None and len(orderStatusList)>0:
|
| Line 551... |
Line 552... |
| 551 |
updateMap["subOrders.$.cashBackStatus"] = Store.CB_CANCELLED
|
552 |
updateMap["subOrders.$.cashBackStatus"] = Store.CB_CANCELLED
|
| 552 |
else:
|
553 |
else:
|
| 553 |
closed = False
|
554 |
closed = False
|
| 554 |
print 'Order not Closed'
|
555 |
print 'Order not Closed'
|
| 555 |
|
556 |
|
| 556 |
bulk.find(findMap).update({'$set' : updateMap})
|
557 |
subbulk.find(findMap).update({'$set' : updateMap})
|
| 557 |
result = bulk.execute()
|
558 |
subresult = subbulk.execute()
|
| 558 |
tprint(result)
|
559 |
tprint(subresult)
|
| 559 |
bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":False}})
|
560 |
bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":False}})
|
| 560 |
result = bulk.execute()
|
561 |
result = bulk.execute()
|
| 561 |
tprint(result)
|
562 |
tprint(result)
|
| 562 |
|
563 |
|
| 563 |
else:
|
564 |
else:
|
| Line 588... |
Line 589... |
| 588 |
elif status == Store.ORDER_CANCELLED:
|
589 |
elif status == Store.ORDER_CANCELLED:
|
| 589 |
if subOrder.get("cashBackStatus") == Store.CB_PENDING:
|
590 |
if subOrder.get("cashBackStatus") == Store.CB_PENDING:
|
| 590 |
updateMap["subOrders.$.cashBackStatus"] = Store.CB_CANCELLED
|
591 |
updateMap["subOrders.$.cashBackStatus"] = Store.CB_CANCELLED
|
| 591 |
else:
|
592 |
else:
|
| 592 |
closed = False
|
593 |
closed = False
|
| 593 |
bulk.find(findMap).update({'$set' : updateMap})
|
594 |
subbulk.find(findMap).update({'$set' : updateMap})
|
| 594 |
result = bulk.execute()
|
595 |
subresult = subbulk.execute()
|
| 595 |
tprint(result)
|
596 |
tprint(subresult)
|
| 596 |
bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":False}})
|
597 |
bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":False}})
|
| 597 |
result = bulk.execute()
|
598 |
result = bulk.execute()
|
| 598 |
tprint(result)
|
599 |
tprint(result)
|
| 599 |
else:
|
600 |
else:
|
| 600 |
print 'Soup Object not found for this Order', order['orderId'], order['orderTrackingUrl']
|
601 |
print 'Soup Object not found for this Order', order['orderId'], order['orderTrackingUrl']
|