| 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, to_t_insurer
|
| 10 |
to_t_insurer
|
- |
|
| 11 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
10 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 12 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
11 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 13 |
update_item, start_item_on, close_session, retire_item_on, \
|
12 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 14 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
13 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 15 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
14 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 30... |
Line 29... |
| 30 |
get_clearance_sale_catalog_ids, add_update_voucher_for_item, \
|
29 |
get_clearance_sale_catalog_ids, add_update_voucher_for_item, \
|
| 31 |
delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
|
30 |
delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
|
| 32 |
is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
|
31 |
is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
|
| 33 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
32 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
| 34 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list, \
|
33 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list, \
|
| 35 |
get_insurance_amount, get_insurer, get_all_alive_items,get_all_insurers
|
34 |
get_insurance_amount, get_insurer, get_all_alive_items,get_all_insurers, get_all_entity_tags
|
| 36 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
35 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 37 |
from shop2020.utils.Utils import log_entry, to_py_date
|
36 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 38 |
import datetime
|
37 |
import datetime
|
| 39 |
|
38 |
|
| 40 |
class CatalogServiceHandler:
|
39 |
class CatalogServiceHandler:
|
| Line 891... |
Line 890... |
| 891 |
insurers.append(to_t_insurer(insurer))
|
890 |
insurers.append(to_t_insurer(insurer))
|
| 892 |
finally:
|
891 |
finally:
|
| 893 |
return insurers
|
892 |
return insurers
|
| 894 |
close_session()
|
893 |
close_session()
|
| 895 |
|
894 |
|
| - |
|
895 |
def getAllEntityTags(self):
|
| - |
|
896 |
try:
|
| - |
|
897 |
return get_all_entity_tags()
|
| - |
|
898 |
finally:
|
| - |
|
899 |
close_session()
|
| - |
|
900 |
|
| - |
|
901 |
|
| 896 |
def is_valid(item):
|
902 |
def is_valid(item):
|
| 897 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
903 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 898 |
if item.startDate:
|
904 |
if item.startDate:
|
| 899 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
905 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
| 900 |
else:
|
906 |
else:
|