| Line 472... |
Line 472... |
| 472 |
dateString = orderStatus.split("Delivered ")[1].strip()
|
472 |
dateString = orderStatus.split("Delivered ")[1].strip()
|
| 473 |
status = MStore.ORDER_DELIVERED
|
473 |
status = MStore.ORDER_DELIVERED
|
| 474 |
deliveredOn = datetime.strftime(getDateStringDelivered(dateString), '%d-%b-%y')
|
474 |
deliveredOn = datetime.strftime(getDateStringDelivered(dateString), '%d-%b-%y')
|
| 475 |
except:
|
475 |
except:
|
| 476 |
try:
|
476 |
try:
|
| 477 |
dateString = sdivs[0].span.text.strip().split("Arriving ")[1].strip()
|
477 |
dateString = sdivs[0].span.text.strip().split("Arriving ")[1].split("by")[0].strip()
|
| 478 |
status = MStore.ORDER_SHIPPED
|
478 |
status = MStore.ORDER_SHIPPED
|
| 479 |
deliveryEstimate = datetime.strftime(getDateStringArriving(dateString), '%d-%b-%y')
|
479 |
deliveryEstimate = datetime.strftime(getDateStringArriving(dateString), '%d-%b-%y')
|
| 480 |
except:
|
480 |
except:
|
| 481 |
print "Unknown status Alert -", orderStatus
|
481 |
print "Unknown status Alert -", orderStatus
|
| 482 |
print "Order Status", orderStatus
|
482 |
print "Order Status", orderStatus
|
| 483 |
try:
|
483 |
try:
|
| 484 |
orderStatusDesc = sdivs[0].findAll('div')[1].div.text.strip()
|
484 |
orderStatusDesc = sdivs[0].findAll('div')[1].div.text.strip()
|
| 485 |
except:
|
485 |
except:
|
| - |
|
486 |
try:
|
| 486 |
orderStatusDesc = sdivs[0].findAll('div')[1].text.strip()
|
487 |
orderStatusDesc = sdivs[0].findAll('div')[1].text.strip()
|
| - |
|
488 |
except:
|
| - |
|
489 |
pass
|
| 487 |
|
490 |
|
| 488 |
print "Order Status Description", (orderStatusDesc if orderStatusDesc else "None or empty")
|
491 |
if orderStatusDesc:
|
| 489 |
try:
|
492 |
try:
|
| 490 |
if "Dispatch estimate" in orderStatusDesc:
|
493 |
if "Dispatch estimate" in orderStatusDesc:
|
| 491 |
shippingEstimate = orderStatus.split("Dispatch estimate").split("-")[0].strip()
|
494 |
shippingEstimate = orderStatus.split("Dispatch estimate").split("-")[0].strip()
|
| 492 |
elif "Delivery estimate" in orderStatus:
|
495 |
elif "Delivery estimate" in orderStatus:
|
| 493 |
deliveryEstimate = orderStatus.split("Delivery estimate").split("-")[0].strip()
|
496 |
deliveryEstimate = orderStatus.split("Delivery estimate").split("-")[0].strip()
|
| 494 |
elif "Arriving" in orderStatus:
|
497 |
elif "Arriving" in orderStatus:
|
| 495 |
deliveryEstimate = datetime.strftime(getDateStringArriving(orderStatus.split("Arriving")[1].strip()), '%d-%b-%y')
|
498 |
deliveryEstimate = datetime.strftime(getDateStringArriving(orderStatus.split("Arriving")[1].strip().split("by")[0].strip()), '%d-%b-%y')
|
| 496 |
except:
|
499 |
except:
|
| 497 |
print "Could not find anything relevent for merchantOrder", merchantOrderId, "and User", userId
|
500 |
print "Could not find anything relevent for merchantOrder", merchantOrderId, "and User", userId
|
| 498 |
closed=False
|
501 |
closed=False
|
| 499 |
status = None
|
502 |
status = None
|
| - |
|
503 |
else:
|
| - |
|
504 |
print "Order Status Description None or empty for", merchantOrderId, "and User", userId
|
| 500 |
|
505 |
|
| 501 |
productDivs = shipdiv.find('div', {'class':re.compile('.*?a-spacing-top-medium.*?')}).find('div', {'class':'a-row'}).findAll('div', recursive=False)
|
506 |
productDivs = shipdiv.find('div', {'class':re.compile('.*?a-spacing-top-medium.*?')}).find('div', {'class':'a-row'}).findAll('div', recursive=False)
|
| 502 |
trackingUrl = None
|
507 |
trackingUrl = None
|
| 503 |
for buttonDiv in shipdiv.findAll('span', {'class':'a-button-inner'}):
|
508 |
for buttonDiv in shipdiv.findAll('span', {'class':'a-button-inner'}):
|
| 504 |
if buttonDiv.find('a').text.strip()=='Track package':
|
509 |
if buttonDiv.find('a').text.strip()=='Track package':
|
| Line 521... |
Line 526... |
| 521 |
updateMap['subOrders.$.detailedStatus'] = status
|
526 |
updateMap['subOrders.$.detailedStatus'] = status
|
| 522 |
updateMap['subOrders.$.status'] = status
|
527 |
updateMap['subOrders.$.status'] = status
|
| 523 |
cashbackStatus = subOrder.get("cashBackStatus")
|
528 |
cashbackStatus = subOrder.get("cashBackStatus")
|
| 524 |
|
529 |
|
| 525 |
if status==MStore.ORDER_DELIVERED:
|
530 |
if status==MStore.ORDER_DELIVERED:
|
| 526 |
if not deliveredOn:
|
531 |
if deliveredOn:
|
| 527 |
updateMap['subOrders.$.deliveredOn'] = deliveredOn
|
532 |
updateMap['subOrders.$.deliveredOn'] = deliveredOn
|
| 528 |
closedStatus = True
|
533 |
closedStatus = True
|
| 529 |
updateMap['subOrders.$.closed'] = True
|
534 |
updateMap['subOrders.$.closed'] = True
|
| 530 |
if cashbackStatus == Store.CB_PENDING:
|
535 |
if cashbackStatus == Store.CB_PENDING:
|
| 531 |
updateMap['subOrders.$.cashBackStatus'] = Store.CB_APPROVED
|
536 |
updateMap['subOrders.$.cashBackStatus'] = Store.CB_APPROVED
|
| Line 823... |
Line 828... |
| 823 |
|
828 |
|
| 824 |
finally:
|
829 |
finally:
|
| 825 |
session.close()
|
830 |
session.close()
|
| 826 |
|
831 |
|
| 827 |
if __name__ == '__main__':
|
832 |
if __name__ == '__main__':
|
| 828 |
readSSh("/AmazonTrack/User3330/orderSummary14-10:23:03:13")
|
833 |
#readSSh("/AmazonTrack/User8110/orderSummary15-10:14:43:25")
|
| 829 |
main()
|
834 |
main()
|
| 830 |
#getDateStringArriving()
|
835 |
#getDateStringArriving()
|
| 831 |
|
836 |
|