taxcloud/ZenCart — pull request #2 by retched (2014-05-09 21:50:15+00:00)
Title: Fix for non-captured "virtual" transactions

This patch is to fix TaxCloud not capturing any "virtual" transactions which included (virtual) Gift Certificates, digital downloads, and other transactions which do not get a delivery address.

This is due to the inner workings of ZenCart not assigning a delivery address for any non-physical items. Rightfully so since delivery addresses aren't captured on checkout. Since there was no delivery address, the $TAXCLOUD_ENABLE check would always fail since there is no delivery address.

The changes will now tell TaxCloud/ZenCart to pull up an order's country code from the delivery_country, billing_country, and customers_country fields. If the order does not have a delivery_country, the program will look to the billing_country. If the order does not have a billing_country either, go to the customers_country. Since it is possible to not require a customers_country on account creation, the penultimate fall back would be to use the STORE_COUNTRY definition defined in the Configuration > My Store area. If all of that fails, I just assigned a number of 0 like it was in default.