Beispiel #1
0
        /// <summary>
        /// Enables a seller to change the price and quantity of a currently-
        /// active, fixed-price listing. Using ReviseInventoryStatus to modify
        /// data qualifies as revising the listing.
        ///
        ///
        /// Inputs are the item IDs or SKUs of the listings being revised,
        /// and the price and quantity that are
        /// being changed for each revision. Only applicable to fixed-price listings.
        ///
        /// Changing the price or quantity of a currently-
        /// active, fixed-price listing does not reset the Best Match performance score.
        /// For Best Match information related to multi-variation listings, see the Best
        /// Match information at the following topic:
        /// <a href="http://pages.ebay.com/sell/variation/">Multi-quantity Fixed Price
        /// listings with variations</a>.
        ///
        /// As with all listing calls, the site you specify in the request URL
        /// (for SOAP) or the X-EBAY-API-SITEID HTTP header (for XML)
        /// should match the original listing's <b>Item.Site</b> value.
        /// In particular, this is a best practice when you submit new and
        /// revised listings.
        ///
        /// <b>For Large Merchant Services users:</b> When you use ReviseInventoryStatus within a Merchant Data file,
        /// it must be enclosed within two BulkDataExchangeRequest tags.
        /// After release 637, a namespace is returned in the BulkDataExchangeResponseType
        /// (top level) of the response. The BulkDataExchange tags are not shown in the call input/output descriptions.
        /// </summary>
        ///
        /// <param name="InventoryStatuList">
        /// Contains the updated quantity and/or price of a listing
        /// being revised. You should not modify the same listing twice
        /// (by using a duplicate ItemID or SKU) in the same request;
        /// otherwise, you may get an error or unexpected results.
        /// (For example, you should not use one InventoryStatus node to
        /// update the quantity and another InventoryStatus node to update
        /// the price of the same item.) You can pass up to 4 InventoryStatus nodes in a single request.
        /// </param>
        ///
        public InventoryStatusTypeCollection ReviseInventoryStatus(InventoryStatusTypeCollection InventoryStatuList)
        {
            this.InventoryStatuList = InventoryStatuList;

            Execute();
            return(ApiResponse.InventoryStatus);
        }
Beispiel #2
0
        private void resubmitInventoryStatusBySingleFeeds(List <eBayInventoryFeed> inventoryFeeds, string submittedBy, bool isPriceUpdate = false, bool isQuantityUpdate = false)
        {
            for (var i = 0; i < inventoryFeeds.Count; i++)
            {
                try
                {
                    // create inventory item feed
                    var inventoryStatus = new InventoryStatusType
                    {
                        ItemID = inventoryFeeds[i].ItemId
                    };

                    // set the new price if its price update
                    if (isPriceUpdate)
                    {
                        inventoryStatus.StartPrice = new AmountType
                        {
                            currencyID = CurrencyCodeType.USD,
                            Value      = (double)inventoryFeeds[i].BinPrice,
                        };
                    }

                    // set the new quantity if its for inventory update
                    if (isQuantityUpdate)
                    {
                        inventoryStatus.Quantity          = inventoryFeeds[i].InventoryQuantity;
                        inventoryStatus.QuantitySpecified = true;
                    }

                    var inventoryStatusCollection = new InventoryStatusTypeCollection();
                    inventoryStatusCollection.Add(inventoryStatus);

                    // send the inventory collection request
                    var apiCall = new ReviseInventoryStatusCall(_context);
                    var inventoryStatusResult = apiCall.ReviseInventoryStatus(inventoryStatusCollection);

                    var description = string.Format("Successfully posting {0} feed for {1}.  \nRequested by: {2}",
                                                    (isPriceUpdate ? "PRICE" : "INVENTORY"),
                                                    inventoryFeeds[i].EisSKU,
                                                    submittedBy);
                    _logger.LogInfo(LogEntryType.eBayInventoryUpdate, description);
                    Console.WriteLine(description);
                }
                catch (Exception ex)
                {
                    var description = string.Format("Error in submitting single {0} feed for {1} . \nError Message: {2} \nRequested by: {3}",
                                                    (isPriceUpdate ? "PRICE" : "INVENTORY"),
                                                    inventoryFeeds[i].EisSKU,
                                                    EisHelper.GetExceptionMessage(ex),
                                                    submittedBy);
                    _logger.LogError(LogEntryType.eBayInventoryUpdate, string.Format("Single: {0}/{1} - {2}", i + 1, inventoryFeeds.Count, description), ex.StackTrace);
                    Console.WriteLine(description);
                }
            }
        }
