| Line 8... |
Line 8... |
| 8 |
from shop2020.config.client.ConfigClient import ConfigClient
|
8 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 9 |
from shop2020.model.v1.catalog.impl import DataService
|
9 |
from shop2020.model.v1.catalog.impl import DataService
|
| 10 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, \
|
10 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, \
|
| 11 |
to_t_item_inventory, to_t_warehouse, to_t_vendor_item_pricing, to_t_category, \
|
11 |
to_t_item_inventory, to_t_warehouse, to_t_vendor_item_pricing, to_t_category, \
|
| 12 |
to_t_vendor, to_t_vendor_item_mapping, to_t_source_item_pricing, \
|
12 |
to_t_vendor, to_t_vendor_item_mapping, to_t_source_item_pricing, \
|
| 13 |
to_t_product_notification_request, to_t_product_notification_request_count
|
13 |
to_t_product_notification_request, to_t_product_notification_request_count, \
|
| - |
|
14 |
to_t_voucher_item_mapping
|
| 14 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, add_warehouse, \
|
15 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, add_warehouse, \
|
| 15 |
update_inventory, retire_warehouse, retire_item, change_item_status, get_item, \
|
16 |
update_inventory, retire_warehouse, retire_item, change_item_status, get_item, \
|
| 16 |
get_all_items, get_all_items_by_status, get_item_availability_for_warehouse, \
|
17 |
get_all_items, get_all_items_by_status, get_item_availability_for_warehouse, \
|
| 17 |
get_item_availability_for_location, get_all_warehouses_by_status, get_Warehouse, \
|
18 |
get_item_availability_for_location, get_all_warehouses_by_status, get_Warehouse, \
|
| 18 |
get_all_warehouses_for_item, get_all_items_for_warehouse, update_item, \
|
19 |
get_all_warehouses_for_item, get_all_items_for_warehouse, update_item, \
|
| Line 38... |
Line 39... |
| 38 |
get_thrift_item_list, get_all_brands, add_bad_inventory, \
|
39 |
get_thrift_item_list, get_all_brands, add_bad_inventory, \
|
| 39 |
mark_missed_inventory_updates_as_processed, \
|
40 |
mark_missed_inventory_updates_as_processed, \
|
| 40 |
get_item_keys_to_be_processed, reset_availability, get_shipping_locations,\
|
41 |
get_item_keys_to_be_processed, reset_availability, get_shipping_locations,\
|
| 41 |
get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count,\
|
42 |
get_coming_soon, get_coming_soon_catalog_ids, get_coming_soon_count,\
|
| 42 |
initialize, get_inventory_snapshot, clear_item_availability_cache, \
|
43 |
initialize, get_inventory_snapshot, clear_item_availability_cache, \
|
| 43 |
reset_availability_for_warehouse, get_clearance_sale_catalog_ids
|
44 |
reset_availability_for_warehouse, get_clearance_sale_catalog_ids, \
|
| - |
|
45 |
add_update_voucher_for_item, delete_voucher_for_item, get_voucher_amount, \
|
| - |
|
46 |
get_all_vouchers_for_item
|
| 44 |
from shop2020.model.v1.catalog.impl.DataService import Warehouse, \
|
47 |
from shop2020.model.v1.catalog.impl.DataService import Warehouse, \
|
| 45 |
MissedInventoryUpdate, VendorItemMapping
|
48 |
MissedInventoryUpdate, VendorItemMapping
|
| 46 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, \
|
49 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, \
|
| 47 |
InventoryServiceException, AvailableAndReservedStock, WarehouseType, InventoryType
|
50 |
InventoryServiceException, AvailableAndReservedStock, WarehouseType, InventoryType
|
| 48 |
from shop2020.thriftpy.purchase.ttypes import PurchaseOrder, LineItem
|
51 |
from shop2020.thriftpy.purchase.ttypes import PurchaseOrder, LineItem
|
| Line 785... |
Line 788... |
| 785 |
try:
|
788 |
try:
|
| 786 |
return delete_similar_item_catalog_id(itemId, catalogItemId)
|
789 |
return delete_similar_item_catalog_id(itemId, catalogItemId)
|
| 787 |
finally:
|
790 |
finally:
|
| 788 |
close_session()
|
791 |
close_session()
|
| 789 |
|
792 |
|
| - |
|
793 |
def getAllItemVouchers(self, itemId):
|
| - |
|
794 |
"""
|
| - |
|
795 |
Returns list of vouchers.
|
| - |
|
796 |
|
| - |
|
797 |
Parameters:
|
| - |
|
798 |
- itemId
|
| - |
|
799 |
"""
|
| - |
|
800 |
try:
|
| - |
|
801 |
vouchers = get_all_vouchers_for_item(itemId)
|
| - |
|
802 |
return [to_t_voucher_item_mapping(voucher) for voucher in vouchers]
|
| - |
|
803 |
finally:
|
| - |
|
804 |
close_session()
|
| - |
|
805 |
|
| - |
|
806 |
def getVoucherAmount(self, itemId, voucherType):
|
| - |
|
807 |
"""
|
| - |
|
808 |
Returns voucher amount.
|
| - |
|
809 |
|
| - |
|
810 |
Parameters:
|
| - |
|
811 |
- itemId, voucherType
|
| - |
|
812 |
"""
|
| - |
|
813 |
try:
|
| - |
|
814 |
return get_voucher_amount(itemId, voucherType)
|
| - |
|
815 |
finally:
|
| - |
|
816 |
close_session()
|
| - |
|
817 |
|
| - |
|
818 |
def addupdateVoucherForItem(self, catalogItemId, voucherType, voucherAmount):
|
| - |
|
819 |
"""
|
| - |
|
820 |
add or update voucher for item.
|
| - |
|
821 |
|
| - |
|
822 |
Parameters:
|
| - |
|
823 |
- catalogItemId, voucherType, voucherAmount
|
| - |
|
824 |
"""
|
| - |
|
825 |
try:
|
| - |
|
826 |
return add_update_voucher_for_item(catalogItemId, voucherType, voucherAmount)
|
| - |
|
827 |
finally:
|
| - |
|
828 |
close_session()
|
| - |
|
829 |
|
| - |
|
830 |
def deleteVoucherForItem(self, catalogItemId, voucherType):
|
| - |
|
831 |
"""
|
| - |
|
832 |
delete voucher for item.
|
| - |
|
833 |
|
| - |
|
834 |
Parameters:
|
| - |
|
835 |
- catalogItemId, voucherType
|
| - |
|
836 |
"""
|
| - |
|
837 |
try:
|
| - |
|
838 |
return delete_voucher_for_item(catalogItemId, voucherType)
|
| - |
|
839 |
finally:
|
| - |
|
840 |
close_session()
|
| - |
|
841 |
|
| 790 |
def addVendorItemMapping(self, key, vendorItemMapping):
|
842 |
def addVendorItemMapping(self, key, vendorItemMapping):
|
| 791 |
"""
|
843 |
"""
|
| 792 |
Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.
|
844 |
Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.
|
| 793 |
|
845 |
|
| 794 |
Parameters:
|
846 |
Parameters:
|