| 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,to_t_snapdeal_item_details
|
12 |
to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
|
| - |
|
13 |
to_t_snapdeal_item_details, to_t_product_feed_submit
|
| 13 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
14 |
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, \
|
15 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 15 |
update_item, start_item_on, close_session, retire_item_on, \
|
16 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 16 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
17 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 17 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
18 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 49... |
Line 50... |
| 49 |
update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
|
50 |
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, \
|
51 |
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, \
|
52 |
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 , get_snapdeal_items, \
|
53 |
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, \
|
54 |
search_snapdeal_items , get_count_for_snapdeal_items , get_snapdeal_search_result_count, \
|
| 54 |
get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal
|
55 |
get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
|
| - |
|
56 |
get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
|
| - |
|
57 |
delete_product_feed_submit, get_all_product_feed_submit
|
| 55 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
58 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 56 |
from shop2020.utils.Utils import log_entry, to_py_date
|
59 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 57 |
import datetime
|
60 |
import datetime
|
| 58 |
|
61 |
|
| 59 |
class CatalogServiceHandler:
|
62 |
class CatalogServiceHandler:
|
| Line 1331... |
Line 1334... |
| 1331 |
try:
|
1334 |
try:
|
| 1332 |
return to_t_snapdeal_item(get_snapdealitem_by_skuatsnapdeal(skuatsnapdeal))
|
1335 |
return to_t_snapdeal_item(get_snapdealitem_by_skuatsnapdeal(skuatsnapdeal))
|
| 1333 |
finally:
|
1336 |
finally:
|
| 1334 |
close_session()
|
1337 |
close_session()
|
| 1335 |
|
1338 |
|
| - |
|
1339 |
def getProductFeedSubmit(self, catalog_itemId):
|
| - |
|
1340 |
try:
|
| - |
|
1341 |
return to_t_product_feed_submit(get_product_feed_submit(catalog_itemId))
|
| - |
|
1342 |
finally:
|
| - |
|
1343 |
close_session()
|
| - |
|
1344 |
|
| - |
|
1345 |
def addProductFeedSubmit(self, productFeedSubmit):
|
| - |
|
1346 |
try:
|
| - |
|
1347 |
return add_product_feed_submit(productFeedSubmit)
|
| - |
|
1348 |
finally:
|
| - |
|
1349 |
close_session()
|
| - |
|
1350 |
|
| - |
|
1351 |
def updateProductFeedSubmit(self, productFeedSubmit):
|
| - |
|
1352 |
try:
|
| - |
|
1353 |
return update_product_feed_submit(productFeedSubmit)
|
| - |
|
1354 |
finally:
|
| - |
|
1355 |
close_session()
|
| - |
|
1356 |
|
| - |
|
1357 |
def deleteProductFeedSubmit(self, catalog_itemId):
|
| - |
|
1358 |
try:
|
| - |
|
1359 |
return delete_product_feed_submit(catalog_itemId)
|
| - |
|
1360 |
finally:
|
| - |
|
1361 |
close_session()
|
| - |
|
1362 |
|
| - |
|
1363 |
def getAllProductFeedSubmit(self):
|
| - |
|
1364 |
try:
|
| - |
|
1365 |
log_entry(self, "all ProductFeedSubmit requested")
|
| - |
|
1366 |
feedSubmits = get_all_product_feed_submit()
|
| - |
|
1367 |
ret_feedSubmits = []
|
| - |
|
1368 |
for feedSubmit in feedSubmits:
|
| - |
|
1369 |
if feedSubmit:
|
| - |
|
1370 |
ret_feedSubmits.append(to_t_product_feed_submit(feedSubmit))
|
| - |
|
1371 |
return ret_feedSubmits
|
| - |
|
1372 |
finally:
|
| - |
|
1373 |
close_session()
|
| - |
|
1374 |
|
| 1336 |
def is_valid(item):
|
1375 |
def is_valid(item):
|
| 1337 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
1376 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 1338 |
if item.startDate:
|
1377 |
if item.startDate:
|
| 1339 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
1378 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
| 1340 |
else:
|
1379 |
else:
|