Beispiel #1
0
        public void SubmitSingleProductPriceFeed(MarketplacePriceFeedDto priceItem, string submittedBy)
        {
            try
            {
                // create the Amazon envelope for the Price feed
                var envelope = RequestHelper.CreatePriceFeedEnvelope(new List <AmazonPriceFeed> {
                    priceItem.AmazonPriceFeed
                });

                // parse the envelope into file
                var xmlFullName = XmlParser.WriteXmlToFile(envelope, "AmazonSinglePriceFeed");

                var submitFeedController = new SubmitFeedController(_amazonClient,
                                                                    _logger,
                                                                    _credential.MarketplaceId,
                                                                    _credential.MerchantId,
                                                                    submittedBy);
                var streamResponse = submitFeedController.SubmitFeedAndGetResponse(xmlFullName, AmazonFeedType._POST_PRODUCT_PRICING_DATA_);
                parsedResultStreamAndLogReport(streamResponse, AmazonEnvelopeMessageType.Price, submittedBy);

                _logger.LogInfo(LogEntryType.AmazonPriceUpdate, string.Format("{0} - Successfully posted single price feed for EisSKU \'{1}\' \nRequested by: {2}",
                                                                              ChannelName, priceItem.EisSKU, submittedBy));
            }
            catch (Exception ex)
            {
                var description = string.Format("{0} - Error in submitting single price feed for EisSKU \'{3}\'. \nError Message: {1} \nRequested by: {2}",
                                                ChannelName,
                                                EisHelper.GetExceptionMessage(ex),
                                                submittedBy,
                                                priceItem.EisSKU);
                _logger.Add(LogEntrySeverity.Error, LogEntryType.AmazonPriceUpdate, description, ex.StackTrace);
            }
        }
Beispiel #2
0
        public void Should_Send_PriceListing()
        {
            // Arrange
            EisInventoryContext _context = new EisInventoryContext();
            var bcOrderInventoryProvider = new BigCommerceMarketplaceInventoryProvider();

            bcOrderInventoryProvider.Credential = _credential;

            var eisSKU          = "";
            var productListFeed = new List <MarketplacePriceFeedDto>();
            var product         = _context.products.FirstOrDefault(o => o.EisSKU == eisSKU);
            var productBC       = _context.productbigcommerces.FirstOrDefault(o => o.EisSKU == eisSKU);
            var productFeed     = new MarketplacePriceFeedDto()
            {
                EisSKU = product.EisSKU
            };

            productFeed.BigCommerceProductFeed = new BigCommerceProductFeed()
            {
                EisSKU    = productBC.EisSKU,
                ProductId = productBC.ProductId,
                FixedCostShippingPrice = productBC.FixedCostShippingPrice,
                Price       = productBC.Price,
                RetailPrice = productBC.RetailPrice
            };

            productListFeed.Add(productFeed);

            // Act
            bcOrderInventoryProvider.SubmitProductPriceFeeds(productListFeed, "Test");


            // Assert
        }
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);
            }
        }