Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

AvalaraTaxDefaults.cs

using Nop.Core;
using Nop.Core.Caching;

namespace Nop.Plugin.Tax.Avalara;

/// 
/// Represents plugin constants
/// 
public class AvalaraTaxDefaults
{
    /// 
    /// Gets the Avalara tax provider system name
    /// 
    public static string SystemName => "Tax.Avalara";

    /// 
    /// Gets the user agent used to request third-party services
    /// 
    public static string UserAgent => $"nopCommerce-{NopVersion.CURRENT_VERSION}";

    /// 
    /// Gets the Avalara tax provider connector name
    /// 
    public static string ApplicationName => "nopCommerce-AvalaraTaxRateProvider|a0o33000004BoPM";

    /// 
    /// Gets the Avalara tax provider version (used a nopCommerce version here)
    /// 
    public static string ApplicationVersion => $"v{NopVersion.CURRENT_VERSION}";

    /// 
    /// Gets the certificates script source URL
    /// 
    public static (string Sandbox, string Live) CertificatesScriptUrl =>
        ("https://sbx.certcapture.com/gencert2/js", "https://app.certcapture.com/gencert2/js");

    /// 
    /// Gets the item classification services URL
    /// 
    public static (string Sandbox, string Live) ClassificationUrl =>
        ("https://api-sandbox.classification.avalara.net/", "https://api.classification.avalara.net/");

    /// 
    /// Gets the CertExpress default URL
    /// 
    public static string CertExpressUrl => "https://app.certexpress.com/";

    /// 
    /// Gets the configuration route name
    /// 
    public static string ConfigurationRouteName => "Plugin.Tax.Avalara.Configure";

    /// 
    /// Gets the tax categories list route name
    /// 
    public static string TaxCategoriesRouteName => "Plugin.Tax.Avalara.Tax.Categories";

    /// 
    /// Gets the webhook route name
    /// 
    public static string ItemClassificationWebhookRouteName => "Plugin.Tax.Avalara.ItemClassificationWebhook";

    /// 
    /// Gets the tax exemption certificates list route name
    /// 
    public static string ExemptionCertificatesRouteName => "Plugin.Tax.Avalara.ExemptionCertificates";

    /// 
    /// Gets the download exemption certificate route name
    /// 
    public static string DownloadCertificateRouteName => "Plugin.Tax.Avalara.DownloadCertificate";

    /// 
    /// Gets the class name of the tax exemption certificates menu item
    /// 
    public static string ExemptionCertificatesMenuClassName => "exemption-certificates";

    /// 
    /// Gets the tab id of the tax exemption certificates menu item
    /// 
    public static int ExemptionCertificatesMenuTab => 420;

    /// 
    /// Gets the name of the generic attribute that is used to store Avalara system tax code description
    /// 
    public static string TaxCodeDescriptionAttribute => "AvalaraTaxCodeDescription";

    /// 
    /// Gets the name of the generic attribute that is used to store a tax code type
    /// 
    public static string TaxCodeTypeAttribute => "AvalaraTaxCodeType";

    /// 
    /// Gets the name of the generic attribute that is used to store an entity use code (customer usage type)
    /// 
    public static string EntityUseCodeAttribute => "AvalaraEntityUseCode";

    /// 
    /// Gets the key for caching tax rate by zip code
    /// 
    /// 
    /// {0} - Zip postal code
    /// 
    public static CacheKey TaxRateByZipCacheKey => new("Nop.avalara.taxratebyzip.{0}");

    /// 
    /// Gets the key for caching tax rate
    /// 
    /// 
    /// {0} - Customer id
    /// {1} - Tax category id
    /// {2} - Address
    /// {3} - City
    /// {4} - State or province identifier
    /// {5} - Country identifier
    /// {6} - Zip postal code
    /// 
    public static CacheKey TaxRateCacheKey => new("Nop.avalara.taxrate.{0}-{1}-{2}-{3}-{4}-{5}-{6}", TaxRateCacheKeyByCustomerPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : Customer id
    /// 
    public static string TaxRateCacheKeyByCustomerPrefix => "Nop.avalara.taxrate.{0}-";

    /// 
    /// Gets the key for caching Avalara tax code types
    /// 
    public static CacheKey TaxCodeTypesCacheKey => new("Nop.avalara.taxcodetypes");

    /// 
    /// Gets the key for caching Avalara system entity use codes
    /// 
    public static CacheKey EntityUseCodesCacheKey => new("Nop.avalara.entityusecodes");

    /// 
    /// Gets the path to file that contains tax rates
    /// 
    public static string TaxRatesFilePath => "wwwroot/files/taxrates.csv";

    /// 
    /// Gets the name, type and period in days of a schedule task to download tax rates
    /// 
    public static (string Name, string Type, int Days) DownloadTaxRatesTask =>
        ($"Download tax rates ({SystemName})", "Nop.Plugin.Tax.Avalara.Services.DownloadTaxRatesTask", 7);

    /// 
    /// Gets the generic attribute name to hide general settings block on the plugin configuration page
    /// 
    public static string HideGeneralBlock => "AvalaraPage.HideGeneralBlock";

    /// 
    /// Gets the generic attribute name to hide item classification block on the plugin configuration page
    /// 
    public static string HideItemClassificationBlock => "AvalaraPage.HideItemClassificationBlock";

    /// 
    /// Gets the generic attribute name to hide log block on the plugin configuration page
    /// 
    public static string HideLogBlock => "AvalaraPage.HideLogBlock";
}