| Line 9... |
Line 9... |
| 9 |
from dtr.dao import AffiliateInfo, Order, SubOrder, FlipkartAffiliateInfo
|
9 |
from dtr.dao import AffiliateInfo, Order, SubOrder, FlipkartAffiliateInfo
|
| 10 |
from dtr.main import getBrowserObject, getStore, ParseException, ungzipResponse, \
|
10 |
from dtr.main import getBrowserObject, getStore, ParseException, ungzipResponse, \
|
| 11 |
Store as MStore, sourceMap, tprint
|
11 |
Store as MStore, sourceMap, tprint
|
| 12 |
from dtr.storage.DataService import Clicks, Users, FlipkartOrders
|
12 |
from dtr.storage.DataService import Clicks, Users, FlipkartOrders
|
| 13 |
from dtr.utils import utils
|
13 |
from dtr.utils import utils
|
| 14 |
from dtr.utils.utils import fetchResponseUsingProxy, todict, getSkuData
|
14 |
from dtr.utils.utils import fetchResponseUsingProxy, todict, getSkuData,\
|
| - |
|
15 |
ORDER_PLACED
|
| 15 |
from elixir import *
|
16 |
from elixir import *
|
| 16 |
from pprint import pprint
|
17 |
from pprint import pprint
|
| 17 |
from pymongo.mongo_client import MongoClient
|
18 |
from pymongo.mongo_client import MongoClient
|
| 18 |
import StringIO
|
19 |
import StringIO
|
| 19 |
import csv
|
20 |
import csv
|
| Line 376... |
Line 377... |
| 376 |
cashbackStatus = Store.CB_PENDING
|
377 |
cashbackStatus = Store.CB_PENDING
|
| 377 |
if cashbackAmount <= 0:
|
378 |
if cashbackAmount <= 0:
|
| 378 |
cashbackStatus = Store.CB_NA
|
379 |
cashbackStatus = Store.CB_NA
|
| 379 |
merchantsubOrder.cashBackAmount = cashbackAmount
|
380 |
merchantsubOrder.cashBackAmount = cashbackAmount
|
| 380 |
merchantsubOrder.cashBackStatus = cashbackStatus
|
381 |
merchantsubOrder.cashBackStatus = cashbackStatus
|
| 381 |
merchantsubOrder.cashBackPercentage = cashbackPercent
|
382 |
merchantsubOrder.cashBackPercentage = cashbackPercent
|
| - |
|
383 |
merchantsubOrder.detailedStatus = str(orderItem.find("div", "tracking-remark", recursive=True).text)
|
| 382 |
|
384 |
|
| 383 |
subOrders.append(merchantsubOrder)
|
385 |
subOrders.append(merchantsubOrder)
|
| 384 |
#To track shipping details
|
386 |
#To track shipping details
|
| 385 |
status=-1
|
387 |
status=ORDER_PLACED
|
| 386 |
tr = orderTracking.findAll("div",{"class":"tap-bullet-area c-tab-trigger"})
|
388 |
tr = orderTracking.findAll("div",{"class":"tap-bullet-area c-tab-trigger"})
|
| 387 |
if "approveDetails-complete" in str(tr):
|
389 |
if "approveDetails-complete" in str(tr):
|
| 388 |
if "processingDetails-complete" in str(tr):
|
390 |
if "processingDetails-complete" in str(tr):
|
| 389 |
if "shippingDetails-complete" in str(tr):
|
391 |
if "shippingDetails-complete" in str(tr):
|
| 390 |
if "delivery-complete" in str(tr):
|
392 |
if "delivery-complete" in str(tr):
|
| Line 398... |
Line 400... |
| 398 |
status = MStore.ORDER_PLACED
|
400 |
status = MStore.ORDER_PLACED
|
| 399 |
elif "approveDetails-ongoing" in str(tr):
|
401 |
elif "approveDetails-ongoing" in str(tr):
|
| 400 |
status=MStore.ORDER_PLACED
|
402 |
status=MStore.ORDER_PLACED
|
| 401 |
if "dead" in str(tr) or "shippingDetails-returnOngoing" in str(tr) or "shippingDetails-return" in str(tr):
|
403 |
if "dead" in str(tr) or "shippingDetails-returnOngoing" in str(tr) or "shippingDetails-return" in str(tr):
|
| 402 |
status = MStore.ORDER_CANCELLED
|
404 |
status = MStore.ORDER_CANCELLED
|
| 403 |
print "Sub Order Status " + str(status)
|
405 |
print "Sub Order Status " + str(status)
|
| 404 |
|
406 |
subOrder.status=status
|
| 405 |
trackingDetailsActive = orderTrackingDet.find("div",{"class":"c-tabs-content m-top active"})
|
- |
|
| 406 |
print "Sub order tracking description " + trackingDetailsActive.text
|
- |
|
| - |
|
407 |
|
| 407 |
if self._saveToOrder(todict(merchantOrder)):
|
408 |
if self._saveToOrder(todict(merchantOrder)):
|
| 408 |
resp['result'] = 'ORDER_CREATED'
|
409 |
resp['result'] = 'ORDER_CREATED'
|
| 409 |
else:
|
410 |
else:
|
| 410 |
resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
|
411 |
resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
|
| 411 |
|
412 |
|
| Line 432... |
Line 433... |
| 432 |
m = hashlib.md5()
|
433 |
m = hashlib.md5()
|
| 433 |
print(m.digest())
|
434 |
print(m.digest())
|
| 434 |
|
435 |
|
| 435 |
def main():
|
436 |
def main():
|
| 436 |
store = getStore(2)
|
437 |
store = getStore(2)
|
| 437 |
store.scrapeAffiliate(200)
|
438 |
store.parseOrderRawHtml(1, '123', 14, '', 'https://www.flipkart.com/rv/orderConfirmation/orderresponse?reference_id=OD5071037231594670&token=06919f2c830cb1a5ebb9d2798f602261')
|
| 438 |
|
439 |
|
| 439 |
if __name__ == '__main__':
|
440 |
if __name__ == '__main__':
|
| 440 |
main()
|
441 |
main()
|
| 441 |
|
442 |
|
| 442 |
|
443 |
|