Subversion Repositories SmartDukaan

Rev

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

Rev 7770 Rev 7897
Line 39... Line 39...
39
    update_insurance_declared_amount, get_freebie_for_item, \
39
    update_insurance_declared_amount, get_freebie_for_item, \
40
    add_or_update_freebie_for_item, get_all_amazon_listed_items, get_store_pricing, \
40
    add_or_update_freebie_for_item, get_all_amazon_listed_items, get_store_pricing, \
41
    update_store_pricing, get_amazon_item_details, update_amazon_item_details, \
41
    update_store_pricing, get_amazon_item_details, update_amazon_item_details, \
42
    add_amazon_item, get_asin_items, get_all_fba_listed_items, \
42
    add_amazon_item, get_asin_items, get_all_fba_listed_items, \
43
    get_all_nonfba_listed_items, 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, update_item_inventory, update_timestamp_for_amazon_feeds
44
    get_items_status, update_item_inventory, update_timestamp_for_amazon_feeds, \
-
 
45
    get_all_parent_categories
45
from shop2020.thriftpy.model.v1.catalog.ttypes import status
46
from shop2020.thriftpy.model.v1.catalog.ttypes import status
46
from shop2020.utils.Utils import log_entry, to_py_date
47
from shop2020.utils.Utils import log_entry, to_py_date
47
import datetime
48
import datetime
48
 
49
 
49
class CatalogServiceHandler:
50
class CatalogServiceHandler:
Line 911... Line 912...
911
        try:
912
        try:
912
            return [to_t_product_notification_request(notification) for notification in get_product_notifications(to_py_date(startDateTime))]
913
            return [to_t_product_notification_request(notification) for notification in get_product_notifications(to_py_date(startDateTime))]
913
        finally:
914
        finally:
914
            close_session()
915
            close_session()
915
    
916
    
916
    def getProductNotificationRequestCount(self, startDateTime):
917
    def getProductNotificationRequestCount(self, startDateTime,  categoryId):
917
        '''
918
        '''
918
        Returns list of items and the counts of product notification requests
919
        Returns list of items and the counts of product notification requests
919
        '''
920
        '''
920
        try:
921
        try:
921
            notification_request_counts = [(notification.item, count) for notification, count in get_product_notification_request_count(to_py_date(startDateTime))]
922
            notification_request_counts = [(notification.item, count) for notification, count in get_product_notification_request_count(to_py_date(startDateTime), categoryId)]
922
            
923
            
923
            return [to_t_product_notification_request_count(count) for count in notification_request_counts]
924
            return [to_t_product_notification_request_count(count) for count in notification_request_counts]
924
             
925
             
925
        finally:
926
        finally:
926
            close_session()
927
            close_session()
Line 1146... Line 1147...
1146
        try:
1147
        try:
1147
            return update_timestamp_for_amazon_feeds(feedType,skuList,timestamp)
1148
            return update_timestamp_for_amazon_feeds(feedType,skuList,timestamp)
1148
        finally:
1149
        finally:
1149
            close_session()
1150
            close_session()
1150
            
1151
            
-
 
1152
    def  getAllParentCategories(self):
-
 
1153
        try:
-
 
1154
            categories = get_all_parent_categories()
-
 
1155
            return [to_t_category(category) for category in categories]
-
 
1156
        finally:
-
 
1157
            close_session()
-
 
1158
            
1151
def is_valid(item):
1159
def is_valid(item):
1152
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1160
    if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
1153
        if item.startDate:
1161
        if item.startDate:
1154
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
1162
            return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
1155
        else:
1163
        else: