Version Notes
* Add manage account and sales tax report buttons to configuration.
* Create reporting API user and role immediately after connecting to TaxJar.
* Import TaxJar product categories immediately after connecting to TaxJar.
* Fix multi-store connection issue with SID param.
* Fix non-SSL store connection issue.
Download this release
Release Info
| Developer | TaxJar |
| Extension | Taxjar_Salestaxautomation |
| Version | 2.3.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.3.0 to 2.3.1
- app/code/community/Taxjar/SalesTax/Model/Comment.php +47 -40
- app/code/community/Taxjar/SalesTax/Model/Debug.php +3 -4
- app/code/community/Taxjar/SalesTax/Model/Observer/AdminMenuItems.php +1 -1
- app/code/community/Taxjar/SalesTax/Model/Observer/AdminNotifications.php +1 -1
- app/code/community/Taxjar/SalesTax/Model/Observer/ConfigChanged.php +2 -0
- app/code/community/Taxjar/SalesTax/Model/Observer/ConfigReview.php +1 -1
- app/code/community/Taxjar/SalesTax/Model/Observer/ImportCategories.php +57 -0
- app/code/community/Taxjar/SalesTax/Model/Observer/ImportData.php +1 -16
- app/code/community/Taxjar/SalesTax/controllers/Adminhtml/TaxjarController.php +6 -0
- app/code/community/Taxjar/SalesTax/etc/config.xml +10 -1
- app/code/community/Taxjar/SalesTax/etc/wsdl.xml +17 -0
- package.xml +9 -6
app/code/community/Taxjar/SalesTax/Model/Comment.php
CHANGED
|
@@ -50,14 +50,24 @@ class Taxjar_SalesTax_Model_Comment
|
|
| 50 |
*/
|
| 51 |
private function _buildConnectedHtml()
|
| 52 |
{
|
|
|
|
|
|
|
| 53 |
$htmlString = "<p class='note'><span>Sales tax calculations at checkout for improved accuracy and product exemptions. Magento's zip-based rates can be used as a fallback.</span></p><br/>";
|
| 54 |
$htmlString .= "<p class='note'><span>TaxJar Account</span></p>";
|
| 55 |
$htmlString .= "<ul class='messages'><li class='success-msg'><span style='font-size: 1.4em'>" . $this->_apiEmail . "</span></li></ul>";
|
|
|
|
|
|
|
|
|
|
| 56 |
$htmlString .= "<p class='note'><span>Getting Started</span></p><p></p>";
|
| 57 |
$htmlString .= "<p><a href='" . Mage::helper('adminhtml')->getUrl('adminhtml/tax_nexus/index') . "'>Nexus Addresses</a><br/><span style='font-size: 0.9em'>Before enabling SmartCalcs, set up your nexus addresses so TaxJar knows where to collect sales tax.</span></p>";
|
| 58 |
$htmlString .= "<p><a href='" . Mage::helper('adminhtml')->getUrl('adminhtml/tax_class_product/index') . "'>Product Tax Classes</a><br/><span style='font-size: 0.9em'>If some of your products are tax-exempt, assign a TaxJar category tax code for new or existing product tax classes.</span></p>";
|
|
|
|
| 59 |
$htmlString .= "<p><a href='http://www.taxjar.com/contact/' target='_blank'>Help & Support</a><br/><span style='font-size: 0.9em'>Need help setting up SmartCalcs? Get in touch with our Magento sales tax experts.</span></p><br/>";
|
| 60 |
-
$htmlString .=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
return $htmlString;
|
| 62 |
}
|
| 63 |
|
|
@@ -86,52 +96,49 @@ class Taxjar_SalesTax_Model_Comment
|
|
| 86 |
$popupUrl = $authUrl . '/smartcalcs/connect/magento/?store=' . urlencode($this->_getStoreOrigin());
|
| 87 |
$guideUrl = 'http://www.taxjar.com/guides/integrations/magento/';
|
| 88 |
$connectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/taxjar/connect');
|
| 89 |
-
$
|
|
|
|
| 90 |
|
| 91 |
if ($this->_getStoreGeneralEmail()) {
|
| 92 |
$popupUrl .= '&email=' . urlencode($this->_getStoreGeneralEmail());
|
| 93 |
}
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
| 108 |
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
if (e.origin !== '{$authUrl}')
|
| 114 |
-
return;
|
| 115 |
-
|
| 116 |
-
try {
|
| 117 |
-
var data = JSON.parse(e.data);
|
| 118 |
-
if (data.api_token && data.email) {
|
| 119 |
-
window.connectPopup.postMessage('Data received', '{$authUrl}');
|
| 120 |
-
window.location = encodeURI('{$connectUrl}?api_key=' + data.api_token + '&api_email=' + data.email);
|
| 121 |
-
} else {
|
| 122 |
-
throw 'Invalid data';
|
| 123 |
-
}
|
| 124 |
-
} catch(e) {
|
| 125 |
-
alert('Invalid API token or email provided. Please try connecting to TaxJar again or contact support@taxjar.com.');
|
| 126 |
-
}
|
| 127 |
-
}, false);
|
| 128 |
-
</script>
|
| 129 |
EOT;
|
| 130 |
-
} else {
|
| 131 |
-
$htmlString = <<<EOT
|
| 132 |
-
<p><button type='button' class='scalable delete' onclick='if (window.confirm("Are you sure you want to disconnect from TaxJar? This will remove all TaxJar rates from your Magento store. If you have a paid TaxJar subscription, manage your account at https://app.taxjar.com.")) window.location="{$disconnectUrl}"'><span>Disconnect TaxJar</span></button> <button type='button' class='scalable' onclick='window.open("{$guideUrl}", "_blank")'><span>Learn More</span></button></p><br/>
|
| 133 |
-
EOT;
|
| 134 |
-
}
|
| 135 |
|
| 136 |
return $htmlString;
|
| 137 |
}
|
|
@@ -144,7 +151,7 @@ EOT;
|
|
| 144 |
*/
|
| 145 |
private function _getStoreOrigin()
|
| 146 |
{
|
| 147 |
-
$protocol =
|
| 148 |
return $protocol . $_SERVER['HTTP_HOST'];
|
| 149 |
}
|
| 150 |
|
| 50 |
*/
|
| 51 |
private function _buildConnectedHtml()
|
| 52 |
{
|
| 53 |
+
$disconnectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/taxjar/disconnect');
|
| 54 |
+
|
| 55 |
$htmlString = "<p class='note'><span>Sales tax calculations at checkout for improved accuracy and product exemptions. Magento's zip-based rates can be used as a fallback.</span></p><br/>";
|
| 56 |
$htmlString .= "<p class='note'><span>TaxJar Account</span></p>";
|
| 57 |
$htmlString .= "<ul class='messages'><li class='success-msg'><span style='font-size: 1.4em'>" . $this->_apiEmail . "</span></li></ul>";
|
| 58 |
+
$htmlString .= <<<EOT
|
| 59 |
+
<p><button type='button' class='scalable' onclick='window.open("https://app.taxjar.com/account", "_blank")'><span>Manage Account</span></button> or <a href='#' onclick='if (window.confirm("Are you sure you want to disconnect from TaxJar? This will remove all TaxJar rates from your Magento store. If you have a paid TaxJar subscription, manage your account at https://app.taxjar.com.")) window.location="{$disconnectUrl}"; return false'>Disconnect TaxJar</a></p><br/>
|
| 60 |
+
EOT;
|
| 61 |
$htmlString .= "<p class='note'><span>Getting Started</span></p><p></p>";
|
| 62 |
$htmlString .= "<p><a href='" . Mage::helper('adminhtml')->getUrl('adminhtml/tax_nexus/index') . "'>Nexus Addresses</a><br/><span style='font-size: 0.9em'>Before enabling SmartCalcs, set up your nexus addresses so TaxJar knows where to collect sales tax.</span></p>";
|
| 63 |
$htmlString .= "<p><a href='" . Mage::helper('adminhtml')->getUrl('adminhtml/tax_class_product/index') . "'>Product Tax Classes</a><br/><span style='font-size: 0.9em'>If some of your products are tax-exempt, assign a TaxJar category tax code for new or existing product tax classes.</span></p>";
|
| 64 |
+
$htmlString .= "<p><a href='http://www.taxjar.com/guides/integrations/magento/' target='_blank'>Extension User Guide</a><br/><span style='font-size: 0.9em'>Read our comprehensive Magento guide on how to configure your store properly for sales tax calculations and reporting.</span></p>";
|
| 65 |
$htmlString .= "<p><a href='http://www.taxjar.com/contact/' target='_blank'>Help & Support</a><br/><span style='font-size: 0.9em'>Need help setting up SmartCalcs? Get in touch with our Magento sales tax experts.</span></p><br/>";
|
| 66 |
+
$htmlString .= <<<EOT
|
| 67 |
+
<p><button type='button' class='scalable' onclick='window.open("https://app.taxjar.com", "_blank")'><span>View Sales Tax Reports</span></button></p>
|
| 68 |
+
EOT;
|
| 69 |
+
$htmlString .= "<p class='note'>Import your Magento transactions into TaxJar for automated sales tax reporting and filing.</p><br/>";
|
| 70 |
+
|
| 71 |
return $htmlString;
|
| 72 |
}
|
| 73 |
|
| 96 |
$popupUrl = $authUrl . '/smartcalcs/connect/magento/?store=' . urlencode($this->_getStoreOrigin());
|
| 97 |
$guideUrl = 'http://www.taxjar.com/guides/integrations/magento/';
|
| 98 |
$connectUrl = Mage::helper('adminhtml')->getUrl('adminhtml/taxjar/connect');
|
| 99 |
+
$connectUrl .= (parse_url($connectUrl, PHP_URL_QUERY) ? '&' : '?');
|
| 100 |
+
$pluginVersion = Mage::getConfig()->getModuleConfig('Taxjar_SalesTax')->version;
|
| 101 |
|
| 102 |
if ($this->_getStoreGeneralEmail()) {
|
| 103 |
$popupUrl .= '&email=' . urlencode($this->_getStoreGeneralEmail());
|
| 104 |
}
|
| 105 |
|
| 106 |
+
$popupUrl .= '&plugin=magento&version=' . $pluginVersion;
|
| 107 |
+
|
| 108 |
+
$htmlString = <<<EOT
|
| 109 |
+
<br/><p><button type='button' class='scalable' onclick='openConnectPopup("{$popupUrl}", "Connect to TaxJar", 400, 500)'><span>Connect to TaxJar</span></button> <button type='button' class='scalable' onclick='window.open("{$guideUrl}", "_blank")'><span>Learn More</span></button></p>
|
| 110 |
+
<script>
|
| 111 |
+
function openConnectPopup(url, title, w, h) {
|
| 112 |
+
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
|
| 113 |
+
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
|
| 114 |
+
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
| 115 |
+
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
| 116 |
+
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
|
| 117 |
+
var top = ((height / 2) - (h / 2)) + dualScreenTop;
|
| 118 |
+
|
| 119 |
+
window.connectPopup = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
| 120 |
|
| 121 |
+
if (window.focus) window.connectPopup.focus();
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
window.addEventListener('message', function(e) {
|
| 125 |
+
if (e.origin !== '{$authUrl}')
|
| 126 |
+
return;
|
| 127 |
+
|
| 128 |
+
try {
|
| 129 |
+
var data = JSON.parse(e.data);
|
| 130 |
+
if (data.api_token && data.email) {
|
| 131 |
+
window.connectPopup.postMessage('Data received', '{$authUrl}');
|
| 132 |
+
window.location = encodeURI('{$connectUrl}api_key=' + data.api_token + '&api_email=' + data.email);
|
| 133 |
+
} else {
|
| 134 |
+
throw 'Invalid data';
|
| 135 |
+
}
|
| 136 |
+
} catch(e) {
|
| 137 |
+
alert('Invalid API token or email provided. Please try connecting to TaxJar again or contact support@taxjar.com.');
|
| 138 |
}
|
| 139 |
+
}, false);
|
| 140 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
EOT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
return $htmlString;
|
| 144 |
}
|
| 151 |
*/
|
| 152 |
private function _getStoreOrigin()
|
| 153 |
{
|
| 154 |
+
$protocol = Mage::app()->getRequest()->isSecure() ? 'https://' : 'http://';
|
| 155 |
return $protocol . $_SERVER['HTTP_HOST'];
|
| 156 |
}
|
| 157 |
|
app/code/community/Taxjar/SalesTax/Model/Debug.php
CHANGED
|
@@ -47,9 +47,8 @@ class Taxjar_SalesTax_Model_Debug
|
|
| 47 |
private function _getDebugHtmlString()
|
| 48 |
{
|
| 49 |
$states = unserialize(Mage::getStoreConfig('tax/taxjar/states'));
|
| 50 |
-
$
|
| 51 |
-
$
|
| 52 |
-
$pluginVersion = '2.3.0';
|
| 53 |
$phpMemory = @ini_get('memory_limit');
|
| 54 |
$phpVersion = @phpversion();
|
| 55 |
$magentoVersion = Mage::getVersion();
|
|
@@ -59,6 +58,6 @@ class Taxjar_SalesTax_Model_Debug
|
|
| 59 |
$states = implode(',', $states);
|
| 60 |
}
|
| 61 |
|
| 62 |
-
return "<ul> <li><strong>Additional States:</strong> ". $states ."</li> <li><strong>API User ID:</strong> ". $
|
| 63 |
}
|
| 64 |
}
|
| 47 |
private function _getDebugHtmlString()
|
| 48 |
{
|
| 49 |
$states = unserialize(Mage::getStoreConfig('tax/taxjar/states'));
|
| 50 |
+
$apiUserId = Mage::getModel('api/user')->load('taxjar', 'username')->getUserId();
|
| 51 |
+
$pluginVersion = Mage::getConfig()->getModuleConfig('Taxjar_SalesTax')->version;
|
|
|
|
| 52 |
$phpMemory = @ini_get('memory_limit');
|
| 53 |
$phpVersion = @phpversion();
|
| 54 |
$magentoVersion = Mage::getVersion();
|
| 58 |
$states = implode(',', $states);
|
| 59 |
}
|
| 60 |
|
| 61 |
+
return "<ul> <li><strong>Additional States:</strong> ". $states ."</li> <li><strong>API User ID:</strong> ". $apiUserId ."</li><li><strong>Memory:</strong> ". $phpMemory ."</li> <li><strong>TaxJar Version:</strong> ". $pluginVersion ."</li> <li><strong>PHP Version</strong> ". $phpVersion ."</li> <li><strong>Magento Version:</strong> ". $magentoVersion ."</li> <li><strong>Last Updated:</strong> ". $lastUpdated ."</li> </ul><br/><p><small><strong>Include the above information when emailing TaxJar support at support@taxjar.com</strong><small></p>";
|
| 62 |
}
|
| 63 |
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/AdminMenuItems.php
CHANGED
|
@@ -29,4 +29,4 @@ class TaxJar_SalesTax_Model_Observer_AdminMenuItems
|
|
| 29 |
|
| 30 |
return $this;
|
| 31 |
}
|
| 32 |
-
}
|
| 29 |
|
| 30 |
return $this;
|
| 31 |
}
|
| 32 |
+
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/AdminNotifications.php
CHANGED
|
@@ -32,4 +32,4 @@ class TaxJar_SalesTax_Model_Observer_AdminNotifications extends Mage_AdminNotifi
|
|
| 32 |
$this->checkUpdate();
|
| 33 |
}
|
| 34 |
}
|
| 35 |
-
}
|
| 32 |
$this->checkUpdate();
|
| 33 |
}
|
| 34 |
}
|
| 35 |
+
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/ConfigChanged.php
CHANGED
|
@@ -30,6 +30,7 @@ class Taxjar_SalesTax_Model_Observer_ConfigChanged
|
|
| 30 |
|
| 31 |
if (isset($prevEnabled)) {
|
| 32 |
if($prevEnabled != $enabled && $enabled == 1) {
|
|
|
|
| 33 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 34 |
}
|
| 35 |
}
|
|
@@ -42,6 +43,7 @@ class Taxjar_SalesTax_Model_Observer_ConfigChanged
|
|
| 42 |
|
| 43 |
if (isset($prevEnabled)) {
|
| 44 |
if($prevEnabled != $enabled) {
|
|
|
|
| 45 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 46 |
Mage::dispatchEvent('taxjar_salestax_import_rates');
|
| 47 |
}
|
| 30 |
|
| 31 |
if (isset($prevEnabled)) {
|
| 32 |
if($prevEnabled != $enabled && $enabled == 1) {
|
| 33 |
+
Mage::dispatchEvent('taxjar_salestax_import_categories');
|
| 34 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 35 |
}
|
| 36 |
}
|
| 43 |
|
| 44 |
if (isset($prevEnabled)) {
|
| 45 |
if($prevEnabled != $enabled) {
|
| 46 |
+
Mage::dispatchEvent('taxjar_salestax_import_categories');
|
| 47 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 48 |
Mage::dispatchEvent('taxjar_salestax_import_rates');
|
| 49 |
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/ConfigReview.php
CHANGED
|
@@ -40,4 +40,4 @@ class TaxJar_SalesTax_Model_Observer_ConfigReview
|
|
| 40 |
Mage::getSingleton('core/session')->addError(Mage::helper('taxjar')->__('You have no nexus addresses loaded in Magento. Go to Sales > Tax > Nexus Addresses to sync from your TaxJar account or add a new address.'));
|
| 41 |
}
|
| 42 |
}
|
| 43 |
-
}
|
| 40 |
Mage::getSingleton('core/session')->addError(Mage::helper('taxjar')->__('You have no nexus addresses loaded in Magento. Go to Sales > Tax > Nexus Addresses to sync from your TaxJar account or add a new address.'));
|
| 41 |
}
|
| 42 |
}
|
| 43 |
+
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/ImportCategories.php
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Taxjar_SalesTax
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Taxjar
|
| 13 |
+
* @package Taxjar_SalesTax
|
| 14 |
+
* @copyright Copyright (c) 2016 TaxJar. TaxJar is a trademark of TPS Unlimited, Inc. (http://www.taxjar.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Taxjar_SalesTax_Model_Observer_ImportCategories
|
| 19 |
+
{
|
| 20 |
+
protected $_apiKey;
|
| 21 |
+
protected $_client;
|
| 22 |
+
|
| 23 |
+
public function execute(Varien_Event_Observer $observer)
|
| 24 |
+
{
|
| 25 |
+
$this->_apiKey = trim(Mage::getStoreConfig('tax/taxjar/apikey'));
|
| 26 |
+
|
| 27 |
+
if ($this->_apiKey) {
|
| 28 |
+
$this->_client = Mage::getModel('taxjar/client');
|
| 29 |
+
$this->_importCategories();
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Get TaxJar product categories
|
| 35 |
+
*
|
| 36 |
+
* @param void
|
| 37 |
+
* @return string
|
| 38 |
+
*/
|
| 39 |
+
private function _getCategoryJson()
|
| 40 |
+
{
|
| 41 |
+
$categoryJson = $this->_client->getResource($this->_apiKey, 'categories');
|
| 42 |
+
return $categoryJson['categories'];
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Import TaxJar product categories
|
| 47 |
+
*
|
| 48 |
+
* @param void
|
| 49 |
+
* @return string
|
| 50 |
+
*/
|
| 51 |
+
private function _importCategories()
|
| 52 |
+
{
|
| 53 |
+
$categoryJson = $this->_getCategoryJson();
|
| 54 |
+
Mage::getConfig()->saveConfig('tax/taxjar/categories', json_encode($categoryJson));
|
| 55 |
+
Mage::getConfig()->reinit();
|
| 56 |
+
}
|
| 57 |
+
}
|
app/code/community/Taxjar/SalesTax/Model/Observer/ImportData.php
CHANGED
|
@@ -36,18 +36,6 @@ class Taxjar_SalesTax_Model_Observer_ImportData
|
|
| 36 |
}
|
| 37 |
}
|
| 38 |
|
| 39 |
-
/**
|
| 40 |
-
* Get TaxJar product categories
|
| 41 |
-
*
|
| 42 |
-
* @param void
|
| 43 |
-
* @return string
|
| 44 |
-
*/
|
| 45 |
-
private function _getCategoryJson()
|
| 46 |
-
{
|
| 47 |
-
$categoryJson = $this->_client->getResource($this->_apiKey, 'categories');
|
| 48 |
-
return $categoryJson['categories'];
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
/**
|
| 52 |
* Get TaxJar user account configuration
|
| 53 |
*
|
|
@@ -70,16 +58,13 @@ class Taxjar_SalesTax_Model_Observer_ImportData
|
|
| 70 |
{
|
| 71 |
$configuration = Mage::getModel('taxjar/configuration');
|
| 72 |
$configJson = $this->_getConfigJson();
|
| 73 |
-
$categoryJson = $this->_getCategoryJson();
|
| 74 |
|
| 75 |
$configuration->setTaxBasis($configJson);
|
| 76 |
$configuration->setShippingTaxability($configJson);
|
| 77 |
$configuration->setDisplaySettings();
|
| 78 |
-
$configuration->setApiSettings($this->_apiKey);
|
| 79 |
|
| 80 |
-
Mage::getConfig()->saveConfig('tax/taxjar/categories', json_encode($categoryJson));
|
| 81 |
Mage::getConfig()->saveConfig('tax/taxjar/states', serialize(explode(',', $configJson['states'])));
|
| 82 |
Mage::getConfig()->saveConfig('tax/taxjar/freight_taxable', $configJson['freight_taxable']);
|
| 83 |
Mage::getConfig()->reinit();
|
| 84 |
}
|
| 85 |
-
}
|
| 36 |
}
|
| 37 |
}
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
/**
|
| 40 |
* Get TaxJar user account configuration
|
| 41 |
*
|
| 58 |
{
|
| 59 |
$configuration = Mage::getModel('taxjar/configuration');
|
| 60 |
$configJson = $this->_getConfigJson();
|
|
|
|
| 61 |
|
| 62 |
$configuration->setTaxBasis($configJson);
|
| 63 |
$configuration->setShippingTaxability($configJson);
|
| 64 |
$configuration->setDisplaySettings();
|
|
|
|
| 65 |
|
|
|
|
| 66 |
Mage::getConfig()->saveConfig('tax/taxjar/states', serialize(explode(',', $configJson['states'])));
|
| 67 |
Mage::getConfig()->saveConfig('tax/taxjar/freight_taxable', $configJson['freight_taxable']);
|
| 68 |
Mage::getConfig()->reinit();
|
| 69 |
}
|
| 70 |
+
}
|
app/code/community/Taxjar/SalesTax/controllers/Adminhtml/TaxjarController.php
CHANGED
|
@@ -34,7 +34,12 @@ class Taxjar_SalesTax_Adminhtml_TaxjarController extends Mage_Adminhtml_Controll
|
|
| 34 |
Mage::getConfig()->saveConfig('tax/taxjar/email', $apiEmail);
|
| 35 |
Mage::getConfig()->saveConfig('tax/taxjar/connected', 1);
|
| 36 |
Mage::getConfig()->reinit();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
Mage::getSingleton('core/session')->addSuccess('TaxJar account for ' . $apiEmail . ' is now connected.');
|
|
|
|
| 38 |
} else {
|
| 39 |
Mage::getSingleton('core/session')->addError('Could not connect your TaxJar account. Please make sure you have a valid API token and try again.');
|
| 40 |
}
|
|
@@ -68,6 +73,7 @@ class Taxjar_SalesTax_Adminhtml_TaxjarController extends Mage_Adminhtml_Controll
|
|
| 68 |
public function sync_ratesAction()
|
| 69 |
{
|
| 70 |
try {
|
|
|
|
| 71 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 72 |
Mage::dispatchEvent('taxjar_salestax_import_rates');
|
| 73 |
} catch (Exception $e) {
|
| 34 |
Mage::getConfig()->saveConfig('tax/taxjar/email', $apiEmail);
|
| 35 |
Mage::getConfig()->saveConfig('tax/taxjar/connected', 1);
|
| 36 |
Mage::getConfig()->reinit();
|
| 37 |
+
|
| 38 |
+
$configuration = Mage::getModel('taxjar/configuration');
|
| 39 |
+
$configuration->setApiSettings($apiKey);
|
| 40 |
+
|
| 41 |
Mage::getSingleton('core/session')->addSuccess('TaxJar account for ' . $apiEmail . ' is now connected.');
|
| 42 |
+
Mage::dispatchEvent('taxjar_salestax_import_categories');
|
| 43 |
} else {
|
| 44 |
Mage::getSingleton('core/session')->addError('Could not connect your TaxJar account. Please make sure you have a valid API token and try again.');
|
| 45 |
}
|
| 73 |
public function sync_ratesAction()
|
| 74 |
{
|
| 75 |
try {
|
| 76 |
+
Mage::dispatchEvent('taxjar_salestax_import_categories');
|
| 77 |
Mage::dispatchEvent('taxjar_salestax_import_data');
|
| 78 |
Mage::dispatchEvent('taxjar_salestax_import_rates');
|
| 79 |
} catch (Exception $e) {
|
app/code/community/Taxjar/SalesTax/etc/config.xml
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<Taxjar_SalesTax>
|
| 22 |
-
<version>2.3.
|
| 23 |
</Taxjar_SalesTax>
|
| 24 |
</modules>
|
| 25 |
<global>
|
|
@@ -89,6 +89,15 @@
|
|
| 89 |
</taxjar>
|
| 90 |
</observers>
|
| 91 |
</controller_action_predispatch_adminhtml_system_config_edit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
<taxjar_salestax_import_data>
|
| 93 |
<observers>
|
| 94 |
<taxjar>
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<Taxjar_SalesTax>
|
| 22 |
+
<version>2.3.1</version>
|
| 23 |
</Taxjar_SalesTax>
|
| 24 |
</modules>
|
| 25 |
<global>
|
| 89 |
</taxjar>
|
| 90 |
</observers>
|
| 91 |
</controller_action_predispatch_adminhtml_system_config_edit>
|
| 92 |
+
<taxjar_salestax_import_categories>
|
| 93 |
+
<observers>
|
| 94 |
+
<taxjar>
|
| 95 |
+
<type>singleton</type>
|
| 96 |
+
<class>taxjar/observer_importCategories</class>
|
| 97 |
+
<method>execute</method>
|
| 98 |
+
</taxjar>
|
| 99 |
+
</observers>
|
| 100 |
+
</taxjar_salestax_import_categories>
|
| 101 |
<taxjar_salestax_import_data>
|
| 102 |
<observers>
|
| 103 |
<taxjar>
|
app/code/community/Taxjar/SalesTax/etc/wsdl.xml
CHANGED
|
@@ -1,4 +1,21 @@
|
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
<definitions
|
| 3 |
xmlns:typens="urn:{{var wsdl.name}}"
|
| 4 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Taxjar_SalesTax
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Taxjar
|
| 14 |
+
* @package Taxjar_SalesTax
|
| 15 |
+
* @copyright Copyright (c) 2016 TaxJar. TaxJar is a trademark of TPS Unlimited, Inc. (http://www.taxjar.com)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
<definitions
|
| 20 |
xmlns:typens="urn:{{var wsdl.name}}"
|
| 21 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
package.xml
CHANGED
|
@@ -1,19 +1,22 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Taxjar_Salestaxautomation</name>
|
| 4 |
-
<version>2.3.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Easily collect sales tax without altering your Magento store’s checkout experience or performance.</summary>
|
| 10 |
<description>TaxJar for Magento allows you to quickly calculate sales tax at checkout using our SmartCalcs API and zip-based rates as a backup.</description>
|
| 11 |
-
<notes>*
|
| 12 |
-
*
|
|
|
|
|
|
|
|
|
|
| 13 |
<authors><author><name>TaxJar</name><user>taxjar</user><email>support@taxjar.com</email></author></authors>
|
| 14 |
-
<date>2016-08-
|
| 15 |
-
<time>01:
|
| 16 |
-
<contents><target name="magecommunity"><dir name="Taxjar"><dir name="SalesTax"><dir name="Block"><dir name="Adminhtml"><file name="Backup.php" hash="97933cb0f04c30baab4af5af24412f8d"/><file name="Enabled.php" hash="29462c876c8ea67c21a6f4d799b53925"/><file name="Multiselect.php" hash="a1a7ea16e85cbc27b3014a2cc7d24c95"/><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="7110b37205cd416452dc388833565c07"/></dir><dir name="Grid"><dir name="Renderer"><file name="Exempt.php" hash="d6b842595707f4afaab0af0b0926c42d"/></dir></dir><file name="Grid.php" hash="d56ad1212a8cd141fdfc59a7160ba57c"/></dir><dir name="Nexus"><dir name="Edit"><file name="Form.php" hash="7f192c00ce3630910e40a120f90d3fa6"/></dir><file name="Edit.php" hash="e8bffbb5bc4ff17c368543c2508c00a5"/><file name="Grid.php" hash="ccb748472a7a20ae0f5f0e3df58d5edf"/></dir><file name="Nexus.php" hash="65d93fb5dbfa747b2d59a5f521863fc6"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d19f2af9ff020d2e0d31369cf43eac50"/></dir><dir name="Model"><file name="Calculation.php" hash="89c05ee42f8316563ea610f11b53a26d"/><file name="Categories.php" hash="934947240f1a1c7ae7b9ba323aacabd6"/><file name="Client.php" hash="1bda5172a54d2f7c7ef290a9d71a8f37"/><file name="Comment.php" hash="
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Taxjar_Salestaxautomation</name>
|
| 4 |
+
<version>2.3.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Easily collect sales tax without altering your Magento store’s checkout experience or performance.</summary>
|
| 10 |
<description>TaxJar for Magento allows you to quickly calculate sales tax at checkout using our SmartCalcs API and zip-based rates as a backup.</description>
|
| 11 |
+
<notes>* Add manage account and sales tax report buttons to configuration.
|
| 12 |
+
* Create reporting API user and role immediately after connecting to TaxJar.
|
| 13 |
+
* Import TaxJar product categories immediately after connecting to TaxJar.
|
| 14 |
+
* Fix multi-store connection issue with SID param.
|
| 15 |
+
* Fix non-SSL store connection issue.</notes>
|
| 16 |
<authors><author><name>TaxJar</name><user>taxjar</user><email>support@taxjar.com</email></author></authors>
|
| 17 |
+
<date>2016-08-30</date>
|
| 18 |
+
<time>01:26:22</time>
|
| 19 |
+
<contents><target name="magecommunity"><dir name="Taxjar"><dir name="SalesTax"><dir name="Block"><dir name="Adminhtml"><file name="Backup.php" hash="97933cb0f04c30baab4af5af24412f8d"/><file name="Enabled.php" hash="29462c876c8ea67c21a6f4d799b53925"/><file name="Multiselect.php" hash="a1a7ea16e85cbc27b3014a2cc7d24c95"/><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="7110b37205cd416452dc388833565c07"/></dir><dir name="Grid"><dir name="Renderer"><file name="Exempt.php" hash="d6b842595707f4afaab0af0b0926c42d"/></dir></dir><file name="Grid.php" hash="d56ad1212a8cd141fdfc59a7160ba57c"/></dir><dir name="Nexus"><dir name="Edit"><file name="Form.php" hash="7f192c00ce3630910e40a120f90d3fa6"/></dir><file name="Edit.php" hash="e8bffbb5bc4ff17c368543c2508c00a5"/><file name="Grid.php" hash="ccb748472a7a20ae0f5f0e3df58d5edf"/></dir><file name="Nexus.php" hash="65d93fb5dbfa747b2d59a5f521863fc6"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d19f2af9ff020d2e0d31369cf43eac50"/></dir><dir name="Model"><file name="Calculation.php" hash="89c05ee42f8316563ea610f11b53a26d"/><file name="Categories.php" hash="934947240f1a1c7ae7b9ba323aacabd6"/><file name="Client.php" hash="1bda5172a54d2f7c7ef290a9d71a8f37"/><file name="Comment.php" hash="cf9d341605747d7ede82e6f6201e28bb"/><file name="Configuration.php" hash="c59b69931392eb896e4d0c46b7d2e38b"/><file name="Debug.php" hash="d20aacc4d2392de6e95b1c4f9f84232c"/><dir name="Import"><file name="Comment.php" hash="958de1f883a6f67f1fa1c26d5d67e3ec"/><file name="Rate.php" hash="00ad69812c8d2f31915cac959483c1eb"/><file name="Rule.php" hash="597ff0e337b4e04e43660b4d4f05d0e0"/></dir><dir name="Observer"><file name="AdminMenuItems.php" hash="d6148f69a20b67e1662fd6afeaec1b66"/><file name="AdminNotifications.php" hash="f6279c889aaf4a47d768ff8974d69781"/><file name="ConfigChanged.php" hash="4f913dd9e58ac3cb965a7c6eca63a9fb"/><file name="ConfigReview.php" hash="a5052e9a0d4e054ac365a36331d5eeb2"/><file name="ImportCategories.php" hash="125bb6f5d746328a3a6b0805d7a19d5e"/><file name="ImportData.php" hash="0ccff9786f2113b70e3703119a05c456"/><file name="ImportRates.php" hash="95cbcd73ed1914bdfc3459631308d35d"/><file name="SalesQuoteCollectTotalsBefore.php" hash="37c28ddaf8a27d548bf463fff1aa7da1"/></dir><dir name="Resource"><dir name="Tax"><dir name="Nexus"><file name="Collection.php" hash="75cae3600991518db909a08d5031ff6a"/></dir><file name="Nexus.php" hash="b43e437c89ed549c9ec20af2841dfb1b"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Api"><file name="V2.php" hash="c4fd62b6ad421f300840978732bbd706"/></dir></dir><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="385d9e5622f30297f83c025c02cca2ac"/></dir></dir></dir><file name="Smartcalcs.php" hash="e09e082df69d7cc288d4eb9bf5f6c4a9"/><dir name="Tax"><dir name="Class"><dir name="Source"><file name="Customer.php" hash="9f2941032dc80219f9def35de5c5afc8"/><file name="Product.php" hash="3e0d0826d3d43e8a7c63f2e2e44b810a"/></dir></dir><file name="Nexus.php" hash="df4d5c4247d3a590647a91a25dda338b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Tax"><file name="NexusController.php" hash="cc61d7e6dd1adc53996513d549c757bd"/></dir><file name="TaxjarController.php" hash="01dd27494dfadc7eac3b11f70415f55e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b88bc6bfb95dfbd8f5343ae0128dbe11"/><file name="config.xml" hash="01ec4bdf024d4dd64327d171353ae95d"/><file name="system.xml" hash="7307753f550f490112ded20317c1a07d"/><file name="wsdl.xml" hash="b3a0cf0eae38002a2f6e50bb684d9e04"/></dir><dir name="sql"><dir name="salestax_setup"><file name="install-1.6.0.php" hash="9d400004ec642113a8cc907fe5d33960"/><file name="upgrade-2.0.1-2.1.0.php" hash="f4571be5edfe2a7d6a54a0e239792907"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Taxjar_SalesTax.xml" hash="552596be5ec12440753bf69ed6005747"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="taxjar"><dir name="nexus"><file name="form.phtml" hash="e5b3ac4950aa351f9bd0876f3adcf136"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 20 |
<compatible/>
|
| 21 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 22 |
</package>
|
