Subversion Repositories SmartDukaan

Rev

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

Rev 11576 Rev 11592
Line 3... Line 3...
3
 
3
 
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, to_t_banner, \
9
    to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
9
    to_t_banner_map, to_t_product_notification_request_count, \
10
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
10
    to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
11
    to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
11
    to_t_uri_mapping, to_t_banner_list, to_t_campaign, to_t_snapdeal_item, \
12
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice,\
12
    to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, \
13
    to_t_marketplacepercentage, to_t_flipkart_item, to_t_flipkart_item_details, \
13
    to_t_marketplace_itemprice, to_t_marketplacepercentage, to_t_flipkart_item, \
14
    to_t_market_place_history,to_t_private_deal
14
    to_t_flipkart_item_details, to_t_market_place_history, to_t_private_deal
15
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
15
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
16
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
16
    change_item_status, get_item, get_all_items, get_all_items_by_status, \
17
    update_item, start_item_on, close_session, retire_item_on, \
17
    update_item, start_item_on, close_session, retire_item_on, \
18
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
18
    get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
19
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
19
    get_best_deals_count, get_best_sellers, get_latest_arrivals, \
Line 43... Line 43...
43
    add_or_update_freebie_for_item, get_all_amazon_listed_items, get_store_pricing, \
43
    add_or_update_freebie_for_item, get_all_amazon_listed_items, get_store_pricing, \
44
    update_store_pricing, get_amazon_item_details, update_amazon_item_details, \
44
    update_store_pricing, get_amazon_item_details, update_amazon_item_details, \
45
    add_amazon_item, get_asin_items, get_all_fba_listed_items, \
45
    add_amazon_item, get_asin_items, get_all_fba_listed_items, \
46
    get_all_nonfba_listed_items, add_or_update_brand_info, get_brand_info, \
46
    get_all_nonfba_listed_items, add_or_update_brand_info, get_brand_info, \
47
    get_items_status, update_item_inventory, update_timestamp_for_amazon_feeds, \
47
    get_items_status, update_item_inventory, update_timestamp_for_amazon_feeds, \
48
    get_all_parent_categories,add_page_view_event,add_cart_event, \
48
    get_all_parent_categories, add_page_view_event, add_cart_event, insert_ebay_item, \
49
    insert_ebay_item, get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
49
    get_ebay_item, update_ebay_item, update_amazon_attributes_in_bulk, \
50
    get_all_items_to_list_on_fba,get_all_items_to_list_on_nonfba, \
50
    get_all_items_to_list_on_fba, get_all_items_to_list_on_nonfba, update_banner, \
51
    update_banner,add_banner_uri,get_uri_mapping,add_campaign,get_campaigns, \
51
    add_banner_uri, get_uri_mapping, add_campaign, get_campaigns, delete_campaign, \
52
    delete_campaign, get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
52
    get_all_campaigns, get_amazon_listed_items, search_amazon_items, \
53
    get_count_for_amazonlisted_items, get_amazon_search_result_count,update_asin, \
53
    get_count_for_amazonlisted_items, get_amazon_search_result_count, update_asin, \
54
    add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items , get_snapdeal_items, \
54
    add_or_update_snapdeal_item, get_snapdeal_item, get_all_snapdeal_items, \
55
    search_snapdeal_items , get_count_for_snapdeal_items , get_snapdeal_search_result_count, \
55
    get_snapdeal_items, search_snapdeal_items, get_count_for_snapdeal_items, \
-
 
56
    get_snapdeal_search_result_count, get_active_banners_for_mobile_site, \
56
    get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
57
    get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
57
    get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
58
    get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
58
    delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
59
    delete_product_feed_submit, get_all_product_feed_submit, \
59
    get_marketplace_details_for_item, update_marketplace_attributes_for_item,\
60
    get_snapdeal_item_detail, get_marketplace_details_for_item, \
-
 
61
    update_marketplace_attributes_for_item, get_costing_for_marketplace, \
60
    get_costing_for_marketplace, get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
62
    get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
61
    update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items, get_flipkart_item, \
63
    update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items, \
62
    add_or_update_flipkart_item, get_flipkart_item_detail, get_flipkart_items, search_flipkart_items, \
64
    get_flipkart_item, add_or_update_flipkart_item, get_flipkart_item_detail, \
63
    get_count_for_flipkart_items, get_flipkart_search_result_count, get_all_fk_items, get_flipkart_item_by_sku_at_flipkart, \
65
    get_flipkart_items, search_flipkart_items, get_count_for_flipkart_items, \
-
 
66
    get_flipkart_search_result_count, get_all_fk_items, \
-
 
67
    get_flipkart_item_by_sku_at_flipkart, get_marketplace_history, \
64
    get_marketplace_history, get_all_fbb_listed_items, get_count_for_marketplaceHistory, get_marketplace_history_by_date,\
68
    get_all_fbb_listed_items, get_count_for_marketplaceHistory, \
-
 
69
    get_marketplace_history_by_date, get_all_fbb_pricing_items, \
65
    get_all_fbb_pricing_items,get_private_deal_details, get_private_deal_items, add_or_update_private_deal
70
    get_private_deal_details, get_private_deal_items, add_or_update_private_deal, \
-
 
71
    get_all_active_private_deals
66
from shop2020.thriftpy.model.v1.catalog.ttypes import status
72
from shop2020.thriftpy.model.v1.catalog.ttypes import status
67
from shop2020.utils.Utils import log_entry, to_py_date
73
from shop2020.utils.Utils import log_entry, to_py_date
68
import datetime
74
import datetime
69
 
75
 
70
class CatalogServiceHandler:
76
class CatalogServiceHandler:
Line 1462... Line 1468...
1462
            search_result = search_flipkart_items(searchterm,offset,limit)
1468
            search_result = search_flipkart_items(searchterm,offset,limit)
1463
            for flipkartitem in search_result:
1469
            for flipkartitem in search_result:
1464
                flipkartitems.append(to_t_flipkart_item_details(flipkartitem,None))
1470
                flipkartitems.append(to_t_flipkart_item_details(flipkartitem,None))
1465
        finally:
1471
        finally:
1466
            close_session()
1472
            close_session()
1467
            return flipkartitems
1473
        return flipkartitems
1468
    
1474
    
1469
    def getCountForFlipkartItems(self):
1475
    def getCountForFlipkartItems(self):
1470
        try:
1476
        try:
1471
            return get_count_for_flipkart_items()
1477
            return get_count_for_flipkart_items()
1472
        finally:
1478
        finally:
Line 1500... Line 1506...
1500
    def getPrivateDealDetails(self,item_id):
1506
    def getPrivateDealDetails(self,item_id):
1501
        try:
1507
        try:
1502
            return to_t_private_deal(get_private_deal_details(item_id))
1508
            return to_t_private_deal(get_private_deal_details(item_id))
1503
        finally:
1509
        finally:
1504
            close_session()    
1510
            close_session()    
-
 
1511
            
-
 
1512
    def getAllActivePrivateDeals(self):
-
 
1513
        try:
-
 
1514
            return get_all_active_private_deals()
-
 
1515
        finally:
-
 
1516
            close_session()
1505
    
1517
    
1506
    def getAllFbbListedItems(self):
1518
    def getAllFbbListedItems(self):
1507
        try:
1519
        try:
1508
            items = get_all_fbb_listed_items()
1520
            items = get_all_fbb_listed_items()
1509
            ret_items = []
1521
            ret_items = []