Beispiel #3
0
        public void SubmitSingleProductPriceFeed(MarketplacePriceFeedDto priceFeed, string submittedBy)
        {
            if (string.IsNullOrEmpty(priceFeed.eBayInventoryFeed.ItemId))
            {
                _logger.LogInfo(LogEntryType.eBayPriceUpdate, string.Format("Unable to send price update feed for \'{0}\' since it doesn't have ItemId. \nRequested by: {1}", priceFeed.EisSKU, submittedBy));
                return;
            }

            try
            {
                // create inventory item feed
                var inventoryStatus = new InventoryStatusType
                {
                    ItemID     = priceFeed.eBayInventoryFeed.ItemId,
                    StartPrice = new AmountType
                    {
                        currencyID = CurrencyCodeType.USD,
                        Value      = (double)priceFeed.eBayInventoryFeed.StartPrice
                    }
                };

                // set the log file name
                _context.ApiLogManager.ApiLoggerList.Add(new FileLogger(string.Format(_logDirectory, MethodBase.GetCurrentMethod().Name), false, true, true));

                var inventoryStatusCollection = new InventoryStatusTypeCollection();
                inventoryStatusCollection.Add(inventoryStatus);

                // send the inventory collection request
                var apiCall = new ReviseInventoryStatusCall(_context);
                var inventoryStatusResult = apiCall.ReviseInventoryStatus(inventoryStatusCollection);

                _logger.LogInfo(LogEntryType.eBayPriceUpdate, string.Format("Successfully posted single price feed for \'{0}\'. \nRequested by: {1}", priceFeed.EisSKU, submittedBy));
            }
            catch (Exception ex)
            {
                var description = string.Format("Error in submitting single product price feed for \'{0}\'. \nError Message: {1} \nRequested by: {2}",
                                                priceFeed.EisSKU,
                                                EisHelper.GetExceptionMessage(ex),
                                                submittedBy);
                _logger.Add(LogEntrySeverity.Error, LogEntryType.eBayPriceUpdate, description, ex.StackTrace);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Revice the quantity of the items added recently. The new quantity is a fix value
 /// </summary>
 /// <returns>ItemType object</returns>
 #region ReviceItems
 void ReviceItems()
 {
     try
     {
         ReviseInventoryStatusCall     call      = new ReviseInventoryStatusCall(GetApiContext());
         InventoryStatusTypeCollection inventory = new InventoryStatusTypeCollection();
         foreach (Article article in articles)
         {
             InventoryStatusType type = new InventoryStatusType();
             type.SKU      = article.ArticleNumber;
             type.Quantity = 88;
             inventory.Add(type);
         }
         call.ReviseInventoryStatus(inventory);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Beispiel #5
0
        public void SubmitSingleProductInventoryFeed(MarketplaceInventoryFeed inventoryFeed, string submittedBy)
        {
            try
            {
                if (string.IsNullOrEmpty(inventoryFeed.eBayInventoryFeed.ItemId))
                {
                    _logger.LogInfo(LogEntryType.eBayInventoryUpdate, string.Format("Unable to send inventory update feed for \'{0}\' since it doesn't have ItemId. \nRequested by: {1}", inventoryFeed.EisSKU, submittedBy));
                    return;
                }

                // create inventory item feed
                var inventoryStatus = new InventoryStatusType
                {
                    ItemID   = inventoryFeed.eBayInventoryFeed.ItemId,
                    Quantity = inventoryFeed.eBayInventoryFeed.InventoryQuantity
                };

                var inventoryStatusCollection = new InventoryStatusTypeCollection();
                inventoryStatusCollection.Add(inventoryStatus);

                // set the log file name
                _context.ApiLogManager.ApiLoggerList.Add(new FileLogger(string.Format(_logDirectory, MethodBase.GetCurrentMethod().Name), false, true, true));

                // send the inventory collection request
                var apiCall = new ReviseInventoryStatusCall(_context);
                var inventoryStatusResult = apiCall.ReviseInventoryStatus(inventoryStatusCollection);

                _logger.LogInfo(LogEntryType.eBayInventoryUpdate, string.Format("Successfully posted single inventory feed for {0} - {1} item. \nRequested by: {2}",
                                                                                ChannelName, inventoryFeed.EisSKU, submittedBy));
            }
            catch (Exception ex)
            {
                var description = string.Format("Error in submitting single inventory price feed for \'{0}\'. \nError Message: {1} \nRequested by: {2}",
                                                inventoryFeed.EisSKU,
                                                EisHelper.GetExceptionMessage(ex),
                                                submittedBy);
                _logger.Add(LogEntrySeverity.Error, LogEntryType.eBayInventoryUpdate, description, ex.StackTrace);
            }
        }
        /// <summary>
        /// Enables a seller to change the price and quantity of a currently-
        /// active, fixed-price listing.
        /// 
        /// 
        /// Be aware that changing the price or quantity of a currently-
        /// active, fixed-price listing does not reset the Best Match performance score.
        /// For Best Match information related to multi-variation listings, see the Best
        /// Match information at the following topic:
        /// <a href="http://pages.ebay.com/sell/variation/">Multi-quantity Fixed Price
        /// listings with variations</a>.
        /// <b>Note:</b> When you use ReviseInventoryStatus within a Merchant Data file,
        /// it must be enclosed within two BulkDataExchangeRequest tags.
        /// After release 637, a namespace is returned in the BulkDataExchangeResponseType
        /// (top level) of the response. The BulkDataExchange tags are not shown in the call
        /// input/output descriptions.
        /// </summary>
        /// 
        /// <param name="InventoryStatuList">
        /// Contains the updated quantity and/or price of a listing
        /// being revised. You should not modify the same listing twice
        /// (by using a duplicate ItemID or SKU) in the same request;
        /// otherwise, you may get an error or unexpected results.
        /// (For example, you should not use one InventoryStatus node to
        /// update the quantity and another InventoryStatus node to update
        /// the price of the same item.) You can pass up to 4 InventoryStatus nodes in a single request.
        /// </param>
        ///
        public InventoryStatusTypeCollection ReviseInventoryStatus(InventoryStatusTypeCollection InventoryStatuList)
        {
            this.InventoryStatuList = InventoryStatuList;

            Execute();
            return ApiResponse.InventoryStatus;
        }
Beispiel #7
0
        private List <eBayInventoryFeed> sendInventoryStatusFeeds(List <eBayInventoryFeed> inventoryItems, string submittedBy, bool isPriceUpdate = false, bool isQuantityUpdate = false)
        {
            var failedBatches = new List <eBayInventoryFeed>();
            var totalBatches  = Math.Ceiling(inventoryItems.Count() / 4.0);

            for (var i = 0; i < totalBatches; i++)
            {
                // only 4 items are allowed in single request for ReviseInventoryStatus
                var batchedInventories        = inventoryItems.Skip(i * 4).Take(4).ToList();
                var inventoryStatusCollection = new InventoryStatusTypeCollection();

                try
                {
                    foreach (var item in batchedInventories)
                    {
                        // create the item for inventory feed request
                        var inventoryStatus = new InventoryStatusType
                        {
                            ItemID = item.ItemId
                        };

                        // set the new price if its price update
                        if (isPriceUpdate)
                        {
                            inventoryStatus.StartPrice = new AmountType
                            {
                                currencyID = CurrencyCodeType.USD,
                                Value      = (double)item.BinPrice
                            };
                        }

                        // set the new quantity if its for inventory update
                        if (isQuantityUpdate)
                        {
                            inventoryStatus.Quantity          = item.InventoryQuantity;
                            inventoryStatus.QuantitySpecified = true;
                        }

                        inventoryStatusCollection.Add(inventoryStatus);
                    }

                    // send the inventory collection request
                    var apiCall = new ReviseInventoryStatusCall(_context);
                    var inventoryStatusResult = apiCall.ReviseInventoryStatus(inventoryStatusCollection);
                }
                catch (Exception ex)
                {
                    var description = string.Format("Batch: {0}/{1} - Error in submitting {2} feed. \nError Message: {3} \nRequested by: {4}",
                                                    i + 1,
                                                    totalBatches,
                                                    (isPriceUpdate ? "PRICE" : "INVENTORY"),
                                                    EisHelper.GetExceptionMessage(ex),
                                                    submittedBy);
                    _logger.LogError(LogEntryType.eBayInventoryUpdate, description, ex.StackTrace);
                    Console.WriteLine(description);

                    // add the batched items to the list for resubmission 1 by 1
                    failedBatches.AddRange(batchedInventories);
                }
            }

            if (!failedBatches.Any())
            {
                _logger.LogInfo(LogEntryType.eBayInventoryUpdate, string.Format("Successfully posted inventory/price feeds for {0} - {1} items. \nRequested by: {2}",
                                                                                ChannelName, inventoryItems.Count(), submittedBy));
            }

            return(failedBatches);
        }
        public ProductQuantityUpdateResultCollection UpdateExternalStoreProductQuantity(ProductQuantityUpdateRequestCollection quantityUpdateRequest)
        {
            ProductQuantityUpdateResultCollection resultCollection = new ProductQuantityUpdateResultCollection();
            bool allSuccess = true;

            foreach (ProductQuantityUpdateRequest updateRequest in quantityUpdateRequest.ProductQuantityUpdateRequests)
            {

                ProductQuantityUpdateResult result = new ProductQuantityUpdateResult()
                {
                    Success = false,
                    ExternalStoreProductId = updateRequest.ExternalStoreProductId,
                };

                ReviseInventoryStatusCall reviseItemCall = new ReviseInventoryStatusCall(eBayContext);

                InventoryStatusTypeCollection reviseItems = new InventoryStatusTypeCollection();

                reviseItems.Add(new InventoryStatusType()
                {
                    ItemID = updateRequest.ExternalStoreProductId,
                    SKU = updateRequest.ExternalStoreSKU,
                    Quantity = (int)updateRequest.QuantityToUpdate
                });

                reviseItemCall.InventoryStatuList = reviseItems;

                reviseItemCall.Execute();

                if (reviseItemCall.ApiResponse.Ack != AckCodeType.Failure)
                {

                    result.Success = true;

                }
                else
                {
                    if (reviseItemCall.ApiResponse.Errors != null)
                    {
                        ErrorTypeCollection errors = reviseItemCall.ApiResponse.Errors;

                        InventoryStatusTypeCollection statusTypeCollection = reviseItemCall.ApiResponse.InventoryStatus;

                        StringBuilder sb = new StringBuilder();

                        foreach (ErrorType error in errors)
                        {

                            sb.Append(error.LongMessage + "; ");

                        }

                        result.ErrorMessage = sb.ToString();

                    }
                    else
                    {
                        result.ErrorMessage = "An Error occurred while updating quantity for eBay Item";
                    }

                    allSuccess = false;

                }

                resultCollection.ProductQuantityUpdateResults.Add(result);
            }

            if (allSuccess == true)
            {

                resultCollection.Success = true;

            }
            else
            {

                resultCollection.Success = false;

                resultCollection.ErrorMessage = "Error occurred while updating quantities:";

            }

            return resultCollection;
        }