Kentico 7 Avalara Set-Up

Follow

Installation

Inside the download, add the project inside JMA.Custom to your Kentico solution. Build the project on these assemblies:





The Avalara.AvaTax.Adapter.dll is in the bin folder of the download. Add a referece to the JMA.Custom project in your Kentico site. Next, merge the remaining files and tell Kentico that the module has been installed.

File Merge

1. Please email info@jmawebtechnologies.com with your Kentico build and hotfix number. JMA will send a custom build to you.

2. Merge the files in the download. In the App_Code folder, you will find a sample e-commerce module file. The code informs Kentico to go to Avalara for tax rates and recalculate items in the cart. When the order is set to complete or canceled, it is sent through JMACustomOrderInfoProvider and sent to Avalara for processing. For more info, please read this article:

http://devnet.kentico.com/docs/devguide/index.html?registering_providers_web_config.htm

For your reference, here is the code:

using System;

using CMS.GlobalHelper;
using CMS.SettingsProvider;
using CMS.Ecommerce;

/// <summary>
/// Sample e-commerce module class. Partial class ensures correct registration.
/// </summary>
[SampleECommerceModuleLoader]
public partial class CMSModuleLoader
{
    #region "Macro methods loader attribute"

    /// <summary>
    /// Module registration
    /// </summary>
    private class SampleECommerceModuleLoaderAttribute : CMSLoaderAttribute
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public SampleECommerceModuleLoaderAttribute()
        {
            // Require E-commerce module to load properly
            RequiredModules = new string[] { ModuleEntry.ECOMMERCE };
        }


        /// <summary>
        /// Initializes the module
        /// </summary>
        public override void Init()
        {
            // -- Uncomment this line to register the CustomShippingOptionInfoProvider programatically
            //ShippingOptionInfoProvider.ProviderObject = new CustomShippingOptionInfoProvider();

            // -- Uncomment this line to register the CustomShoppingCartInfoProvider programatically
            //ShoppingCartInfoProvider.ProviderObject = new CustomShoppingCartInfoProvider();

            // -- Uncomment this line to register the CustomShoppingCartItemInfoProvider programatically
            //ShoppingCartItemInfoProvider.ProviderObject = new CustomShoppingCartItemInfoProvider();

            // -- Uncomment this line to register the CustomSKUInfoProvider programatically
            //SKUInfoProvider.ProviderObject = new CustomSKUInfoProvider();

            ShoppingCartInfoProvider.ProviderObject = new JMA.Custom.JMACustomShoppingCartInfoProvider();


            TaxClassInfoProvider.ProviderObject = new JMA.Custom.JMACustomTaxClassInfoProvider();

            OrderInfoProvider.ProviderObject = new JMA.Custom.JMACustomOrderInfoProvider();

            // This line provides the ability to register the classes via web.config cms.extensibility section from App_Code
            ClassHelper.OnGetCustomClass += GetCustomClass;
        }


        /// <summary>
        /// Gets the custom class object based on the given class name. This handler is called when the assembly name is App_Code.
        /// </summary>
        private static void GetCustomClass(object sender, ClassEventArgs e)
        {
            if (e.Object == null)
            {
                // Provide your custom classes
                switch (e.ClassName)
                {
                    
                    case "JMACustomShoppingCartInfoProvider":
                        e.Object = new JMA.Custom.JMACustomShoppingCartInfoProvider();
                        break;

                    case "JMACustomTaxClassInfoProvider":
                        e.Object = new JMA.Custom.JMACustomTaxClassInfoProvider();
                        break;

                    case "JMACustomOrderInfoProvider":
                        e.Object = new JMA.Custom.JMACustomOrderInfoProvider();
                        break;
                }
            }
        }
    }

    #endregion
}

3. Copy the files from the .zip folder into your website. In the AvalaraAddress.xml file, enter your address.

Kentico

1. Go to Site Manager > Development > Modules > E-commerce > Configuration > Configuration and click new element. Fill in like this:

image

In the target URL field, add this line:  ~/CMSModules/Ecommerce/Pages/Tools/Configuration/Avalara/AvalaraAuthentication.aspx

2. Go to e-commerce > configuration > Avalara and fill in your credentials.

Adding Tax Codes

There are two types of subscriptions from Avalara, which are pro and basic. With Pro, you can group your products into taxable categories. These includes digital products, food, and etc. With basic, items are either taxable or non taxable. If you have the basic subscription, here are the setup steps:

First, go to ECommerce > Configuration > Tax Classes

Add an item called Sales Tax as shown below:

image

A sample Avalara code has been used, however, any code can be entered from Avalara.

Next, go to Products > Edit (pencil) > Tax Classes > Add Sales Tax:

image

Any item with this code will be taxable.

Shipping Tax

Add a tax class called shipping. Under code name, enter FR010100. If you are using a pro subscription, contact Avalara for the correct code. If you fail to follow this step, the default code is FR020200.

If you are using the pro subscription, determine your tax category. Then, add another tax class. You can add that class to your digital items.

Origin Address

Create AvalaraAddress.xml in the root of your website (next to web.config). Here is the schema:

<?xml version="1.0" encoding="utf-8" ?>
<Avalaras>
  <Avalara>
    <Name>CruiserWorks Motorcycle Gear LLC</Name>
    <Address>1355 Long Ferry Rd</Address>
    <Address2></Address2>
    <City>Salisbury</City>
    <State>NC</State>
    <Zip>28146</Zip>
    <Country>US</Country>
    <SKUIDS>0</SKUIDS>
  </Avalara>
</Avalaras>

 

Replace the address your info. If you want change your origin address based on a SKU, add a comma separate list in the SKUIDS column. The system does a lookup and pulls the address with a matching SKU. The SKUID is the primary key for the product in the COM_SKU table.  If you add a 0 for SKUIDS, then the address is the default address for all items.

 

Here is what the form fields do:

image

URL, Account Number, Company Code and License Key

You receive these from Avalara.

Product License Key from JMA

This is received from JMA with your purchase

Log Avalara Transactions

Creates a log file at ~/avalaralog.txt with info and error messages

Use Avalara in Certain States

image

Only transactions in these states will have transactions run through the service.

Use Avalara Address Validation

If you want Avalara to validate addresses, then check this box.

Order Prefix

When orders are entered in Avalara, it is the order number and this prefix.

Order Status Insert Tax

This order status that must occur before Avalara receives a Sales Invoice. Completed is the default value.

AVS settings can be found here.

Troubleshooting

If your connector fails to calculate tax or you are missing transactions in the AvaTax console, see this article.

 

Have more questions? Submit a request
Powered by Zendesk