Exemplo n.º 1
0
        protected override void RunCallback()
        {
            CompanyDTO company   = null;
            var        dbFactory = new DbFactory();
            var        time      = new TimeService(dbFactory);
            var        settings  = new SettingsService(dbFactory);
            var        log       = GetLogger();

            using (var db = dbFactory.GetRDb())
            {
                company = db.Companies.GetByIdWithSettingsAsDto(CompanyId);
            }

            var companyAddress    = new CompanyAddressService(company);
            var addressService    = new AddressService(null, companyAddress.GetReturnAddress(MarketIdentifier.Empty()), companyAddress.GetPickupAddress(MarketIdentifier.Empty()));
            var emailSmtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(company, AppSettings.IsDebug, AppSettings.IsSampleLabels);

            var actionService = new SystemActionService(log, time);
            var emailService  = new EmailService(log, emailSmtpSettings, addressService);

            var lastSyncDate = settings.GetOrdersAdjustmentDate(_api.Market, _api.MarketplaceId);

            using (var db = dbFactory.GetRWDb())
            {
                LogWrite("Last sync date=" + lastSyncDate);

                if (!lastSyncDate.HasValue ||
                    (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
                {
                    var updater = new BaseOrderRefundService(_api, actionService, emailService, log, time);
                    updater.ProcessRefunds(db, null);
                    settings.SetOrdersAdjustmentDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }
Exemplo n.º 2
0
 public void CallCompleteReturns(JetApi api)
 {
     using (var db = _dbFactory.GetRWDb())
     {
         var actionService = new SystemActionService(_log, _time);
         var service       = new BaseOrderRefundService(api, actionService, _emailService, _log, _time);
         service.ProcessRefunds(db, null);
     }
 }
Exemplo n.º 3
0
        public void CallProcessRefunds(string tag)
        {
            using (var db = _dbFactory.GetRWDb())
            {
                var actionService = new SystemActionService(_log, _time);

                var service = new BaseOrderRefundService(_walmartCAApi, actionService, _emailService, _log, _time);
                service.ProcessRefunds(db, tag);
            }
        }