protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var log = GetLogger(); var settings = new SettingsService(dbFactory); var lastSyncDate = settings.GetListingsReadDate(_api.Market, _api.MarketplaceId); LogWrite("Last sync date=" + lastSyncDate); var syncer = new SupplierOasisItemsSync(GetLogger(), time, dbFactory); if (!lastSyncDate.HasValue || (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval) { try { syncer.ReadItemsInfo(_api); } catch (Exception ex) { log.Error("ReadItemsInfo", ex); } settings.SetListingsReadDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } }
public void SyncItemsFromSample(SupplieroasisApi api) { var coreApi = new Mock <ISupplieroasisCoreApi>(MockBehavior.Strict); var asinsWithErrors = new List <string>(); coreApi.Setup(p => p.GetItems()).Returns(() => { using (var sr = new StringReader(File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files/OverstockSampleResponses/overstock_get_inventory_response.xml")))) { XmlSerializer serializer = new XmlSerializer(typeof(GetInventoryResponse)); return(CallResult <GetInventoryResponse> .Success((GetInventoryResponse)serializer.Deserialize(sr))); } }); api.OverrideCoreApi(coreApi.Object); var itemService = new SupplierOasisItemsSync(_log, _time, _dbFactory); itemService.ReadItemsInfo(api); }
protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var log = GetLogger(); var settings = new SettingsService(dbFactory); var lastSyncDate = settings.GetListingsQuantityToAmazonSyncDate(_api.Market, _api.MarketplaceId); LogWrite("Last sync date=" + lastSyncDate); if (!lastSyncDate.HasValue || (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval) { var sync = new SupplierOasisItemsSync(log, time, dbFactory); sync.SendInventoryUpdates(_api); settings.SetListingsQuantityToAmazonSyncDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } }
public void SendInventoryUpdates(SupplieroasisApi api, IList <string> skuList) { var itemService = new SupplierOasisItemsSync(_log, _time, _dbFactory); itemService.SendInventoryUpdates(api, skuList); }
public void SyncItems(SupplieroasisApi api) { var itemService = new SupplierOasisItemsSync(_log, _time, _dbFactory); itemService.ReadItemsInfo(api); }