Exemplo n.º 1
0
        public void RetireToUnpublishItems(WalmartApi api)
        {
            using (var db = _dbFactory.GetRWDb())
            {
                var items = db.Items.GetAllViewAsDto().Where(i => i.Market == (int)MarketType.Walmart &&
                                                             i.PublishedStatus == (int)PublishedStatuses.HasUnpublishRequest)
                            .ToList();

                foreach (var item in items)
                {
                    var result = api.RetireItem(item.SKU);
                    if (result.IsSuccess)
                    {
                        _log.Info("SKU was unpublished=" + item.SKU);
                        var dbItem = db.Items.Get(item.Id);
                        dbItem.ItemPublishedStatus = (int)PublishedStatuses.Unpublished;
                        db.Commit();
                    }
                    else
                    {
                        _log.Info("Unable to unpublish SKU=" + item.SKU);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void SubmitItemsFeed(WalmartApi api,
                                    List <string> asinList,
                                    PublishedStatuses overrideStatus)
        {
            //api.GetFeedItems("5C8BE412C2754386B8BEEE11D968AE91@AQMBAQA");

            var feed = new WalmartItemsFeed(_log,
                                            _time,
                                            api,
                                            _dbFactory,
                                            AppSettings.WalmartFeedBaseDirectory,
                                            AppSettings.SwatchImageDirectory,
                                            AppSettings.SwatchImageBaseUrl,
                                            AppSettings.WalmartImageDirectory,
                                            AppSettings.WalmartImageBaseUrl);

            var steps = new StepSleeper(TimeSpan.FromMinutes(5), 1);

            var feedDto = feed.CheckFeedStatus(TimeSpan.FromHours(12));

            if (feedDto == null)
            {
                feed.SubmitFeed(asinList, overrideStatus);
            }

            //steps.NextStep();
        }
Exemplo n.º 3
0
        public CallWalmartProcessing(ILogService log,
                                     ITime time,
                                     ICacheService cacheService,
                                     IDbFactory dbFactory,
                                     IEmailService emailService,
                                     IItemHistoryService itemHistoryService,
                                     WalmartApi walmartApi,
                                     CompanyDTO company)
        {
            _log                = log;
            _time               = time;
            _dbFactory          = dbFactory;
            _cacheService       = cacheService;
            _walmartApi         = walmartApi;
            _company            = company;
            _emailService       = emailService;
            _itemHistoryService = itemHistoryService;

            _actionService  = new SystemActionService(_log, _time);
            _htmlScraper    = new HtmlScraperService(log, time, dbFactory);
            _barcodeService = new BarcodeService(log, time, dbFactory);

            _openApi = new WalmartOpenApi(_log, "trn9fdghvb8p9gjj9j6bvjwx");
            _autoCreateListingService = new AutoCreateWalmartListingService(log,
                                                                            time,
                                                                            dbFactory,
                                                                            _cacheService,
                                                                            _barcodeService,
                                                                            _emailService,
                                                                            _openApi,
                                                                            itemHistoryService,
                                                                            AppSettings.IsDebug);
        }
Exemplo n.º 4
0
        public void GetFeedList(WalmartApi api)
        {
            var feeds      = api.GetFeeds();
            var lastFeedId = feeds.First().AmazonIdentifier;
            var feedItems  = api.GetFeedItems(lastFeedId);

            _log.Info(feedItems.ToString());
        }
Exemplo n.º 5
0
        public void GetInventory(WalmartApi api)
        {
            var sku = "17CI000XDSZA-";

            var result = api.GetInventory(sku);

            _log.Info(result.ToString());
        }
Exemplo n.º 6
0
        public void GetOrders(WalmartApi api)
        {
            var orders = api.GetOrders(_log, _time.GetAppNowTime().AddDays(-7), null);
            var order  = orders.FirstOrDefault(o => o.OrderId == "1577092869434");

            _log.Info(order.ToString());
            _log.Info(orders.ToString());
        }
Exemplo n.º 7
0
        public void GetItemsReport(WalmartApi api)
        {
            var reportPath = api.GetItemsReport(AppSettings.WalmartReportBaseDirectory);
            var report     = new WalmartReport(reportPath);
            var items      = report.GetItems();

            _log.Info("Items count: " + items.Count);
            _log.Info("Report: " + reportPath);
        }
Exemplo n.º 8
0
        public void ProcessCancellation(WalmartApi api)
        {
            var actionService = new SystemActionService(_log, _time);
            var updater       = new WalmartOrderCancellation(api, actionService, _log, _time);

            using (var db = _dbFactory.GetRWDb())
            {
                updater.ProcessCancellations(db);
            }
        }
Exemplo n.º 9
0
        public void ReadInventoryInfo(WalmartApi api)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.ReadListingInventory();
        }
Exemplo n.º 10
0
        public void GetFeedItems(WalmartApi api)
        {
            var feedItems = api.GetFeedItems("1725915FF4EF4616AB097CDA1D2908D6@AQkBAAA");
            var item1     = feedItems.Data.FirstOrDefault(i => i.ItemId == "K182277PP-3T");
            var item2     = feedItems.Data.FirstOrDefault(i => i.ItemId == "K182277PP-4T");

            _log.Info(item1.Status);
            _log.Info(item2.Status);
            _log.Info(feedItems.ToString());
        }
Exemplo n.º 11
0
        public void ReadRefunds(WalmartApi api)
        {
            var walmartReader = new WalmartReturnInfoReader(_log,
                                                            _time,
                                                            (WalmartApi)api,
                                                            _dbFactory,
                                                            AppSettings.WalmartReportBaseDirectory,
                                                            AppSettings.WalmartFeedBaseDirectory);

            walmartReader.UpdateReturnInfo();
        }
Exemplo n.º 12
0
        public void SubmitPriceFeed(WalmartApi api, IList <string> skuList)
        {
            var feed = new WalmartPriceFeed(_log, _time, api, _dbFactory,
                                            AppSettings.WalmartFeedBaseDirectory);

            var feedDto = feed.CheckFeedStatus(TimeSpan.Zero);

            if (feedDto == null) //NOTE: no feed to check
            {
                feed.SubmitFeed(skuList);
            }
        }
Exemplo n.º 13
0
        public void SubmitTestInventoryFeed(WalmartApi api)
        {
            var item1 = new ItemDTO()
            {
                SKU          = "K182834PP-3T",
                RealQuantity = 5,
            };

            api.SubmitInventoryFeed("1", new List <ItemDTO>()
            {
                item1
            }, AppSettings.WalmartFeedBaseDirectory);
        }
Exemplo n.º 14
0
 public WalmartReturnInfoReader(ILogService log,
                                ITime time,
                                WalmartApi api,
                                IDbFactory dbFactory,
                                string reportBaseDirectory,
                                string feedBaseDirectory)
 {
     _api                 = api;
     _log                 = log;
     _time                = time;
     _dbFactory           = dbFactory;
     _reportBaseDirectory = reportBaseDirectory;
     _feedBaseDirectory   = feedBaseDirectory;
 }
Exemplo n.º 15
0
        public void SubmitInventoryFeed(WalmartApi api, IList <string> skuList)
        {
            var feed = new WalmartInventoryFeed(_log, _time, api, _dbFactory, AppSettings.WalmartFeedBaseDirectory);

            var steps = new StepSleeper(TimeSpan.FromMinutes(5), 1);

            var feedDto = feed.CheckFeedStatus(TimeSpan.Zero);

            if (feedDto == null)
            {
                feed.SubmitFeed(skuList);
            }

            //steps.NextStep();
        }
Exemplo n.º 16
0
        public void SubmitSecondDayItems(WalmartApi api)
        {
            using (var db = _dbFactory.GetRWDb())
            {
                var secondDaySKUs = db.Items.GetAllViewAsDto()
                                    .Where(i => i.Market == (int)MarketType.Walmart && i.IsPrime)
                                    .OrderBy(i => i.Id)
                                    .Select(i => i.SKU)
                                    //.Skip(200)
                                    //.Take(200)
                                    .ToList();

                SubmitItemsFeed(api, secondDaySKUs, PublishedStatuses.None);
            }
        }
Exemplo n.º 17
0
        public void GetApsentItemsFromReport(WalmartApi api)
        {
            var reportPath = api.GetItemsReport(AppSettings.WalmartReportBaseDirectory);
            var report     = new WalmartReport(reportPath);
            var items      = report.GetItems();

            _log.Info("Items count: " + items.Count);
            _log.Info("Report: " + reportPath);

            using (var db = _dbFactory.GetRWDb())
            {
                var existListings = db.Listings.GetAll().Where(l => l.Market == (int)MarketType.Walmart).ToList();
                foreach (var item in items)
                {
                    var existListing = existListings.FirstOrDefault(l => l.SKU == item.SKU);
                    if (existListing == null)
                    {
                        _log.Info("SKU=" + item.SKU + ", Qty=" + item.AmazonRealQuantity);
                    }
                }
            }
        }
Exemplo n.º 18
0
        public void SubmitTestPriceFeed(WalmartApi api)
        {
            var item1 = new ItemDTO()
            {
                ListPrice    = 32M,
                SKU          = "886166911080-8", // "21TE062ERDZA-1-3T",
                CurrentPrice = 17.99M
            };

            //var result = api.GetFeed("20F17E0B509143B89023AD9B8036D158@AQYBAQA");
            //_log.Info(result.ToString());

            //var result = api.SendPrice(item1);
            //_log.Info(result.ToString());

            //steps.NextStep();


            api.SubmitPriceFeed(Guid.NewGuid().ToString(), new List <ItemDTO>()
            {
                item1
            }, AppSettings.WalmartFeedBaseDirectory);
        }
Exemplo n.º 19
0
        public void SubmitItemsWithChildFeed(WalmartApi api, List <string> skuList)
        {
            var allSkuList = new List <string>();

            using (var db = _dbFactory.GetRWDb())
            {
                var parentASINs = (from i in db.Items.GetAll()
                                   join l in db.Listings.GetAll() on i.Id equals l.ItemId
                                   where skuList.Contains(l.SKU) &&
                                   l.Market == (int)api.Market &&
                                   (l.MarketplaceId == api.MarketplaceId ||
                                    String.IsNullOrEmpty(api.MarketplaceId))
                                   select i.ParentASIN).ToList();

                allSkuList = (from i in db.Items.GetAll()
                              join l in db.Listings.GetAll() on i.Id equals l.ItemId
                              where parentASINs.Contains(i.ParentASIN) &&
                              i.Market == (int)api.Market &&
                              (i.MarketplaceId == api.MarketplaceId ||
                               String.IsNullOrEmpty(api.MarketplaceId))
                              select l.SKU).ToList();
            }
            SubmitItemsFeed(api, allSkuList, PublishedStatuses.None);
        }
Exemplo n.º 20
0
        public void Setup()
        {
            Database.SetInitializer <AmazonContext>(null);
            XmlConfigurator.Configure(new FileInfo(AppSettings.log4net_Config));

            _dbFactory = new DbFactory();
            _time      = new TimeService(_dbFactory);
            _settings  = new SettingsService(_dbFactory);

            _styleHistoryService = new StyleHistoryService(_log, _time, _dbFactory);
            _styleManager        = new StyleManager(_log, _time, _styleHistoryService);
            _actionService       = new SystemActionService(_log, _time);
            _quantityManager     = new QuantityManager(_log, _time);
            _priceManager        = new PriceManager(_log, _time, _dbFactory, _actionService, _settings);
            _cacheService        = new CacheService(_log, _time, _actionService, _quantityManager);
            _barcodeService      = new BarcodeService(_log, _time, _dbFactory);
            _weightService       = new WeightService();

            IEmailSmtpSettings smtpSettings = new EmailSmtpSettings();

            using (var db = new UnitOfWork())
            {
                _company = db.Companies.GetFirstWithSettingsAsDto();

                if (AppSettings.IsDebug)
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromAppSettings();
                }
                else
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(_company);
                }

                _addressService = AddressService.Default;
                _emailService   = new EmailService(_log, smtpSettings, _addressService);

                //todo check itemHist
                _autoCreateNonameListingService = new AutoCreateNonameListingService(_log,
                                                                                     _time,
                                                                                     _dbFactory,
                                                                                     _cacheService,
                                                                                     _barcodeService,
                                                                                     _emailService, null,
                                                                                     AppSettings.IsDebug);

                var marketplaces = new MarketplaceKeeper(_dbFactory, true);
                marketplaces.Init();

                var shipmentPrividers = db.ShipmentProviders.GetByCompanyId(_company.Id);

                var apiFactory = new MarketFactory(marketplaces.GetAll(), _time, _log, _dbFactory, AppSettings.JavaPath);

                var weightService = new WeightService();

                var serviceFactory = new ServiceFactory();
                var rateProviders  = serviceFactory.GetShipmentProviders(_log,
                                                                         _time,
                                                                         _dbFactory,
                                                                         weightService,
                                                                         shipmentPrividers,
                                                                         null,
                                                                         null,
                                                                         null,
                                                                         null);

                _magentoApi    = (Magento20MarketApi)apiFactory.GetApi(_company.Id, MarketType.Magento, MarketplaceKeeper.ShopifyDWS);
                _shopifyDWSApi = (ShopifyApi)apiFactory.GetApi(_company.Id, MarketType.Shopify, MarketplaceKeeper.ShopifyDWS);
                _eBayApi       = (eBayApi)apiFactory.GetApi(_company.Id, MarketType.eBay, "");
                _amazonApi     = (AmazonApi)apiFactory.GetApi(_company.Id, MarketType.Amazon, MarketplaceKeeper.AmazonComMarketplaceId);
                _walmartApi    = (WalmartApi)apiFactory.GetApi(_company.Id, MarketType.Walmart, "");
            }
        }
Exemplo n.º 21
0
 public void GetAllItems(WalmartApi api)
 {
     api.GetAllItems();
 }
Exemplo n.º 22
0
        public void GetFeed(WalmartApi api, string feedId)
        {
            var feed = api.GetFeed(feedId);

            _log.Info(feed.ToString());
        }
Exemplo n.º 23
0
 public void GetItemBySKU(WalmartApi api)
 {
     api.GetItemBySKU("US213-3T");
 }