public static ShopperConfiguration FromVault() { var jsonString = ShopperConfigurationReader.GetSecretValue().Result; var result = new ShopperConfiguration(); JsonConvert.PopulateObject(jsonString, result); return(result); }
//Methods #region Create /// <summary> /// Creates a configuration section handler. /// </summary> /// <param name="parent">Parent object.</param> /// <param name="configContext">Configuration context object.</param> /// <param name="section">Section XML node.</param> /// <returns>The created section handler object.</returns> public object Create(object parent, object configContext, XmlNode section) { ShopperConfiguration result = new ShopperConfiguration(); result.ImageBaseUrl = section[nameof(ShopperConfiguration.ImageBaseUrl)].InnerText; result.CurrentTaxRate = Convert.ToDecimal(section[nameof(ShopperConfiguration.CurrentTaxRate)].InnerText); result.ImportDaysBack = Convert.ToInt32(section[nameof(ShopperConfiguration.ImportDaysBack)].InnerText); result.Locations.InvoicePath = new DirectoryInfo(section[nameof(ShopperConfiguration.Locations)][nameof(ShopperConfiguration.LocationsConfiguration.InvoicePath)].InnerText); result.Locations.ArticleImagePath = new DirectoryInfo(section[nameof(ShopperConfiguration.Locations)][nameof(ShopperConfiguration.LocationsConfiguration.ArticleImagePath)].InnerText); result.Locations.SyncerApplicationExe = new FileInfo(section[nameof(ShopperConfiguration.Locations)][nameof(ShopperConfiguration.LocationsConfiguration.SyncerApplicationExe)].InnerText); result.Email.SmtpServerHostname = section[nameof(ShopperConfiguration.Email)][nameof(ShopperConfiguration.EmailConfiguration.SmtpServerHostname)].InnerText; result.Email.SmtpServerPort = Convert.ToInt32(section[nameof(ShopperConfiguration.Email)][nameof(ShopperConfiguration.EmailConfiguration.SmtpServerPort)].InnerText); result.Email.SmtpAuthUser = section[nameof(ShopperConfiguration.Email)][nameof(ShopperConfiguration.EmailConfiguration.SmtpAuthUser)].InnerText; result.Email.SmtpAuthPassword = section[nameof(ShopperConfiguration.Email)][nameof(ShopperConfiguration.EmailConfiguration.SmtpAuthPassword)].InnerText; result.Email.EmailAddressOfOfferSender = new MailAddress(section[nameof(ShopperConfiguration.Email)][nameof(ShopperConfiguration.EmailConfiguration.EmailAddressOfOfferSender)].InnerText); result.Printing.User = section[nameof(ShopperConfiguration.Printing)][nameof(ShopperConfiguration.PrintingConfiguration.User)].InnerText; result.Printing.Password = section[nameof(ShopperConfiguration.Printing)][nameof(ShopperConfiguration.PrintingConfiguration.Password)].InnerText; result.Ebay.ApiServerUrl = section[nameof(ShopperConfiguration.Ebay)][nameof(ShopperConfiguration.EbayConfiguration.ApiServerUrl)].InnerText; result.Ebay.ApiToken = section[nameof(ShopperConfiguration.Ebay)][nameof(ShopperConfiguration.EbayConfiguration.ApiToken)].InnerText; result.Magento.ShopRootUrl = new Uri(section[nameof(ShopperConfiguration.Magento)][nameof(ShopperConfiguration.MagentoConfiguration.ShopRootUrl)].InnerText); result.Magento.User = section[nameof(ShopperConfiguration.Magento)][nameof(ShopperConfiguration.MagentoConfiguration.User)].InnerText; result.Magento.Password = section[nameof(ShopperConfiguration.Magento)][nameof(ShopperConfiguration.MagentoConfiguration.Password)].InnerText; result.Magento.ConsumerKey = section[nameof(ShopperConfiguration.Magento)][nameof(ShopperConfiguration.MagentoConfiguration.ConsumerKey)].InnerText; result.Magento.ConsumerSecret = section[nameof(ShopperConfiguration.Magento)][nameof(ShopperConfiguration.MagentoConfiguration.ConsumerSecret)].InnerText; result.Mandantor.Company = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Company)].InnerText; result.Mandantor.WebUrl = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.WebUrl)].InnerText; result.Mandantor.Email = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Email)].InnerText; result.Mandantor.Street = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Street)].InnerText; result.Mandantor.StreetNr = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.StreetNr)].InnerText; result.Mandantor.Zip = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Zip)].InnerText; result.Mandantor.City = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.City)].InnerText; result.Mandantor.Phone = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Phone)].InnerText; result.Mandantor.Fax = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Fax)].InnerText; result.Mandantor.DpdNr = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.DpdNr)].InnerText; result.Mandantor.CountryIso2 = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.CountryIso2)].InnerText; result.Mandantor.CountryIso3 = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.CountryIso3)].InnerText; result.Mandantor.Tax = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Tax)].InnerText; result.Mandantor.Bank = section[nameof(ShopperConfiguration.Mandantor)][nameof(ShopperConfiguration.MandantorConfiguration.Bank)].InnerText; return(result); }