| Line 6... |
Line 6... |
| 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, 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, \
|
10 |
to_t_banner,to_t_banner_map, \
|
| 11 |
to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer
|
11 |
to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer,to_t_Amazonlisted
|
| 12 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
12 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 13 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
13 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 14 |
update_item, start_item_on, close_session, retire_item_on, \
|
14 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 15 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
15 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 16 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
16 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 34... |
Line 34... |
| 34 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
34 |
get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
|
| 35 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list,add_banner,get_all_banners, \
|
35 |
delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list,add_banner,get_all_banners, \
|
| 36 |
delete_banner,get_banner_details,get_active_banners,add_banner_map,delete_banner_map,get_banner_map_details, \
|
36 |
delete_banner,get_banner_details,get_active_banners,add_banner_map,delete_banner_map,get_banner_map_details, \
|
| 37 |
get_insurance_amount, get_insurer, get_all_alive_items,get_all_insurers, get_all_entity_tags,\
|
37 |
get_insurance_amount, get_insurer, get_all_alive_items,get_all_insurers, get_all_entity_tags,\
|
| 38 |
update_insurance_declared_amount, get_freebie_for_item, add_or_update_freebie_for_item,\
|
38 |
update_insurance_declared_amount, get_freebie_for_item, add_or_update_freebie_for_item,\
|
| 39 |
get_store_pricing, update_store_pricing
|
39 |
get_store_pricing, update_store_pricing,\
|
| - |
|
40 |
get_all_amazon_listed_items, get_amazon_item_details,update_amazon_item_details,add_amazon_item
|
| 40 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
41 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 41 |
from shop2020.utils.Utils import log_entry, to_py_date
|
42 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 42 |
import datetime
|
43 |
import datetime
|
| 43 |
|
44 |
|
| 44 |
class CatalogServiceHandler:
|
45 |
class CatalogServiceHandler:
|
| Line 1038... |
Line 1039... |
| 1038 |
try:
|
1039 |
try:
|
| 1039 |
return update_store_pricing(sp)
|
1040 |
return update_store_pricing(sp)
|
| 1040 |
finally:
|
1041 |
finally:
|
| 1041 |
close_session()
|
1042 |
close_session()
|
| 1042 |
|
1043 |
|
| - |
|
1044 |
def getAllAmazonListedItems(self):
|
| - |
|
1045 |
try:
|
| - |
|
1046 |
amazonlisteditems = []
|
| - |
|
1047 |
all_listed = get_all_amazon_listed_items()
|
| - |
|
1048 |
for amazonlisteditem in all_listed:
|
| - |
|
1049 |
amazonlisteditems.append(to_t_Amazonlisted(amazonlisteditem))
|
| - |
|
1050 |
return amazonlisteditems
|
| - |
|
1051 |
finally:
|
| - |
|
1052 |
close_session()
|
| - |
|
1053 |
|
| - |
|
1054 |
def getAmazonItemDetails(self, amazonItemId):
|
| - |
|
1055 |
result = None
|
| - |
|
1056 |
try:
|
| - |
|
1057 |
result = get_amazon_item_details(amazonItemId)
|
| - |
|
1058 |
if result is not None:
|
| - |
|
1059 |
result = to_t_Amazonlisted(result)
|
| - |
|
1060 |
except:
|
| - |
|
1061 |
return None
|
| - |
|
1062 |
finally:
|
| - |
|
1063 |
close_session()
|
| - |
|
1064 |
return result
|
| - |
|
1065 |
|
| - |
|
1066 |
def updateAmazonItemDetails(self,amazonItemId,fbaPrice,sellingPrice,isFba,isNonFba,isInventoryOverride):
|
| - |
|
1067 |
try:
|
| - |
|
1068 |
update_amazon_item_details(amazonItemId,fbaPrice,sellingPrice,isFba,isNonFba,isInventoryOverride)
|
| - |
|
1069 |
finally:
|
| - |
|
1070 |
close_session()
|
| - |
|
1071 |
|
| - |
|
1072 |
def addAmazonItem(self,amazonlisted):
|
| - |
|
1073 |
try:
|
| - |
|
1074 |
print amazonlisted
|
| - |
|
1075 |
add_amazon_item(amazonlisted)
|
| - |
|
1076 |
finally:
|
| - |
|
1077 |
close_session()
|
| - |
|
1078 |
|
| - |
|
1079 |
|
| 1043 |
def is_valid(item):
|
1080 |
def is_valid(item):
|
| 1044 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
1081 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 1045 |
if item.startDate:
|
1082 |
if item.startDate:
|
| 1046 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
1083 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
| 1047 |
else:
|
1084 |
else:
|