File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/App_Code/Pux/Utils/EcommerceTools.cs
using CMS.Ecommerce;
using CMS.Globalization;
using CMS.Helpers;
using CMS.SiteProvider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Pux
{
public class EcommerceTools
{
public static double GetTax(string taxCode = "DPH", string countryCode = "CZK", double defaultTax = 21)
{
return CacheHelper.Cache<double>(() =>
{
CountryInfo country = CountryInfoProvider.GetCountryInfoByCode(countryCode);
if (country != null)
{
TaxClassInfo taxClass = TaxClassInfoProvider.GetTaxClassInfo(taxCode, SiteContext.CurrentSiteName);
if (taxClass != null)
{
TaxClassCountryInfo taxClassCountryInfo = TaxClassCountryInfoProvider.GetTaxClassCountryInfo(country.CountryID, taxClass.TaxClassID);
return taxClassCountryInfo.TaxValue;
}
}
return defaultTax;
}, new CacheSettings(10, SiteContext.CurrentSiteName + ".Pux.EcommerceTools.GetTax." + taxCode + "." + countryCode + "." + defaultTax.ToString()));
}
}
}