Esempio n. 1
0
        public static string GetSalesTax(string city, string state, string streetAddress, string zipCode)
        {
            try
            {
                ProductTax = new Dictionary <string, decimal>();
                var locale = CultureInfo.CurrentCulture.Name;

                string errorMessage;
                var    address = new ServiceProvider.ShippingSvc.Address_V01()
                {
                    City  = city,
                    Line1 = streetAddress,
                    StateProvinceTerritory = locale.Substring(3).Equals("CA") && state.IndexOf(" -", System.StringComparison.Ordinal) > 0 ?
                                             state.Substring(0, state.IndexOf(" -", System.StringComparison.Ordinal)) : state,
                    PostalCode = zipCode,
                    Country    = locale.Substring(3)
                };

                string validateCity;
                string validatePostalCode;

                var user = Membership.GetUser();

                // Getting the sales tax from provider.
                ProductTax = OrderProvider.GetAllTaxRateFromVertex(
                    user.UserName,
                    System.Threading.Thread.CurrentThread.CurrentCulture.ToString(),
                    address,
                    out errorMessage, out validateCity, out validatePostalCode);

                CheckIsMultiple();
                return(string.IsNullOrEmpty(errorMessage)
                           ? string.Concat((IsMultipleRate ? "Multiple" : ProductTax.First().Value.ToString("00.00")), "@",
                                           validateCity, "@", validatePostalCode)
                           : errorMessage);
            }
            catch (Exception ex)
            {
                LoggerHelper.Exception(ProviderPolicies.SYSTEM_EXCEPTION, ex);
                throw;
            }
        }
Esempio n. 2
0
 public Dictionary <string, decimal> GetAllTaxRateFromVertex(string distributorId, string locale, ServiceProvider.ShippingSvc.Address_V01 address, out string errorMessage, out string validateCity, out string validateZipCode)
 {
     return(OrderProvider.GetAllTaxRateFromVertex(distributorId, locale, address, out errorMessage, out validateCity, out validateZipCode));
 }