| Line 26... |
Line 26... |
| 26 |
con = None
|
26 |
con = None
|
| 27 |
|
27 |
|
| 28 |
DataService.initialize(db_hostname="localhost")
|
28 |
DataService.initialize(db_hostname="localhost")
|
| 29 |
mc = MemCache("127.0.0.1")
|
29 |
mc = MemCache("127.0.0.1")
|
| 30 |
|
30 |
|
| 31 |
SOURCE_MAP = {1:'AMAZON',2:'FLIPKART',3:'SNAPDEAL',4:'SAHOLIC',5:"SHOPCLUES.COM",6:"PAYTM.COM"}
|
31 |
SOURCE_MAP = {1:'AMAZON',2:'FLIPKART',3:'SNAPDEAL',4:'SAHOLIC',5:"SHOPCLUES.COM",6:"PAYTM.COM",7:"HOMESHOP18.COM"}
|
| 32 |
|
32 |
|
| 33 |
COLLECTION_MAP = {
|
33 |
COLLECTION_MAP = {
|
| 34 |
'ExceptionalNlc':'skuBundleId',
|
34 |
'ExceptionalNlc':'skuBundleId',
|
| 35 |
'SkuDealerPrices':'skuBundleId',
|
35 |
'SkuDealerPrices':'skuBundleId',
|
| 36 |
'SkuDiscountInfo':'skuBundleId',
|
36 |
'SkuDiscountInfo':'skuBundleId',
|
| Line 647... |
Line 647... |
| 647 |
return cashBack.get(category_id)
|
647 |
return cashBack.get(category_id)
|
| 648 |
else:
|
648 |
else:
|
| 649 |
return {}
|
649 |
return {}
|
| 650 |
|
650 |
|
| 651 |
def getBundleBySourceSku(source_id, identifier):
|
651 |
def getBundleBySourceSku(source_id, identifier):
|
| 652 |
if source_id in (1,2,4,5):
|
652 |
if source_id in (1,2,4,5,6,7):
|
| 653 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
653 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
| 654 |
elif source_id == 3:
|
654 |
elif source_id == 3:
|
| 655 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
655 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
| 656 |
else:
|
656 |
else:
|
| 657 |
return {}
|
657 |
return {}
|
| 658 |
|
658 |
|
| 659 |
if not skuData:
|
659 |
if not skuData:
|
| 660 |
return {}
|
660 |
return {}
|
| 661 |
else:
|
661 |
else:
|
| 662 |
bundleId = skuData[0]["skuBundleId"]
|
662 |
bundleId = skuData[0]["skuBundleId"]
|
| 663 |
itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bundleId, 'in_stock':1, 'source_id':{"$in":[1,2,3,5]}},
|
663 |
itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bundleId, 'in_stock':1, 'source_id':{"$in":[1,2,3,5,6,7]}},
|
| 664 |
{"source_id":1, "available_price":1, "marketPlaceUrl":1, "gross_price":1, "codAvailable":1, "source_product_name":1, "offer":1, "coupon":1}))
|
664 |
{"source_id":1, "available_price":1, "marketPlaceUrl":1, "gross_price":1, "codAvailable":1, "source_product_name":1, "offer":1, "coupon":1}))
|
| 665 |
return {'products':itemIds}
|
665 |
return {'products':itemIds}
|
| 666 |
|
666 |
|
| 667 |
|
667 |
|
| 668 |
|
668 |
|
| 669 |
def getDealRank(identifier, source_id, userId):
|
669 |
def getDealRank(identifier, source_id, userId):
|
| 670 |
if source_id in (1,2,4,5,6):
|
670 |
if source_id in (1,2,4,5,6,7):
|
| 671 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
671 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
| 672 |
elif source_id == 3:
|
672 |
elif source_id == 3:
|
| 673 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
673 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
| 674 |
else:
|
674 |
else:
|
| 675 |
return {'rank':0, 'description':'Source not valid','maxNlc':None, 'minNlc':None,'status':None,'dp':None}
|
675 |
return {'rank':0, 'description':'Source not valid','maxNlc':None, 'minNlc':None,'status':None,'dp':None}
|
| Line 714... |
Line 714... |
| 714 |
|
714 |
|
| 715 |
def getCashBackDetails(identifier, source_id):
|
715 |
def getCashBackDetails(identifier, source_id):
|
| 716 |
if not bool(mc.get("category_cash_back")):
|
716 |
if not bool(mc.get("category_cash_back")):
|
| 717 |
populateCashBack()
|
717 |
populateCashBack()
|
| 718 |
|
718 |
|
| 719 |
if source_id in (1,2,4,5,6):
|
719 |
if source_id in (1,2,4,5,6,7):
|
| 720 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
720 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
|
| 721 |
elif source_id == 3:
|
721 |
elif source_id == 3:
|
| 722 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
722 |
skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
|
| 723 |
else:
|
723 |
else:
|
| 724 |
return {}
|
724 |
return {}
|
| Line 740... |
Line 740... |
| 740 |
else:
|
740 |
else:
|
| 741 |
return {}
|
741 |
return {}
|
| 742 |
|
742 |
|
| 743 |
def getImgSrc(identifier, source_id):
|
743 |
def getImgSrc(identifier, source_id):
|
| 744 |
skuData = None
|
744 |
skuData = None
|
| 745 |
if source_id in (1,2,4,5,6):
|
745 |
if source_id in (1,2,4,5,6,7):
|
| 746 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'identifier':identifier.strip(), 'source_id':source_id})
|
746 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'identifier':identifier.strip(), 'source_id':source_id})
|
| 747 |
elif source_id == 3:
|
747 |
elif source_id == 3:
|
| 748 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'secondaryIdentifier':identifier.strip(), 'source_id':source_id})
|
748 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'secondaryIdentifier':identifier.strip(), 'source_id':source_id})
|
| 749 |
if skuData is None:
|
749 |
if skuData is None:
|
| 750 |
return {}
|
750 |
return {}
|
| Line 1301... |
Line 1301... |
| 1301 |
def getItemObjForStaticDeals(item):
|
1301 |
def getItemObjForStaticDeals(item):
|
| 1302 |
return {'marketPlaceUrl':item.get('marketPlaceUrl'),'available_price':item.get('available_price'),'source_product_name':item.get('source_product_name'),'thumbnail':item.get('thumbnail'),'source_id':int(item.get('source_id'))}
|
1302 |
return {'marketPlaceUrl':item.get('marketPlaceUrl'),'available_price':item.get('available_price'),'source_product_name':item.get('source_product_name'),'thumbnail':item.get('thumbnail'),'source_id':int(item.get('source_id'))}
|
| 1303 |
|
1303 |
|
| 1304 |
def getItemByMerchantIdentifier(identifier, source_id):
|
1304 |
def getItemByMerchantIdentifier(identifier, source_id):
|
| 1305 |
skuData = None
|
1305 |
skuData = None
|
| 1306 |
if source_id in (1,2,4,5,6):
|
1306 |
if source_id in (1,2,4,5,6,7):
|
| 1307 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'identifier':identifier.strip(), 'source_id':source_id})
|
1307 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'identifier':identifier.strip(), 'source_id':source_id})
|
| 1308 |
elif source_id == 3:
|
1308 |
elif source_id == 3:
|
| 1309 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'secondaryIdentifier':identifier.strip(), 'source_id':source_id})
|
1309 |
skuData = get_mongo_connection().Catalog.MasterData.find_one({'secondaryIdentifier':identifier.strip(), 'source_id':source_id})
|
| 1310 |
if skuData is None:
|
1310 |
if skuData is None:
|
| 1311 |
return {}
|
1311 |
return {}
|
| Line 1651... |
Line 1651... |
| 1651 |
print 'No Offers'
|
1651 |
print 'No Offers'
|
| 1652 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
1652 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
| 1653 |
|
1653 |
|
| 1654 |
|
1654 |
|
| 1655 |
def main():
|
1655 |
def main():
|
| 1656 |
#generateRedirectUrl(101,1
|
1656 |
#generateRedirectUrl(101,1)
|
| 1657 |
print getCashBackDetails('1351153', 3)
|
1657 |
print getCashBackDetails('1351153', 3)
|
| 1658 |
#print addPayout("10", "55db82c0bcabd7fc59e0a71")
|
1658 |
#print addPayout("10", "55db82c0bcabd7fc59e0a71")
|
| 1659 |
|
1659 |
|
| 1660 |
|
1660 |
|
| 1661 |
|
1661 |
|