private PublicOrder CreateBasicOrder() { string country = this.countryProvider.GetDefaultCountry().Code; var vatValidationResult = vatNumberValidator.ValidateCustomerVatNumber(); var vatNumber = string.Empty; if (vatValidationResult != null && vatValidationResult.Valid) { vatNumber = vatValidationResult.VatNumber; country = vatValidationResult.CountryCode; } else if (this.contactDataProvider != null) { var allContacts = this.contactDataProvider.GetContactData(); IEnumerable <ContactData> contacts = allContacts?.GetContactData(); if (contacts != null) { ContactData contactData = contacts.FirstOrDefault(c => c.Id == "BillingContact" && !string.IsNullOrEmpty(c.Country)) ?? contacts.FirstOrDefault(c => c.Id == "MainContact" && !string.IsNullOrEmpty(c.Country)); if (!string.IsNullOrEmpty(contactData?.Country)) { country = contactData.Country; } } } return(new PublicOrder { ResellerId = resellerProvider.GetReseller().Id, Country = country, Currency = currencyPreferenceProvider.GetCurrentCurrency().Code, LegalNumber = vatNumber }); }
private PublicOrder CreateBasicOrder() { string country = this.countryProvider.GetDefaultCountry().Code; if (this.contactDataProvider != null) { var allContacts = this.contactDataProvider.GetContactData(); IEnumerable <ContactData> contacts = allContacts?.GetContactData(); if (contacts != null) { ContactData contactData = contacts.FirstOrDefault(c => c.Id == "BillingContact" && !string.IsNullOrEmpty(c.Country)) ?? contacts.FirstOrDefault(c => c.Id == "MainContact" && !string.IsNullOrEmpty(c.Country)); if (!string.IsNullOrEmpty(contactData?.Country)) { country = contactData.Country; } } } return(new PublicOrder { ResellerId = resellerProvider.GetReseller().Id, Country = country, Currency = currencyPreferenceProvider.GetCurrentCurrency().Code }); }
/// <summary> /// Set order currency from customer's currency preference /// </summary> public override PublicOrder AmendOrder(PublicOrder order, PublicOrderContext orderContext) { var currency = currencyPreferenceProvider.GetCurrentCurrency(); order.Currency = currency.Code; return(order); }
/// <summary> /// Construct a new instance /// </summary> public DomainsProvider( IResellerDataProvider resellerDataProvider, ICurrencyPreferenceProvider currencyPreferenceProvider, ApiProductsProvider apiProductsProvider, ProductMapper productMapper, PublicBillingApiProxy billingApi, IShopNameProvider shopNameProvider) : base(billingApi) { if (resellerDataProvider == null) { throw new ArgumentException("resellerDataProvider"); } if (currencyPreferenceProvider == null) { throw new ArgumentException("currencyPreferenceProvider"); } if (apiProductsProvider == null) { throw new ArgumentNullException("apiProductsProvider"); } if (productMapper == null) { throw new ArgumentNullException("productMapper"); } if (shopNameProvider == null) { throw new ArgumentNullException("shopNameProvider"); } var resellerData = resellerDataProvider.GetResellerAccountData(); this.resellerId = resellerData.Id; this.countryCode = resellerData.DefaultCountry.Code; this.currencyCode = currencyPreferenceProvider.GetCurrentCurrency().Code; this.productMapper = productMapper; this.shopNameProvider = shopNameProvider; this.tldProducts = apiProductsProvider.GetProductsByCategories(new List <string> { "TLD" }); }
/// <summary> /// Construct a new instance /// </summary> public DomainsProvider( IResellerDataProvider resellerDataProvider, ICurrencyPreferenceProvider currencyPreferenceProvider, ApiProductsProvider apiProductsProvider, ProductMapper productMapper, PublicBillingApiProxy billingApi, IShopNameProvider shopNameProvider) : base(billingApi) { if (resellerDataProvider == null) { throw new ArgumentException("resellerDataProvider"); } if (currencyPreferenceProvider == null) { throw new ArgumentException("currencyPreferenceProvider"); } if (apiProductsProvider == null) { throw new ArgumentNullException("apiProductsProvider"); } if (productMapper == null) { throw new ArgumentNullException("productMapper"); } if (shopNameProvider == null) { throw new ArgumentNullException("shopNameProvider"); } var resellerData = resellerDataProvider.GetResellerAccountData(); this.resellerId = resellerData.Id; this.countryCode = resellerData.DefaultCountry.Code; this.currencyCode = currencyPreferenceProvider.GetCurrentCurrency().Code; this.productMapper = productMapper; this.shopNameProvider = shopNameProvider; this.tldProducts = apiProductsProvider.GetProductsByCategories(new List<string> { "TLD" }); }
public ProductMapper(ILanguagePreferenceProvider languagePreferenceProvider, ICurrencyPreferenceProvider currencyPreferenceProvider, IVatDisplayPreferenceProvider vatDisplayPreferenceProvider, IResellerProvider resellerProvider) { if (languagePreferenceProvider == null) { throw new ArgumentNullException("languagePreferenceProvider"); } if (currencyPreferenceProvider == null) { throw new ArgumentNullException("currencyPreferenceProvider"); } if (vatDisplayPreferenceProvider == null) { throw new ArgumentNullException("vatDisplayPreferenceProvider"); } this.language = languagePreferenceProvider.GetCurrentLanguage(); this.currencyCode = currencyPreferenceProvider.GetCurrentCurrency().Code; this.pricesIncludeVat = vatDisplayPreferenceProvider.ShowPricesIncludingVat(); this.inclusiveTaxCalculationType = resellerProvider.GetReseller().InclusiveTaxCalculationType; }
public ProductMapper(ILanguagePreferenceProvider languagePreferenceProvider, ICurrencyPreferenceProvider currencyPreferenceProvider, IVatDisplayPreferenceProvider vatDisplayPreferenceProvider, IResellerProvider resellerProvider) { if (languagePreferenceProvider == null) { throw new ArgumentNullException("languagePreferenceProvider"); } if (currencyPreferenceProvider == null) { throw new ArgumentNullException("currencyPreferenceProvider"); } if (vatDisplayPreferenceProvider == null) { throw new ArgumentNullException("vatDisplayPreferenceProvider"); } this.language = languagePreferenceProvider.GetCurrentLanguage(); this.currencyCode = currencyPreferenceProvider.GetCurrentCurrency().Code; this.pricesIncludeVat = vatDisplayPreferenceProvider.ShowPricesIncludingVat(); this.inclusiveTaxCalculationType = resellerProvider.GetReseller().InclusiveTaxCalculationType; }
public CurrencyFormatter() { this.currencyCode = currencyPreferenceProvider.GetCurrentCurrency().Code; this.culture = CultureInfo.GetCultures(CultureTypes.SpecificCultures).First(c => new RegionInfo(c.LCID).ISOCurrencySymbol == currencyCode.ToUpper()); }