public static Map<String,Object> updateEbayStoreInventory(DispatchContext dctx, Map<String,Object> context) {
Map<String,Object> result = FastMap.newInstance();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
Delegator delegator = dctx.getDelegator();
GetSellingManagerInventoryRequestType invenReq = null;
GetSellingManagerInventoryResponseType invenResp = null;
boolean checkProd = false;
boolean status = false;
try {
if (context.get("productStoreId") == null || context.get("productId") == null || context.get("folderId") == null) {
result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "EbayStoreInventoryFolderIdRequired", locale));
result.put("productStoreId", context.get("productStoreId"));
result.put("facilityId", context.get("facilityId"));
result.put("folderId", context.get("folderId"));
return result;
}
String productId = (String)context.get("productId");
String folderId = (String)context.get("folderId");
// start upload/update products which selected to an ebay inventory
if (folderId != null) {
GetSellingManagerInventoryCall invenCall = new GetSellingManagerInventoryCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
invenReq = new GetSellingManagerInventoryRequestType();
invenResp = (GetSellingManagerInventoryResponseType) invenCall.execute(invenReq);
if (invenResp != null && "SUCCESS".equals(invenResp.getAck().toString())) {
GenericValue ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")));
SellingManagerProductType[] sellingManagerProductTypeList = invenResp.getSellingManagerProduct();