Examples of GetSellingManagerInventoryResponseType


Examples of com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType

        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("The process was required productStoreId, productId and ebay inventory folderId.");
                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();
                    for (SellingManagerProductType sellingManagerProductType : sellingManagerProductTypeList) {
                        SellingManagerProductDetailsType sellingManagerProductDetailsType = sellingManagerProductType.getSellingManagerProductDetails();
                        if (String.valueOf(sellingManagerProductDetailsType.getFolderID()).equals(folderId) && String.valueOf(sellingManagerProductDetailsType.getProductID()).equals(String.valueOf(ebayProductStoreInventory.getLong("ebayProductId"))) && String.valueOf(sellingManagerProductDetailsType.getCustomLabel()).equals(productId)) {
                            checkProd = true;
                            break;
                        }
                    }
                } else {
                    EbayStoreHelper.createErrorLogMessage(userLogin, dctx.getDispatcher(), context.get("productStoreId").toString(), invenResp.getAck().toString(), "GetSellingManagerInventoryCall : updateEbayStoreInventory", invenResp.getErrors(0).getLongMessage());
                }

                // checkProduct is true then update detail  but is false do create new one.
                if (checkProd) {
                    status = updateProductInEbayInventoryFolder(dctx,context);
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.GetSellingManagerInventoryResponseType

        String facilityId = (String)context.get("facilityId");
        String folderId = (String)context.get("folderId");
        String productId = (String)context.get("productId");
        String ebayProductId = null;
        GetSellingManagerInventoryRequestType req = null;
        GetSellingManagerInventoryResponseType resp = null;
        GenericValue ebayProductStoreInventory = null;

        if (context.get("ebayProductId") != null) {
            ebayProductId = String.valueOf(context.get("ebayProductId"));
        }
        try {
            if (productStoreId != null && ebayProductId != null) {
                ebayProductStoreInventory = delegator.findByPrimaryKey("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", facilityId, "productStoreId", productStoreId));
                GetSellingManagerInventoryCall call = new GetSellingManagerInventoryCall(EbayStoreHelper.getApiContext(productStoreId, locale, delegator));
                req = new GetSellingManagerInventoryRequestType();
                resp = (GetSellingManagerInventoryResponseType) call.execute(req);
                if (resp != null && "SUCCESS".equals(resp.getAck().toString())) {
                    SellingManagerProductType[] sellingManagerProductTypeList = resp.getSellingManagerProduct();
                    for (SellingManagerProductType sellingManagerProductType : sellingManagerProductTypeList) {
                        SellingManagerProductDetailsType productDetail = sellingManagerProductType.getSellingManagerProductDetails();
                        if (String.valueOf(productDetail.getFolderID()).equals(folderId) && String.valueOf(productDetail.getProductID()).equals(ebayProductId) && String.valueOf(productDetail.getCustomLabel()).equals(productId)) {
                            SellingManagerProductInventoryStatusType prodInventoryStatus = sellingManagerProductType.getSellingManagerProductInventoryStatus();
                            ebayProductStoreInventory.put("activeListing",new BigDecimal(prodInventoryStatus.getQuantityActive()));
                            ebayProductStoreInventory.put("scheduled",new BigDecimal(prodInventoryStatus.getQuantityScheduled()));
                            ebayProductStoreInventory.put("sold",new BigDecimal(prodInventoryStatus.getQuantitySold()));
                            ebayProductStoreInventory.put("unSold",new BigDecimal(prodInventoryStatus.getQuantityUnsold()));
                            ebayProductStoreInventory.store();
                            result = ServiceUtil.returnSuccess("Updated inventory status of product ".concat(productId));
                            break;
                        }
                    }
                } else {
                    EbayStoreHelper.createErrorLogMessage(userLogin, dctx.getDispatcher(), context.get("productStoreId").toString(), resp.getAck().toString(), "GetSellingManagerInventoryCall : updateEbayInventoryStatusByProductId", resp.getErrors(0).getLongMessage());
                    Debug.logError("The problem with get manage inventory detail from ebay site.", module);
                }
            }
        } catch (ApiException e) {
            result = ServiceUtil.returnFailure(e.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.