| Line 4... |
Line 4... |
| 4 |
@author: ashish
|
4 |
@author: ashish
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
6 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 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
|
9 |
to_t_product_notification_request_count, to_t_voucher_item_mapping, \
|
| - |
|
10 |
to_t_insurer
|
| 10 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
11 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 11 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
12 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 12 |
update_item, start_item_on, close_session, retire_item_on, \
|
13 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 13 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
14 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 14 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
15 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 28... |
Line 29... |
| 28 |
get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count, initialize, \
|
29 |
get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count, initialize, \
|
| 29 |
get_clearance_sale_catalog_ids, add_update_voucher_for_item, \
|
30 |
get_clearance_sale_catalog_ids, add_update_voucher_for_item, \
|
| 30 |
delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
|
31 |
delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
|
| 31 |
is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
|
32 |
is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
|
| 32 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
33 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
| 33 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list
|
34 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list, \
|
| - |
|
35 |
get_insurance_amount, get_insurer
|
| 34 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
36 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 35 |
from shop2020.utils.Utils import log_entry, to_py_date
|
37 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 36 |
import datetime
|
38 |
import datetime
|
| 37 |
|
39 |
|
| 38 |
class CatalogServiceHandler:
|
40 |
class CatalogServiceHandler:
|
| Line 849... |
Line 851... |
| 849 |
def getAllIgnoredInventoryUpdateItemsList(self,offset, limit):
|
851 |
def getAllIgnoredInventoryUpdateItemsList(self,offset, limit):
|
| 850 |
try:
|
852 |
try:
|
| 851 |
return get_all_ignored_inventoryupdate_items_list(offset,limit)
|
853 |
return get_all_ignored_inventoryupdate_items_list(offset,limit)
|
| 852 |
finally:
|
854 |
finally:
|
| 853 |
close_session
|
855 |
close_session
|
| - |
|
856 |
|
| - |
|
857 |
def getInsuranceAmount(self, itemId, insurerId, quantity):
|
| - |
|
858 |
try:
|
| - |
|
859 |
return get_insurance_amount(itemId, insurerId, quantity)
|
| - |
|
860 |
finally:
|
| - |
|
861 |
close_session
|
| - |
|
862 |
|
| - |
|
863 |
def getInsurer(self, insurerId):
|
| - |
|
864 |
try:
|
| - |
|
865 |
return to_t_insurer(get_insurer(insurerId))
|
| - |
|
866 |
finally:
|
| - |
|
867 |
close_session
|
| 854 |
|
868 |
|
| 855 |
def is_valid(item):
|
869 |
def is_valid(item):
|
| 856 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
870 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 857 |
if item.startDate:
|
871 |
if item.startDate:
|
| 858 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
872 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|