Subversion Repositories SmartDukaan

Rev

Rev 7382 | Rev 7460 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7382 Rev 7438
Line 5... Line 5...
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, 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, to_t_product_notification_request_count, \
11
    to_t_product_notification_request_count, to_t_voucher_item_mapping, to_t_insurer,to_t_Amazonlisted
11
    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 26... Line 26...
26
    search_items, get_search_result_count, get_product_notifications, \
26
    search_items, get_search_result_count, get_product_notifications, \
27
    get_product_notification_request_count, get_all_similar_items_catalog_ids, \
27
    get_product_notification_request_count, get_all_similar_items_catalog_ids, \
28
    add_similar_item_catalog_id, delete_similar_item_catalog_id, \
28
    add_similar_item_catalog_id, delete_similar_item_catalog_id, \
29
    add_authorization_log_for_item, get_thrift_item_list, get_all_brands, \
29
    add_authorization_log_for_item, get_thrift_item_list, get_all_brands, \
30
    get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count, initialize, \
30
    get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count, initialize, \
31
    add_update_voucher_for_item, \
31
    add_update_voucher_for_item, delete_voucher_for_item, get_voucher_amount, \
32
    delete_voucher_for_item, get_voucher_amount, get_all_vouchers_for_item, \
32
    get_all_vouchers_for_item, is_valid_catalog_id, check_risky_item, \
33
    is_valid_catalog_id, check_risky_item, get_vat_percentage_for_item, \
33
    get_vat_percentage_for_item, get_vat_amount_for_item, add_tag, get_all_tags, \
34
    get_vat_amount_for_item, add_tag, get_all_tags, get_all_entities_by_tag_name, \
34
    get_all_entities_by_tag_name, delete_tag, delete_entity_tag, \
35
    delete_tag, delete_entity_tag, get_all_ignored_inventoryupdate_items_list,add_banner,get_all_banners, \
35
    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, \
-
 
37
    delete_banner_map, get_banner_map_details, get_insurance_amount, get_insurer, \
37
    get_insurance_amount, get_insurer, get_all_alive_items,get_all_insurers, get_all_entity_tags,\
38
    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, get_all_amazon_listed_items, \
39
    update_insurance_declared_amount, get_freebie_for_item, \
-
 
40
    add_or_update_freebie_for_item, get_all_amazon_listed_items, get_store_pricing, \
39
    get_store_pricing, update_store_pricing,\
41
    update_store_pricing, get_amazon_item_details, update_amazon_item_details, \
40
    get_amazon_item_details,update_amazon_item_details,add_amazon_item,get_asin_items,get_all_fba_listed_items,get_all_nonfba_listed_items,\
42
    add_amazon_item, get_asin_items, get_all_fba_listed_items, \
41
    add_or_update_brand_info, get_brand_info
43
    get_all_nonfba_listed_items, add_or_update_brand_info, get_brand_info, \
-
 
44
    get_items_status
42
from shop2020.thriftpy.model.v1.catalog.ttypes import status
45
from shop2020.thriftpy.model.v1.catalog.ttypes import status
43
from shop2020.utils.Utils import log_entry, to_py_date
46
from shop2020.utils.Utils import log_entry, to_py_date
44
import datetime
47
import datetime
45
 
48
 
46
class CatalogServiceHandler:
49
class CatalogServiceHandler:
Line 238... Line 241...
238
        """
241
        """
239
        try:
242
        try:
240
            return is_active(item_id)
243
            return is_active(item_id)
241
        finally:
244
        finally:
242
            close_session()
245
            close_session()
-
 
246
    
-
 
247
    def getItemsStatus(self, item_ids):
-
 
248
        """
-
 
249
        Parameters:
-
 
250
         - item_id
-
 
251
        """
-
 
252
        try:
-
 
253
            return get_items_status(item_ids)
-
 
254
        finally:
-
 
255
            close_session()
243
 
256
 
244
    def getItemStatusDescription(self, itemId):
257
    def getItemStatusDescription(self, itemId):
245
        """
258
        """
246
        Parameters:
259
        Parameters:
247
         - itemId
260
         - itemId
Line 1131... Line 1144...
1131
            return True
1144
            return True
1132
    elif item.status == status.COMING_SOON:
1145
    elif item.status == status.COMING_SOON:
1133
        return True
1146
        return True
1134
    else:
1147
    else:
1135
        return False
1148
        return False
-
 
1149
 
1136
    
1150
    
1137
if __name__ == '__main__':
1151
if __name__ == '__main__':
1138
    items = get_all_alive_items()
1152
    items = get_all_alive_items()
1139
    ret_items = []
1153
    ret_items = []
1140
    for item in items:
1154
    for item in items: