| Line 7... |
Line 7... |
| 7 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_category, \
|
7 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_category, \
|
| 8 |
to_t_source_item_pricing, to_t_product_notification_request, \
|
8 |
to_t_source_item_pricing, to_t_product_notification_request, \
|
| 9 |
to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer, \
|
9 |
to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer, \
|
| 10 |
to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
|
10 |
to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
|
| 11 |
to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
|
11 |
to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
|
| 12 |
to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item
|
12 |
to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item,to_t_snapdeal_item_details
|
| 13 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
13 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 14 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
14 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 15 |
update_item, start_item_on, close_session, retire_item_on, \
|
15 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 16 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
16 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 17 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
17 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 47... |
Line 47... |
| 47 |
insert_ebay_item, get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
|
47 |
insert_ebay_item, get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
|
| 48 |
get_all_items_to_list_on_fba,get_all_items_to_list_on_nonfba, \
|
48 |
get_all_items_to_list_on_fba,get_all_items_to_list_on_nonfba, \
|
| 49 |
update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
|
49 |
update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
|
| 50 |
delete_campaign, get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
|
50 |
delete_campaign, get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
|
| 51 |
get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
|
51 |
get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
|
| 52 |
add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items, \
|
52 |
add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items , get_snapdeal_items, \
|
| - |
|
53 |
search_snapdeal_items , get_count_for_snapdeal_items , get_snapdeal_search_result_count, \
|
| 53 |
get_active_banners_for_mobile_site
|
54 |
get_active_banners_for_mobile_site
|
| 54 |
|
- |
|
| 55 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
55 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 56 |
from shop2020.utils.Utils import log_entry, to_py_date
|
56 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 57 |
import datetime
|
57 |
import datetime
|
| 58 |
|
58 |
|
| 59 |
class CatalogServiceHandler:
|
59 |
class CatalogServiceHandler:
|
| Line 1262... |
Line 1262... |
| 1262 |
def updateAsin(self,amazonAsinMap):
|
1262 |
def updateAsin(self,amazonAsinMap):
|
| 1263 |
try:
|
1263 |
try:
|
| 1264 |
update_asin(amazonAsinMap)
|
1264 |
update_asin(amazonAsinMap)
|
| 1265 |
finally:
|
1265 |
finally:
|
| 1266 |
close_session()
|
1266 |
close_session()
|
| 1267 |
|
- |
|
| 1268 |
|
- |
|
| 1269 |
def getAllSnapdealListedActiveItems(self):
|
- |
|
| 1270 |
try:
|
- |
|
| 1271 |
items = get_all_alive_items()
|
- |
|
| 1272 |
ret_items = []
|
- |
|
| 1273 |
for item in items:
|
- |
|
| 1274 |
if item.isListedOnSnapdeal:
|
- |
|
| 1275 |
ret_items.append(to_t_item(item))
|
- |
|
| 1276 |
return ret_items
|
- |
|
| 1277 |
finally:
|
- |
|
| 1278 |
close_session()
|
- |
|
| 1279 |
|
1267 |
|
| 1280 |
def addOrUpdateSnapdealItem(self,snapdealitem):
|
1268 |
def addOrUpdateSnapdealItem(self,snapdealitem):
|
| 1281 |
try:
|
1269 |
try:
|
| 1282 |
return add_or_update_snapdeal_item(snapdealitem)
|
1270 |
return add_or_update_snapdeal_item(snapdealitem)
|
| 1283 |
finally:
|
1271 |
finally:
|
| Line 1286... |
Line 1274... |
| 1286 |
def getSnapdealItem(self,item_id):
|
1274 |
def getSnapdealItem(self,item_id):
|
| 1287 |
try:
|
1275 |
try:
|
| 1288 |
return to_t_snapdeal_item(get_snapdeal_item(item_id))
|
1276 |
return to_t_snapdeal_item(get_snapdeal_item(item_id))
|
| 1289 |
finally:
|
1277 |
finally:
|
| 1290 |
close_session()
|
1278 |
close_session()
|
| - |
|
1279 |
|
| - |
|
1280 |
def getSnapdealItemDetails(self,item_id):
|
| - |
|
1281 |
try:
|
| - |
|
1282 |
return to_t_snapdeal_item_details(get_snapdeal_item(item_id))
|
| - |
|
1283 |
finally:
|
| - |
|
1284 |
close_session()
|
| 1291 |
|
1285 |
|
| 1292 |
def getAllSnapdealItems(self):
|
1286 |
def getAllSnapdealItems(self):
|
| 1293 |
try:
|
1287 |
try:
|
| 1294 |
items = get_all_snapdeal_items()
|
1288 |
items = get_all_snapdeal_items()
|
| 1295 |
return [to_t_snapdeal_item(item) for item in items]
|
1289 |
return [to_t_snapdeal_item_details(item) for item in items]
|
| 1296 |
finally:
|
1290 |
finally:
|
| 1297 |
close_session()
|
1291 |
close_session()
|
| - |
|
1292 |
|
| - |
|
1293 |
def getSnapdealItems(self,offset,limit):
|
| - |
|
1294 |
try:
|
| - |
|
1295 |
items = get_snapdeal_items(offset,limit)
|
| - |
|
1296 |
return [to_t_snapdeal_item_details(item) for item in items]
|
| - |
|
1297 |
finally:
|
| - |
|
1298 |
close_session()
|
| - |
|
1299 |
|
| - |
|
1300 |
def searchSnapdealItems(self,searchterm,offset,limit):
|
| - |
|
1301 |
try:
|
| - |
|
1302 |
snapdealitems = []
|
| - |
|
1303 |
search_result = search_snapdeal_items(searchterm,offset,limit)
|
| - |
|
1304 |
for snapdealitem in search_result:
|
| - |
|
1305 |
snapdealitems.append(to_t_snapdeal_item_details(snapdealitem))
|
| - |
|
1306 |
finally:
|
| - |
|
1307 |
close_session()
|
| - |
|
1308 |
return snapdealitems
|
| - |
|
1309 |
|
| - |
|
1310 |
def getCountForSnapdealItems(self):
|
| - |
|
1311 |
try:
|
| - |
|
1312 |
return get_count_for_snapdeal_items()
|
| - |
|
1313 |
finally:
|
| - |
|
1314 |
close_session()
|
| - |
|
1315 |
|
| - |
|
1316 |
|
| - |
|
1317 |
def getSnapdealSearchResultCount(self,searchterms):
|
| - |
|
1318 |
try:
|
| - |
|
1319 |
return get_snapdeal_search_result_count(searchterms)
|
| - |
|
1320 |
finally:
|
| - |
|
1321 |
close_session()
|
| 1298 |
|
1322 |
|
| 1299 |
def is_valid(item):
|
1323 |
def is_valid(item):
|
| 1300 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
1324 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 1301 |
if item.startDate:
|
1325 |
if item.startDate:
|
| 1302 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
1326 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|