Version Notes
Simplify sales and use tax calculation, compliance, and management in the cloud!
Download this release
Release Info
Developer | Ken Nunes |
Extension | SalesTax_Connector |
Version | 4.1.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.1 to 4.1.2
- app/code/community/Harapartners/ConnectorHub/Helper/Connector/Config.php +5 -1
- app/code/community/Harapartners/ConnectorHub/Helper/Connector/Core.php +14 -0
- app/code/community/Harapartners/ConnectorHub/Helper/Data.php +15 -0
- app/code/community/Harapartners/ConnectorHub/etc/adminhtml.xml +34 -0
- app/code/community/Harapartners/ConnectorHub/etc/config.xml +7 -4
- app/code/community/Harapartners/ConnectorHub/etc/system.xml +72 -0
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/All/Index.php +37 -37
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/All/Index/Grid.php +123 -123
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Failsafe/Index.php +31 -31
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Failsafe/Index/Grid.php +49 -49
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Rateverification/Index.php +31 -31
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Rateverification/Index/Grid.php +61 -61
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Notification.php +44 -44
- app/code/community/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Authentication.php +76 -76
- app/code/community/Harapartners/SpeedTax/Helper/Connector/Data.php +307 -299
- app/code/community/Harapartners/SpeedTax/Helper/Connector/Speedtax.php +184 -184
- app/code/community/Harapartners/SpeedTax/Helper/Data.php +49 -49
- app/code/community/Harapartners/SpeedTax/Helper/Failsafe.php +72 -72
- app/code/community/Harapartners/SpeedTax/Helper/Processor.php +240 -240
- app/code/community/Harapartners/SpeedTax/Model/Failsafe/Calculation.php +41 -41
- app/code/community/Harapartners/SpeedTax/Model/Failsafe/Calculation/Rate.php +38 -38
- app/code/community/Harapartners/SpeedTax/Model/Failsafe/Sales/Total/Quote/Tax.php +26 -26
- app/code/community/Harapartners/SpeedTax/Model/Observer.php +167 -167
- app/code/community/Harapartners/SpeedTax/Model/Resource/Failsafe/Calculation/Rate.php +46 -46
- app/code/community/Harapartners/SpeedTax/Model/Resource/Failsafe/Calculation/Rate/Collection.php +19 -19
- app/code/community/Harapartners/SpeedTax/Model/Rewrite/Tax/Sales/Total/Quote/Tax.php +69 -69
- app/code/community/Harapartners/SpeedTax/Model/Session.php +63 -63
- app/code/community/Harapartners/SpeedTax/Model/Source/Usregions.php +35 -35
- app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/InvoiceController.php +80 -80
- app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/NotificationController.php +32 -32
- app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/System/Config/AjaxController.php +62 -62
- app/code/community/Harapartners/SpeedTax/etc/adminhtml.xml +71 -71
- app/code/community/Harapartners/SpeedTax/etc/config.xml +169 -169
- app/code/community/Harapartners/SpeedTax/etc/system.xml +299 -299
- app/code/community/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.0.9-3.1.0.php +49 -49
- app/code/community/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.9.9-4.0.0.php +100 -100
- package.xml +4 -4
app/code/community/Harapartners/ConnectorHub/Helper/Connector/Config.php
CHANGED
@@ -15,7 +15,11 @@ class Harapartners_ConnectorHub_Helper_Connector_Config
|
|
15 |
|
16 |
public function getConnectorHubRootUrl()
|
17 |
{
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
}
|
15 |
|
16 |
public function getConnectorHubRootUrl()
|
17 |
{
|
18 |
+
$rootUrl = Mage::getStoreConfig('connectorhub/general/service_root_url');
|
19 |
+
if(!$rootUrl){
|
20 |
+
$rootUrl = "https://api.connectorsuite.com/";
|
21 |
+
}
|
22 |
+
return $rootUrl;
|
23 |
}
|
24 |
|
25 |
}
|
app/code/community/Harapartners/ConnectorHub/Helper/Connector/Core.php
CHANGED
@@ -37,6 +37,7 @@ abstract class Harapartners_ConnectorHub_Helper_Connector_Core {
|
|
37 |
curl_setopt($requestCh, CURLOPT_URL, $requestUrl);
|
38 |
curl_setopt($requestCh, CURLOPT_POST, 1);
|
39 |
curl_setopt($requestCh, CURLOPT_POSTFIELDS, $requestPostData);
|
|
|
40 |
curl_setopt($requestCh, CURLOPT_SSL_VERIFYPEER, $this->_getCurlSslVerifyPeer());
|
41 |
curl_setopt($requestCh, CURLOPT_RETURNTRANSFER, 1);
|
42 |
curl_setopt($requestCh, CURLOPT_TIMEOUT, self::DEFAULT_CURLOPT_TIMEOUT);
|
@@ -224,7 +225,20 @@ abstract class Harapartners_ConnectorHub_Helper_Connector_Core {
|
|
224 |
return json_decode($decData);
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
protected function _getCurlSslVerifyPeer(){
|
|
|
|
|
|
|
|
|
|
|
228 |
$sslVerifyPeer = 0;
|
229 |
try{
|
230 |
$secureUrlScheme = parse_url(Mage::getUrl('', array('_secure'=>true)), PHP_URL_SCHEME);
|
37 |
curl_setopt($requestCh, CURLOPT_URL, $requestUrl);
|
38 |
curl_setopt($requestCh, CURLOPT_POST, 1);
|
39 |
curl_setopt($requestCh, CURLOPT_POSTFIELDS, $requestPostData);
|
40 |
+
curl_setopt($requestCh, CURLOPT_SSL_VERIFYHOST, $this->_getCurlSslVerifyHost());
|
41 |
curl_setopt($requestCh, CURLOPT_SSL_VERIFYPEER, $this->_getCurlSslVerifyPeer());
|
42 |
curl_setopt($requestCh, CURLOPT_RETURNTRANSFER, 1);
|
43 |
curl_setopt($requestCh, CURLOPT_TIMEOUT, self::DEFAULT_CURLOPT_TIMEOUT);
|
225 |
return json_decode($decData);
|
226 |
}
|
227 |
|
228 |
+
protected function _getCurlSslVerifyHost(){
|
229 |
+
// Global override
|
230 |
+
if(!!Mage::getStoreConfig('connectorhub/general/disable_verify_host')){
|
231 |
+
return 0;
|
232 |
+
}
|
233 |
+
return 2;
|
234 |
+
}
|
235 |
+
|
236 |
protected function _getCurlSslVerifyPeer(){
|
237 |
+
// Global override
|
238 |
+
if(!!Mage::getStoreConfig('connectorhub/general/disable_verify_peer')){
|
239 |
+
return 0;
|
240 |
+
}
|
241 |
+
|
242 |
$sslVerifyPeer = 0;
|
243 |
try{
|
244 |
$secureUrlScheme = parse_url(Mage::getUrl('', array('_secure'=>true)), PHP_URL_SCHEME);
|
app/code/community/Harapartners/ConnectorHub/Helper/Data.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_ConnectorHub_Helper_Data extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
}
|
app/code/community/Harapartners/ConnectorHub/etc/adminhtml.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*
|
13 |
+
-->
|
14 |
+
<config>
|
15 |
+
<acl>
|
16 |
+
<resources>
|
17 |
+
<admin>
|
18 |
+
<children>
|
19 |
+
<system>
|
20 |
+
<children>
|
21 |
+
<config>
|
22 |
+
<children>
|
23 |
+
<connectorhub translate="title" module="connectorhub">
|
24 |
+
<title>Connector Hub API</title>
|
25 |
+
</connectorhub>
|
26 |
+
</children>
|
27 |
+
</config>
|
28 |
+
</children>
|
29 |
+
</system>
|
30 |
+
</children>
|
31 |
+
</admin>
|
32 |
+
</resources>
|
33 |
+
</acl>
|
34 |
+
</config>
|
app/code/community/Harapartners/ConnectorHub/etc/config.xml
CHANGED
@@ -58,12 +58,15 @@
|
|
58 |
</adminhtml>
|
59 |
<default>
|
60 |
<connectorhub>
|
61 |
-
<
|
62 |
-
<
|
63 |
-
|
|
|
|
|
|
|
64 |
</connectorhub>
|
65 |
<paypal>
|
66 |
-
<!-- /* Compatibility for Staging server SSL verification */ -->
|
67 |
<wpp>
|
68 |
<button_source_ec>Hara_SI_MagentoCE_PPA</button_source_ec>
|
69 |
<button_source_dp>Hara_SI_MagentoCE_PPA</button_source_dp>
|
58 |
</adminhtml>
|
59 |
<default>
|
60 |
<connectorhub>
|
61 |
+
<general>
|
62 |
+
<service_root_url>https://api.connectorsuite.com/</service_root_url>
|
63 |
+
<!-- /* Compatibility for Staging/Dev server SSL verification */ -->
|
64 |
+
<disable_verify_host>0</disable_verify_host>
|
65 |
+
<disable_verify_peer>0</disable_verify_peer>
|
66 |
+
</general>
|
67 |
</connectorhub>
|
68 |
<paypal>
|
69 |
+
<!-- /* Compatibility for Staging/Dev server SSL verification */ -->
|
70 |
<wpp>
|
71 |
<button_source_ec>Hara_SI_MagentoCE_PPA</button_source_ec>
|
72 |
<button_source_dp>Hara_SI_MagentoCE_PPA</button_source_dp>
|
app/code/community/Harapartners/ConnectorHub/etc/system.xml
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
-->
|
13 |
+
<config>
|
14 |
+
<sections>
|
15 |
+
<connectorhub translate="label" module="connectorhub">
|
16 |
+
<label>Connector Hub API</label>
|
17 |
+
<tab>service</tab>
|
18 |
+
<frontend_type>text</frontend_type>
|
19 |
+
<sort_order>1000</sort_order>
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>0</show_in_website>
|
22 |
+
<show_in_store>0</show_in_store>
|
23 |
+
<groups>
|
24 |
+
<general translate="label">
|
25 |
+
<label>General Settings</label>
|
26 |
+
<sort_order>100</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>0</show_in_website>
|
29 |
+
<show_in_store>0</show_in_store>
|
30 |
+
<fields>
|
31 |
+
<service_root_url translate="label">
|
32 |
+
<label>Web Service Root URL</label>
|
33 |
+
<frontend_type>label</frontend_type>
|
34 |
+
<sort_order>100</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>0</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</service_root_url>
|
39 |
+
<disable_verify_host translate="label">
|
40 |
+
<label>Disable Verify Host</label>
|
41 |
+
<comment><![CDATA[
|
42 |
+
If "Yes", secure cURL connections will not verify host.<br/>
|
43 |
+
By default, verify host should not be disabled.<br/>
|
44 |
+
Use this flag in test/development environments; or if the server is in a shared environment and has problems resolving host name for SSL.
|
45 |
+
]]></comment>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
48 |
+
<sort_order>110</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>0</show_in_website>
|
51 |
+
<show_in_store>0</show_in_store>
|
52 |
+
</disable_verify_host>
|
53 |
+
<disable_verify_peer translate="label">
|
54 |
+
<label>Disable Verify Peer</label>
|
55 |
+
<comment><![CDATA[
|
56 |
+
If "Yes", secure cURL connections will not verify peer.<br/>
|
57 |
+
By default, verify peer should not be disabled.<br/>
|
58 |
+
Use this flag in test/development environments.
|
59 |
+
]]></comment>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>120</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>0</show_in_website>
|
65 |
+
<show_in_store>0</show_in_store>
|
66 |
+
</disable_verify_peer>
|
67 |
+
</fields>
|
68 |
+
</general>
|
69 |
+
</groups>
|
70 |
+
</connectorhub>
|
71 |
+
</sections>
|
72 |
+
</config>
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/All/Index.php
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
parent::__construct ();
|
17 |
-
$this->_blockGroup = 'speedtax';
|
18 |
-
$this->_controller = 'adminhtml_invoice_all_index';
|
19 |
-
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'SalesTax Invoices' );
|
20 |
-
$this->_removeButton('add');
|
21 |
-
}
|
22 |
-
|
23 |
-
public function getGridHtml() {
|
24 |
-
return $this->getHeaderInfoHtml() . parent::getGridHtml();
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getHeaderInfoHtml(){
|
28 |
-
$headerInfoHtml = <<< INFO_HTML
|
29 |
-
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
30 |
-
<p>By default Magento invoices will be posted to SalesTax when paid; and most orders should be in the <b>Posted</b> status.</p>
|
31 |
-
<p>The <b>Failsafe</b> status is for invoices that are paid but cannot be posted to SalesTax. These invoices can be processed in batch by either 1) system cronjobs or 2) the <b><i>Post To SalesTax</i></b> action.</p>
|
32 |
-
<p>The <b>Pending</b> status is for invoices that are paid, and by default not to be posted to SalesTax. These invoices are probably from historical orders before the SalesTax integration.</p>
|
33 |
-
</div>
|
34 |
-
INFO_HTML;
|
35 |
-
return $headerInfoHtml;
|
36 |
-
}
|
37 |
-
|
38 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
parent::__construct ();
|
17 |
+
$this->_blockGroup = 'speedtax';
|
18 |
+
$this->_controller = 'adminhtml_invoice_all_index';
|
19 |
+
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'SalesTax Invoices' );
|
20 |
+
$this->_removeButton('add');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getGridHtml() {
|
24 |
+
return $this->getHeaderInfoHtml() . parent::getGridHtml();
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getHeaderInfoHtml(){
|
28 |
+
$headerInfoHtml = <<< INFO_HTML
|
29 |
+
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
30 |
+
<p>By default Magento invoices will be posted to SalesTax when paid; and most orders should be in the <b>Posted</b> status.</p>
|
31 |
+
<p>The <b>Failsafe</b> status is for invoices that are paid but cannot be posted to SalesTax. These invoices can be processed in batch by either 1) system cronjobs or 2) the <b><i>Post To SalesTax</i></b> action.</p>
|
32 |
+
<p>The <b>Pending</b> status is for invoices that are paid, and by default not to be posted to SalesTax. These invoices are probably from historical orders before the SalesTax integration.</p>
|
33 |
+
</div>
|
34 |
+
INFO_HTML;
|
35 |
+
return $headerInfoHtml;
|
36 |
+
}
|
37 |
+
|
38 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/All/Index/Grid.php
CHANGED
@@ -1,124 +1,124 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
14 |
-
|
15 |
-
public function __construct(){
|
16 |
-
parent::__construct();
|
17 |
-
$this->setId('speedtaxInvoiceAllGrid');
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _prepareCollection(){
|
21 |
-
$collection = Mage::getModel('sales/order_invoice')->getCollection();
|
22 |
-
$this->setCollection($collection);
|
23 |
-
$this->setDefaultSort('created_at');
|
24 |
-
$this->setDefaultDir('desc');
|
25 |
-
return parent::_prepareCollection();
|
26 |
-
}
|
27 |
-
|
28 |
-
protected function _prepareColumns()
|
29 |
-
{
|
30 |
-
$this->addColumn('increment_id', array(
|
31 |
-
'header' => Mage::helper('speedtax')->__('Magento Invoice #'),
|
32 |
-
'index' => 'increment_id',
|
33 |
-
'type' => 'text',
|
34 |
-
'align' => 'right',
|
35 |
-
));
|
36 |
-
|
37 |
-
$this->addColumn('action',
|
38 |
-
array(
|
39 |
-
'header' => Mage::helper('sales')->__('Invoice Details'),
|
40 |
-
'width' => '100px',
|
41 |
-
'type' => 'action',
|
42 |
-
'align' => 'right',
|
43 |
-
'getter' => 'getId',
|
44 |
-
'actions' => array(
|
45 |
-
array(
|
46 |
-
'caption' => Mage::helper('sales')->__('View'),
|
47 |
-
'url' => array('base'=>'adminhtml/sales_invoice/view'),
|
48 |
-
'field' => 'invoice_id'
|
49 |
-
)
|
50 |
-
),
|
51 |
-
'filter' => false,
|
52 |
-
'sortable' => false,
|
53 |
-
'is_system' => true
|
54 |
-
));
|
55 |
-
|
56 |
-
$this->addColumn('created_at', array(
|
57 |
-
'header' => Mage::helper('speedtax')->__('Magento Invoice Date'),
|
58 |
-
'index' => 'created_at',
|
59 |
-
'type' => 'datetime',
|
60 |
-
'align' => 'right',
|
61 |
-
));
|
62 |
-
|
63 |
-
$this->addColumn('speedtax_invoice_number', array(
|
64 |
-
'header' => Mage::helper('speedtax')->__('SalesTax Invoice #'),
|
65 |
-
'index' => 'speedtax_invoice_number',
|
66 |
-
'type' => 'text',
|
67 |
-
'align' => 'right',
|
68 |
-
));
|
69 |
-
|
70 |
-
$this->addColumn('speedtax_transaction_id', array(
|
71 |
-
'header' => Mage::helper('speedtax')->__('SalesTax Transaction ID'),
|
72 |
-
'index' => 'speedtax_transaction_id',
|
73 |
-
'type' => 'text',
|
74 |
-
'align' => 'right',
|
75 |
-
));
|
76 |
-
|
77 |
-
$this->addColumn('tax_amount', array(
|
78 |
-
'header' => Mage::helper('speedtax')->__('Magento Tax Amount'),
|
79 |
-
'index' => 'tax_amount',
|
80 |
-
'type' => 'currency',
|
81 |
-
'align' => 'right',
|
82 |
-
'currency' => 'order_currency_code',
|
83 |
-
));
|
84 |
-
|
85 |
-
$this->addColumn('speedtax_tax_amount', array(
|
86 |
-
'header' => Mage::helper('speedtax')->__('SalesTax Tax Amount'),
|
87 |
-
'index' => 'speedtax_tax_amount',
|
88 |
-
'type' => 'currency',
|
89 |
-
'align' => 'right',
|
90 |
-
'currency' => 'order_currency_code',
|
91 |
-
));
|
92 |
-
|
93 |
-
$this->addColumn('speedtax_invoice_status', array(
|
94 |
-
'header' => Mage::helper('speedtax')->__('SalesTax Invoice Status'),
|
95 |
-
'width' => '100px',
|
96 |
-
'index' => 'speedtax_invoice_status',
|
97 |
-
'type' => 'options',
|
98 |
-
'align' => 'right',
|
99 |
-
'options' => Mage::helper('speedtax')->getSpeedtaxInvoiceStatusValues(),
|
100 |
-
));
|
101 |
-
|
102 |
-
return parent::_prepareColumns();
|
103 |
-
}
|
104 |
-
|
105 |
-
protected function _prepareMassaction()
|
106 |
-
{
|
107 |
-
$this->setMassactionIdField('entity_id');
|
108 |
-
$this->getMassactionBlock()->setFormFieldName('invoice_ids');
|
109 |
-
$this->getMassactionBlock()->setUseSelectAll(false);
|
110 |
-
|
111 |
-
$this->getMassactionBlock()->addItem('post_selected', array(
|
112 |
-
'label' => Mage::helper('sales')->__('Post To SalesTax'),
|
113 |
-
'url' => $this->getUrl('*/*/massPostToSpeedtax'),
|
114 |
-
));
|
115 |
-
|
116 |
-
return $this;
|
117 |
-
}
|
118 |
-
|
119 |
-
//No row editing
|
120 |
-
public function getRowUrl($row){
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
|
124 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
14 |
+
|
15 |
+
public function __construct(){
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('speedtaxInvoiceAllGrid');
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareCollection(){
|
21 |
+
$collection = Mage::getModel('sales/order_invoice')->getCollection();
|
22 |
+
$this->setCollection($collection);
|
23 |
+
$this->setDefaultSort('created_at');
|
24 |
+
$this->setDefaultDir('desc');
|
25 |
+
return parent::_prepareCollection();
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareColumns()
|
29 |
+
{
|
30 |
+
$this->addColumn('increment_id', array(
|
31 |
+
'header' => Mage::helper('speedtax')->__('Magento Invoice #'),
|
32 |
+
'index' => 'increment_id',
|
33 |
+
'type' => 'text',
|
34 |
+
'align' => 'right',
|
35 |
+
));
|
36 |
+
|
37 |
+
$this->addColumn('action',
|
38 |
+
array(
|
39 |
+
'header' => Mage::helper('sales')->__('Invoice Details'),
|
40 |
+
'width' => '100px',
|
41 |
+
'type' => 'action',
|
42 |
+
'align' => 'right',
|
43 |
+
'getter' => 'getId',
|
44 |
+
'actions' => array(
|
45 |
+
array(
|
46 |
+
'caption' => Mage::helper('sales')->__('View'),
|
47 |
+
'url' => array('base'=>'adminhtml/sales_invoice/view'),
|
48 |
+
'field' => 'invoice_id'
|
49 |
+
)
|
50 |
+
),
|
51 |
+
'filter' => false,
|
52 |
+
'sortable' => false,
|
53 |
+
'is_system' => true
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('created_at', array(
|
57 |
+
'header' => Mage::helper('speedtax')->__('Magento Invoice Date'),
|
58 |
+
'index' => 'created_at',
|
59 |
+
'type' => 'datetime',
|
60 |
+
'align' => 'right',
|
61 |
+
));
|
62 |
+
|
63 |
+
$this->addColumn('speedtax_invoice_number', array(
|
64 |
+
'header' => Mage::helper('speedtax')->__('SalesTax Invoice #'),
|
65 |
+
'index' => 'speedtax_invoice_number',
|
66 |
+
'type' => 'text',
|
67 |
+
'align' => 'right',
|
68 |
+
));
|
69 |
+
|
70 |
+
$this->addColumn('speedtax_transaction_id', array(
|
71 |
+
'header' => Mage::helper('speedtax')->__('SalesTax Transaction ID'),
|
72 |
+
'index' => 'speedtax_transaction_id',
|
73 |
+
'type' => 'text',
|
74 |
+
'align' => 'right',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('tax_amount', array(
|
78 |
+
'header' => Mage::helper('speedtax')->__('Magento Tax Amount'),
|
79 |
+
'index' => 'tax_amount',
|
80 |
+
'type' => 'currency',
|
81 |
+
'align' => 'right',
|
82 |
+
'currency' => 'order_currency_code',
|
83 |
+
));
|
84 |
+
|
85 |
+
$this->addColumn('speedtax_tax_amount', array(
|
86 |
+
'header' => Mage::helper('speedtax')->__('SalesTax Tax Amount'),
|
87 |
+
'index' => 'speedtax_tax_amount',
|
88 |
+
'type' => 'currency',
|
89 |
+
'align' => 'right',
|
90 |
+
'currency' => 'order_currency_code',
|
91 |
+
));
|
92 |
+
|
93 |
+
$this->addColumn('speedtax_invoice_status', array(
|
94 |
+
'header' => Mage::helper('speedtax')->__('SalesTax Invoice Status'),
|
95 |
+
'width' => '100px',
|
96 |
+
'index' => 'speedtax_invoice_status',
|
97 |
+
'type' => 'options',
|
98 |
+
'align' => 'right',
|
99 |
+
'options' => Mage::helper('speedtax')->getSpeedtaxInvoiceStatusValues(),
|
100 |
+
));
|
101 |
+
|
102 |
+
return parent::_prepareColumns();
|
103 |
+
}
|
104 |
+
|
105 |
+
protected function _prepareMassaction()
|
106 |
+
{
|
107 |
+
$this->setMassactionIdField('entity_id');
|
108 |
+
$this->getMassactionBlock()->setFormFieldName('invoice_ids');
|
109 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
110 |
+
|
111 |
+
$this->getMassactionBlock()->addItem('post_selected', array(
|
112 |
+
'label' => Mage::helper('sales')->__('Post To SalesTax'),
|
113 |
+
'url' => $this->getUrl('*/*/massPostToSpeedtax'),
|
114 |
+
));
|
115 |
+
|
116 |
+
return $this;
|
117 |
+
}
|
118 |
+
|
119 |
+
//No row editing
|
120 |
+
public function getRowUrl($row){
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Failsafe/Index.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Failsafe_Index extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index {
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
parent::__construct ();
|
17 |
-
$this->_blockGroup = 'speedtax';
|
18 |
-
$this->_controller = 'adminhtml_invoice_failsafe_index';
|
19 |
-
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'Failsafe Invoices' );
|
20 |
-
$this->_removeButton('add');
|
21 |
-
}
|
22 |
-
|
23 |
-
public function getHeaderInfoHtml(){
|
24 |
-
$headerInfoHtml = <<< INFO_HTML
|
25 |
-
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
26 |
-
<p>Failsafe invoices are paid Magento invoices that are not yet posted to SalesTax. These invoices can be processed in batch either 1) by system cronjobs automatically or 2) by running <b><i>Post To SalesTax</i></b> via the "Actions" dropdown menu next to the "Submit" button.</p>
|
27 |
-
</div>
|
28 |
-
INFO_HTML;
|
29 |
-
return $headerInfoHtml;
|
30 |
-
}
|
31 |
-
|
32 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Failsafe_Index extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index {
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
parent::__construct ();
|
17 |
+
$this->_blockGroup = 'speedtax';
|
18 |
+
$this->_controller = 'adminhtml_invoice_failsafe_index';
|
19 |
+
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'Failsafe Invoices' );
|
20 |
+
$this->_removeButton('add');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getHeaderInfoHtml(){
|
24 |
+
$headerInfoHtml = <<< INFO_HTML
|
25 |
+
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
26 |
+
<p>Failsafe invoices are paid Magento invoices that are not yet posted to SalesTax. These invoices can be processed in batch either 1) by system cronjobs automatically or 2) by running <b><i>Post To SalesTax</i></b> via the "Actions" dropdown menu next to the "Submit" button.</p>
|
27 |
+
</div>
|
28 |
+
INFO_HTML;
|
29 |
+
return $headerInfoHtml;
|
30 |
+
}
|
31 |
+
|
32 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Failsafe/Index/Grid.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Failsafe_Index_Grid extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid {
|
14 |
-
|
15 |
-
public function __construct(){
|
16 |
-
parent::__construct();
|
17 |
-
$this->setId('speedtaxInvoiceFailsafeGrid');
|
18 |
-
}
|
19 |
-
|
20 |
-
public function setCollection($collection){
|
21 |
-
$collection->addAttributeToFilter('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
22 |
-
return parent::setCollection($collection);
|
23 |
-
}
|
24 |
-
|
25 |
-
protected function _prepareColumns(){
|
26 |
-
parent::_prepareColumns();
|
27 |
-
$this->removeColumn('speedtax_invoice_status');
|
28 |
-
return $this;
|
29 |
-
}
|
30 |
-
|
31 |
-
protected function _prepareMassaction()
|
32 |
-
{
|
33 |
-
$this->setMassactionIdField('entity_id');
|
34 |
-
$this->getMassactionBlock()->setFormFieldName('invoice_ids');
|
35 |
-
$this->getMassactionBlock()->setUseSelectAll(false);
|
36 |
-
|
37 |
-
$this->getMassactionBlock()->addItem('post_selected', array(
|
38 |
-
'label' => Mage::helper('sales')->__('Post To SalesTax'),
|
39 |
-
'url' => $this->getUrl('*/*/massPostToSpeedtax'),
|
40 |
-
));
|
41 |
-
|
42 |
-
return $this;
|
43 |
-
}
|
44 |
-
|
45 |
-
//No row editing
|
46 |
-
public function getRowUrl($row){
|
47 |
-
return false;
|
48 |
-
}
|
49 |
-
|
50 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Failsafe_Index_Grid extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid {
|
14 |
+
|
15 |
+
public function __construct(){
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('speedtaxInvoiceFailsafeGrid');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function setCollection($collection){
|
21 |
+
$collection->addAttributeToFilter('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
22 |
+
return parent::setCollection($collection);
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareColumns(){
|
26 |
+
parent::_prepareColumns();
|
27 |
+
$this->removeColumn('speedtax_invoice_status');
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareMassaction()
|
32 |
+
{
|
33 |
+
$this->setMassactionIdField('entity_id');
|
34 |
+
$this->getMassactionBlock()->setFormFieldName('invoice_ids');
|
35 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
36 |
+
|
37 |
+
$this->getMassactionBlock()->addItem('post_selected', array(
|
38 |
+
'label' => Mage::helper('sales')->__('Post To SalesTax'),
|
39 |
+
'url' => $this->getUrl('*/*/massPostToSpeedtax'),
|
40 |
+
));
|
41 |
+
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
//No row editing
|
46 |
+
public function getRowUrl($row){
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Rateverification/Index.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Rateverification_Index extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index {
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
parent::__construct ();
|
17 |
-
$this->_blockGroup = 'speedtax';
|
18 |
-
$this->_controller = 'adminhtml_invoice_rateverification_index';
|
19 |
-
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'Verify Invoices with Failsafe Tax Rates' );
|
20 |
-
$this->_removeButton('add');
|
21 |
-
}
|
22 |
-
|
23 |
-
public function getHeaderInfoHtml(){
|
24 |
-
$headerInfoHtml = <<< INFO_HTML
|
25 |
-
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
26 |
-
<p>Invoices in this panel are paid using failsafe rate. For some invoices failsafe rate may be different from the SalesTax rate. In such cases, please reconciliate the difference in SalesTax management panel if necessary.</p>
|
27 |
-
</div>
|
28 |
-
INFO_HTML;
|
29 |
-
return $headerInfoHtml;
|
30 |
-
}
|
31 |
-
|
32 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Rateverification_Index extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index {
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
parent::__construct ();
|
17 |
+
$this->_blockGroup = 'speedtax';
|
18 |
+
$this->_controller = 'adminhtml_invoice_rateverification_index';
|
19 |
+
$this->_headerText = Mage::helper ( 'speedtax' )->__ ( 'Verify Invoices with Failsafe Tax Rates' );
|
20 |
+
$this->_removeButton('add');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getHeaderInfoHtml(){
|
24 |
+
$headerInfoHtml = <<< INFO_HTML
|
25 |
+
<div class="grid-top-info" style="background: none repeat scroll 0 0 #E7EFEF; border: 1px solid #CDDDDD; padding: 10px 20px 10px 20px; margin-bottom: 20px;">
|
26 |
+
<p>Invoices in this panel are paid using failsafe rate. For some invoices failsafe rate may be different from the SalesTax rate. In such cases, please reconciliate the difference in SalesTax management panel if necessary.</p>
|
27 |
+
</div>
|
28 |
+
INFO_HTML;
|
29 |
+
return $headerInfoHtml;
|
30 |
+
}
|
31 |
+
|
32 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Invoice/Rateverification/Index/Grid.php
CHANGED
@@ -1,62 +1,62 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Rateverification_Index_Grid extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid {
|
14 |
-
|
15 |
-
public function __construct(){
|
16 |
-
parent::__construct();
|
17 |
-
$this->setId('speedtaxInvoiceRateVerificationGrid');
|
18 |
-
}
|
19 |
-
|
20 |
-
public function setCollection($collection){
|
21 |
-
$collection->addAttributeToFilter('is_speedtax_failsafe_calculation', 1);
|
22 |
-
$collection->getSelect()->columns(array(
|
23 |
-
'tax_amount_difference' => new Zend_Db_Expr("IFNULL(`main_table`.`speedtax_tax_amount`, 0) - IFNULL(`main_table`.`tax_amount`, 0)"),
|
24 |
-
'has_tax_amount_difference' => new Zend_Db_Expr("IF(IFNULL(`main_table`.`speedtax_tax_amount`, 0) - IFNULL(`main_table`.`tax_amount`, 0) = 0, 0, 1)"),
|
25 |
-
));
|
26 |
-
|
27 |
-
//Re-wrap the collection to support generic form sort and filter
|
28 |
-
$outerCollection = Mage::getModel('sales/order_invoice')->getCollection();
|
29 |
-
$outerCollection->getSelect()->reset();
|
30 |
-
$outerCollection->getSelect()->from(array('main_table' => $collection->getSelect()));
|
31 |
-
return parent::setCollection($outerCollection);
|
32 |
-
}
|
33 |
-
|
34 |
-
protected function _prepareColumns(){
|
35 |
-
parent::_prepareColumns();
|
36 |
-
$this->addColumn('tax_amount_difference', array(
|
37 |
-
'header' => Mage::helper('speedtax')->__('Tax Difference (SalesTax - Magento)'),
|
38 |
-
'index' => 'tax_amount_difference',
|
39 |
-
'type' => 'currency',
|
40 |
-
'align' => 'right',
|
41 |
-
'currency' => 'order_currency_code',
|
42 |
-
));
|
43 |
-
$this->addColumn('has_tax_amount_difference', array(
|
44 |
-
'header' => Mage::helper('speedtax')->__('Has Tax Difference'),
|
45 |
-
'index' => 'has_tax_amount_difference',
|
46 |
-
'type' => 'options',
|
47 |
-
'align' => 'right',
|
48 |
-
'options' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toArray(),
|
49 |
-
));
|
50 |
-
return $this;
|
51 |
-
}
|
52 |
-
|
53 |
-
protected function _prepareMassaction(){
|
54 |
-
return $this;
|
55 |
-
}
|
56 |
-
|
57 |
-
//No row editing
|
58 |
-
public function getRowUrl($row){
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
|
62 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Invoice_Rateverification_Index_Grid extends Harapartners_SpeedTax_Block_Adminhtml_Invoice_All_Index_Grid {
|
14 |
+
|
15 |
+
public function __construct(){
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('speedtaxInvoiceRateVerificationGrid');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function setCollection($collection){
|
21 |
+
$collection->addAttributeToFilter('is_speedtax_failsafe_calculation', 1);
|
22 |
+
$collection->getSelect()->columns(array(
|
23 |
+
'tax_amount_difference' => new Zend_Db_Expr("IFNULL(`main_table`.`speedtax_tax_amount`, 0) - IFNULL(`main_table`.`tax_amount`, 0)"),
|
24 |
+
'has_tax_amount_difference' => new Zend_Db_Expr("IF(IFNULL(`main_table`.`speedtax_tax_amount`, 0) - IFNULL(`main_table`.`tax_amount`, 0) = 0, 0, 1)"),
|
25 |
+
));
|
26 |
+
|
27 |
+
//Re-wrap the collection to support generic form sort and filter
|
28 |
+
$outerCollection = Mage::getModel('sales/order_invoice')->getCollection();
|
29 |
+
$outerCollection->getSelect()->reset();
|
30 |
+
$outerCollection->getSelect()->from(array('main_table' => $collection->getSelect()));
|
31 |
+
return parent::setCollection($outerCollection);
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _prepareColumns(){
|
35 |
+
parent::_prepareColumns();
|
36 |
+
$this->addColumn('tax_amount_difference', array(
|
37 |
+
'header' => Mage::helper('speedtax')->__('Tax Difference (SalesTax - Magento)'),
|
38 |
+
'index' => 'tax_amount_difference',
|
39 |
+
'type' => 'currency',
|
40 |
+
'align' => 'right',
|
41 |
+
'currency' => 'order_currency_code',
|
42 |
+
));
|
43 |
+
$this->addColumn('has_tax_amount_difference', array(
|
44 |
+
'header' => Mage::helper('speedtax')->__('Has Tax Difference'),
|
45 |
+
'index' => 'has_tax_amount_difference',
|
46 |
+
'type' => 'options',
|
47 |
+
'align' => 'right',
|
48 |
+
'options' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toArray(),
|
49 |
+
));
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _prepareMassaction(){
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
//No row editing
|
58 |
+
public function getRowUrl($row){
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/Notification.php
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Harapartners_SpeedTax_Block_Adminhtml_Notification extends Mage_Adminhtml_Block_Template {
|
15 |
-
|
16 |
-
protected function _toHtml() {
|
17 |
-
$htmlContent = "";
|
18 |
-
$notificationDisabled = json_decode(Mage::getStoreConfig(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS), 1);
|
19 |
-
|
20 |
-
//TODO: add ACL restriction to screen some messages
|
21 |
-
$speedtaxMessages = array();
|
22 |
-
|
23 |
-
// ---------------- Tax on Discount ---------------- //
|
24 |
-
if(!Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT)
|
25 |
-
&& empty($notificationDisabled[Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT])
|
26 |
-
){
|
27 |
-
$speedtaxMessages[Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT] = '
|
28 |
-
Your tax configuration "Calculation Setting >> Apply Customer Tax" is set to <strong class="label">Before Discount</strong>, which is the default value.
|
29 |
-
If your business logic requires tax <strong class="label">After Discount</strong>, please click <a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit", array("section" => "tax")). '">HERE</a> to update the setting.
|
30 |
-
<i><a href="' . Mage::helper("adminhtml")->getUrl("speedtax_adminhtml/notification/disable", array("notification_key" => Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT)) . '">Dismiss this message</a></i>';
|
31 |
-
}
|
32 |
-
|
33 |
-
// ---------------- Output ---------------- //
|
34 |
-
foreach($speedtaxMessages as $messageKey => $messageContent){
|
35 |
-
$htmlContent .= <<< HTML_CONTENT
|
36 |
-
<div class="notification-global">
|
37 |
-
<strong class="label">SalesTax notification:</strong> $messageContent
|
38 |
-
</div>
|
39 |
-
HTML_CONTENT;
|
40 |
-
}
|
41 |
-
return $htmlContent;
|
42 |
-
}
|
43 |
-
|
44 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Harapartners_SpeedTax_Block_Adminhtml_Notification extends Mage_Adminhtml_Block_Template {
|
15 |
+
|
16 |
+
protected function _toHtml() {
|
17 |
+
$htmlContent = "";
|
18 |
+
$notificationDisabled = json_decode(Mage::getStoreConfig(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS), 1);
|
19 |
+
|
20 |
+
//TODO: add ACL restriction to screen some messages
|
21 |
+
$speedtaxMessages = array();
|
22 |
+
|
23 |
+
// ---------------- Tax on Discount ---------------- //
|
24 |
+
if(!Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT)
|
25 |
+
&& empty($notificationDisabled[Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT])
|
26 |
+
){
|
27 |
+
$speedtaxMessages[Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT] = '
|
28 |
+
Your tax configuration "Calculation Setting >> Apply Customer Tax" is set to <strong class="label">Before Discount</strong>, which is the default value.
|
29 |
+
If your business logic requires tax <strong class="label">After Discount</strong>, please click <a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit", array("section" => "tax")). '">HERE</a> to update the setting.
|
30 |
+
<i><a href="' . Mage::helper("adminhtml")->getUrl("speedtax_adminhtml/notification/disable", array("notification_key" => Harapartners_SpeedTax_Helper_Data::NOTIFICATION_KEY_TAX_ON_DISCOUNT)) . '">Dismiss this message</a></i>';
|
31 |
+
}
|
32 |
+
|
33 |
+
// ---------------- Output ---------------- //
|
34 |
+
foreach($speedtaxMessages as $messageKey => $messageContent){
|
35 |
+
$htmlContent .= <<< HTML_CONTENT
|
36 |
+
<div class="notification-global">
|
37 |
+
<strong class="label">SalesTax notification:</strong> $messageContent
|
38 |
+
</div>
|
39 |
+
HTML_CONTENT;
|
40 |
+
}
|
41 |
+
return $htmlContent;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Authentication.php
CHANGED
@@ -1,77 +1,77 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Harapartners_SpeedTax_Block_Adminhtml_System_Config_Form_Field_Authentication extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
15 |
-
|
16 |
-
protected function _toHtml() {
|
17 |
-
$htmlId = $this->getHtmlId();
|
18 |
-
$ajaxUrl = $this->getAjaxUrl();
|
19 |
-
$buttonLabel = $this->escapeHtml($this->getButtonLabel());
|
20 |
-
|
21 |
-
$htmlContent = <<< HTML_CONTENT
|
22 |
-
<script type="text/javascript">
|
23 |
-
function ajaxLogin() {
|
24 |
-
var elem = $('$htmlId');
|
25 |
-
|
26 |
-
params = {
|
27 |
-
username: $('speedtax_speedtax_username').value,
|
28 |
-
password: $('speedtax_speedtax_password').value,
|
29 |
-
company_code: $('speedtax_speedtax_company_code').value,
|
30 |
-
is_test_mode: $('speedtax_speedtax_is_test_mode').value
|
31 |
-
};
|
32 |
-
|
33 |
-
new Ajax.Request('$ajaxUrl', {
|
34 |
-
parameters: params,
|
35 |
-
onSuccess: function(response) {
|
36 |
-
result = 'Login failed!';
|
37 |
-
try {
|
38 |
-
response = JSON.parse(response.responseText);
|
39 |
-
result = response.message;
|
40 |
-
if (response.status == 1) {
|
41 |
-
elem.removeClassName('fail').addClassName('success');
|
42 |
-
} else {
|
43 |
-
elem.removeClassName('success').addClassName('fail');
|
44 |
-
}
|
45 |
-
} catch (e) {
|
46 |
-
elem.removeClassName('success').addClassName('fail');
|
47 |
-
}
|
48 |
-
$('ajax_login_result').update(result);
|
49 |
-
}
|
50 |
-
});
|
51 |
-
}
|
52 |
-
</script>
|
53 |
-
<button onclick="javascript:ajaxLogin(); return false;" class="scalable" type="button" id="$htmlId">
|
54 |
-
<span><span><span id="ajax_login_result">$buttonLabel</span></span></span>
|
55 |
-
</button>
|
56 |
-
HTML_CONTENT;
|
57 |
-
|
58 |
-
return $htmlContent;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function render(Varien_Data_Form_Element_Abstract $element){
|
62 |
-
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
63 |
-
return parent::render($element);
|
64 |
-
}
|
65 |
-
|
66 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
|
67 |
-
$originalData = $element->getOriginalData();
|
68 |
-
$this->addData(array(
|
69 |
-
'button_label' => Mage::helper('speedtax')->__($originalData['button_label']),
|
70 |
-
'html_id' => $element->getHtmlId(),
|
71 |
-
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('speedtax_adminhtml/system_config_ajax/authentication')
|
72 |
-
));
|
73 |
-
|
74 |
-
return $this->_toHtml();
|
75 |
-
}
|
76 |
-
|
77 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Harapartners_SpeedTax_Block_Adminhtml_System_Config_Form_Field_Authentication extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
15 |
+
|
16 |
+
protected function _toHtml() {
|
17 |
+
$htmlId = $this->getHtmlId();
|
18 |
+
$ajaxUrl = $this->getAjaxUrl();
|
19 |
+
$buttonLabel = $this->escapeHtml($this->getButtonLabel());
|
20 |
+
|
21 |
+
$htmlContent = <<< HTML_CONTENT
|
22 |
+
<script type="text/javascript">
|
23 |
+
function ajaxLogin() {
|
24 |
+
var elem = $('$htmlId');
|
25 |
+
|
26 |
+
params = {
|
27 |
+
username: $('speedtax_speedtax_username').value,
|
28 |
+
password: $('speedtax_speedtax_password').value,
|
29 |
+
company_code: $('speedtax_speedtax_company_code').value,
|
30 |
+
is_test_mode: $('speedtax_speedtax_is_test_mode').value
|
31 |
+
};
|
32 |
+
|
33 |
+
new Ajax.Request('$ajaxUrl', {
|
34 |
+
parameters: params,
|
35 |
+
onSuccess: function(response) {
|
36 |
+
result = 'Login failed!';
|
37 |
+
try {
|
38 |
+
response = JSON.parse(response.responseText);
|
39 |
+
result = response.message;
|
40 |
+
if (response.status == 1) {
|
41 |
+
elem.removeClassName('fail').addClassName('success');
|
42 |
+
} else {
|
43 |
+
elem.removeClassName('success').addClassName('fail');
|
44 |
+
}
|
45 |
+
} catch (e) {
|
46 |
+
elem.removeClassName('success').addClassName('fail');
|
47 |
+
}
|
48 |
+
$('ajax_login_result').update(result);
|
49 |
+
}
|
50 |
+
});
|
51 |
+
}
|
52 |
+
</script>
|
53 |
+
<button onclick="javascript:ajaxLogin(); return false;" class="scalable" type="button" id="$htmlId">
|
54 |
+
<span><span><span id="ajax_login_result">$buttonLabel</span></span></span>
|
55 |
+
</button>
|
56 |
+
HTML_CONTENT;
|
57 |
+
|
58 |
+
return $htmlContent;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function render(Varien_Data_Form_Element_Abstract $element){
|
62 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
63 |
+
return parent::render($element);
|
64 |
+
}
|
65 |
+
|
66 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
|
67 |
+
$originalData = $element->getOriginalData();
|
68 |
+
$this->addData(array(
|
69 |
+
'button_label' => Mage::helper('speedtax')->__($originalData['button_label']),
|
70 |
+
'html_id' => $element->getHtmlId(),
|
71 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('speedtax_adminhtml/system_config_ajax/authentication')
|
72 |
+
));
|
73 |
+
|
74 |
+
return $this->_toHtml();
|
75 |
+
}
|
76 |
+
|
77 |
}
|
app/code/community/Harapartners/SpeedTax/Helper/Connector/Data.php
CHANGED
@@ -1,300 +1,308 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Helper_Connector_Data extends Mage_Core_Helper_Abstract {
|
14 |
-
|
15 |
-
protected $_productTaxClassNoneTaxableId = 0; //Magento default
|
16 |
-
// protected $_allowedCountryIds = array('US', 'CA');
|
17 |
-
|
18 |
-
protected $_shipFromAddress = null;
|
19 |
-
protected $_shipToAddress = null;
|
20 |
-
|
21 |
-
// ========================== Main entry points ========================== //
|
22 |
-
public function prepareSpeedTaxInvoiceByMageQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress) {
|
23 |
-
$
|
24 |
-
$sptxInvoice
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
//
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$lineItem
|
48 |
-
$lineItem->
|
49 |
-
$lineItem->
|
50 |
-
$lineItem->
|
51 |
-
$lineItem->
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
$lineItemPrice
|
56 |
-
$
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
//
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$shippingLineItem
|
69 |
-
$
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
$
|
80 |
-
$
|
81 |
-
|
82 |
-
$sptxInvoice->
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$lineItem
|
101 |
-
$lineItem->
|
102 |
-
$lineItem->
|
103 |
-
$lineItem->
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
$
|
109 |
-
|
110 |
-
$lineItem->
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$
|
138 |
-
|
139 |
-
|
140 |
-
$sptxInvoice->
|
141 |
-
|
142 |
-
|
143 |
-
$sptxInvoice->
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
$lineItem
|
160 |
-
$lineItem->
|
161 |
-
$lineItem->
|
162 |
-
|
163 |
-
|
164 |
-
$
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
$
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
//
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
)
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
)
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
$shippingLineItem
|
228 |
-
$shippingLineItem->
|
229 |
-
$shippingLineItem->
|
230 |
-
|
231 |
-
$
|
232 |
-
$
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
$
|
245 |
-
$
|
246 |
-
$
|
247 |
-
$
|
248 |
-
|
249 |
-
$
|
250 |
-
$
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
$
|
266 |
-
$
|
267 |
-
$
|
268 |
-
|
269 |
-
$
|
270 |
-
$
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
$
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Helper_Connector_Data extends Mage_Core_Helper_Abstract {
|
14 |
+
|
15 |
+
protected $_productTaxClassNoneTaxableId = 0; //Magento default
|
16 |
+
// protected $_allowedCountryIds = array('US', 'CA');
|
17 |
+
|
18 |
+
protected $_shipFromAddress = null;
|
19 |
+
protected $_shipToAddress = null;
|
20 |
+
|
21 |
+
// ========================== Main entry points ========================== //
|
22 |
+
public function prepareSpeedTaxInvoiceByMageQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress) {
|
23 |
+
$this->_resetAllAddresses(); // Avoid potential cache contamination
|
24 |
+
$sptxInvoice = new stdClass();
|
25 |
+
$sptxInvoice->lineItems = array();
|
26 |
+
$sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
|
27 |
+
|
28 |
+
foreach ( $mageQuoteAddress->getAllItems () as $mageQuoteItem ) {
|
29 |
+
if(!!$mageQuoteItem->getParentItemId()){
|
30 |
+
continue;
|
31 |
+
}
|
32 |
+
//Multiple shipping checkout, $mageQuoteItem is instance of Mage_Sales_Model_Quote_Address_Item, not a sub-class of Mage_Sales_Model_Quote_Item
|
33 |
+
//Many product related fields must be obtained from the product object directly
|
34 |
+
if($mageQuoteItem->getProduct()->getTaxClassId() == $this->_productTaxClassNoneTaxableId){
|
35 |
+
continue;
|
36 |
+
}
|
37 |
+
|
38 |
+
//Respect Magento tax/discount config
|
39 |
+
$taxableAmount = $mageQuoteItem->getRowTotal();
|
40 |
+
if(!!Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $mageQuoteItem->getStoreId())){
|
41 |
+
$taxableAmount = $taxableAmount - $mageQuoteItem->getDiscountAmount() + $mageQuoteItem->getHiddenTaxAmount();
|
42 |
+
}
|
43 |
+
if($taxableAmount <= 0){
|
44 |
+
continue;
|
45 |
+
}
|
46 |
+
|
47 |
+
$lineItem = new stdClass();
|
48 |
+
$lineItem->productCode = $this->_getProductCode($mageQuoteItem);
|
49 |
+
$lineItem->customReference = $mageQuoteItem->getId();
|
50 |
+
$lineItem->quantity = $mageQuoteItem->getQty();
|
51 |
+
$lineItem->shipFromAddress = $this->_getShipFromAddress();
|
52 |
+
$lineItem->shipToAddress = $this->_getShippingToAddress($mageQuoteAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
|
53 |
+
|
54 |
+
//Price of row total, not unit price
|
55 |
+
$lineItemPrice = new stdClass();
|
56 |
+
$lineItemPrice->decimalValue = $taxableAmount;
|
57 |
+
$lineItem->salesAmount = $lineItemPrice;
|
58 |
+
|
59 |
+
$lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
60 |
+
$sptxInvoice->lineItems[] = $lineItem;
|
61 |
+
}
|
62 |
+
|
63 |
+
// ----- Other line items ----- //
|
64 |
+
//If global store config specifies: "is_tax_shipping", then create shipping cost line item.
|
65 |
+
//The tax code of this line item is specified by system config
|
66 |
+
$shipingAmount = $mageQuoteAddress->getShippingAmount();
|
67 |
+
if(!!Mage::getStoreConfig("speedtax/speedtax/is_tax_shipping") && $shipingAmount > 0.0){
|
68 |
+
$shippingLineItem = $this->_generateLineItemFromShippingCost($mageQuoteAddress, $shipingAmount);
|
69 |
+
$shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
70 |
+
$sptxInvoice->lineItems[] = $shippingLineItem;
|
71 |
+
}
|
72 |
+
|
73 |
+
$sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
|
74 |
+
return $sptxInvoice;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function prepareSpeedTaxInvoiceByMageOrderInvoice(Mage_Sales_Model_Order_Invoice $mageOrderInvoice) {
|
78 |
+
//Clear the invoice number so that the request is just a query
|
79 |
+
$mageOrderAddress = $mageOrderInvoice->getShippingAddress();
|
80 |
+
$this->_resetAllAddresses(); // Avoid potential cache contamination
|
81 |
+
$sptxInvoice = new stdClass();
|
82 |
+
$sptxInvoice->lineItems = array();
|
83 |
+
//Important to keep unique, invoice should already be attached to the order, count starts from 1
|
84 |
+
$sptxInvoice->invoiceNumber =
|
85 |
+
$mageOrderInvoice->getOrder()->getIncrementId()
|
86 |
+
. '-INV-' . ($mageOrderInvoice->getOrder()->getInvoiceCollection()->count());
|
87 |
+
$sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
|
88 |
+
|
89 |
+
foreach ( $mageOrderInvoice->getAllItems() as $mageItem ) {
|
90 |
+
if(!$mageItem->getTaxAmount() || $mageItem->getTaxAmount() <= 0.0){
|
91 |
+
continue;
|
92 |
+
}
|
93 |
+
|
94 |
+
//Respect Magento tax/discount config
|
95 |
+
$taxableAmount = $mageItem->getRowTotal();
|
96 |
+
if(!!Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $mageItem->getStoreId())){
|
97 |
+
$taxableAmount = $taxableAmount - $mageItem->getDiscountAmount() + $mageItem->getHiddenTaxAmount();
|
98 |
+
}
|
99 |
+
|
100 |
+
$lineItem = new stdClass();
|
101 |
+
$lineItem->productCode = $this->_getProductCode($mageItem);
|
102 |
+
$lineItem->customReference = $mageItem->getOrderItemId(); //This is during invoice creation, no ID available
|
103 |
+
$lineItem->quantity = $mageItem->getQty();
|
104 |
+
$lineItem->shipFromAddress = $this->_getShipFromAddress();
|
105 |
+
$lineItem->shipToAddress = $this->_getShippingToAddress($mageOrderAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
|
106 |
+
|
107 |
+
//Price of row total, not unit price
|
108 |
+
$lineItemPrice = new stdClass();
|
109 |
+
$lineItemPrice->decimalValue = $taxableAmount;
|
110 |
+
$lineItem->salesAmount = $lineItemPrice;
|
111 |
+
|
112 |
+
$lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
113 |
+
$sptxInvoice->lineItems[] = $lineItem;
|
114 |
+
}
|
115 |
+
|
116 |
+
// ----- Other line items ----- //
|
117 |
+
//If global store config specifies: "is_tax_shipping", then create shipping cost line item.
|
118 |
+
//The tax code of this line item is specified by system config
|
119 |
+
if($mageOrderInvoice->getShippingAmount() === null){
|
120 |
+
$mageOrderInvoice->collectTotals();
|
121 |
+
}
|
122 |
+
$shipingAmount = $mageOrderInvoice->getShippingAmount();
|
123 |
+
$shipingTaxAmount = $mageOrderInvoice->getShippingTaxAmount();
|
124 |
+
// Must check shipping tax amount is NOT forced to 0 by Magento
|
125 |
+
if(!!Mage::getStoreConfig("speedtax/speedtax/is_tax_shipping") && $shipingAmount > 0.0 && $shipingTaxAmount > 0.0){
|
126 |
+
$shippingLineItem = $this->_generateLineItemFromShippingCost($mageOrderAddress, $shipingAmount);
|
127 |
+
$shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
128 |
+
$sptxInvoice->lineItems[] = $shippingLineItem;
|
129 |
+
}
|
130 |
+
|
131 |
+
$sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
|
132 |
+
return $sptxInvoice;
|
133 |
+
}
|
134 |
+
|
135 |
+
public function prepareSpeedTaxInvoiceByMageOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo) {
|
136 |
+
//Clear the invoice number so that the request is just a query
|
137 |
+
$mageOrderAddress = $mageOrderCreditmemo->getShippingAddress();
|
138 |
+
$this->_resetAllAddresses(); // Avoid potential cache contamination
|
139 |
+
$sptxInvoice = new stdClass();
|
140 |
+
$sptxInvoice->lineItems = array();
|
141 |
+
|
142 |
+
//Important to keep unique, credit memo not yet attached to the order, count ++ so that it starts from 1
|
143 |
+
$sptxInvoice->invoiceNumber =
|
144 |
+
$mageOrderCreditmemo->getOrder()->getIncrementId()
|
145 |
+
. '-CR-' . ($mageOrderCreditmemo->getOrder()->getCreditmemosCollection()->count() + 1);
|
146 |
+
$sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
|
147 |
+
|
148 |
+
foreach ( $mageOrderCreditmemo->getAllItems() as $mageItem ) {
|
149 |
+
if(!$mageItem->getTaxAmount() || $mageItem->getTaxAmount() <= 0.0){
|
150 |
+
continue;
|
151 |
+
}
|
152 |
+
|
153 |
+
//Respect Magento tax/discount config
|
154 |
+
$taxableAmount = $mageItem->getRowTotal();
|
155 |
+
if(!!Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $mageItem->getStoreId())){
|
156 |
+
$taxableAmount = $taxableAmount - $mageItem->getDiscountAmount() + $mageItem->getHiddenTaxAmount();
|
157 |
+
}
|
158 |
+
|
159 |
+
$lineItem = new stdClass();
|
160 |
+
$lineItem->productCode = $this->_getProductCode($mageItem);
|
161 |
+
$lineItem->customReference = $mageItem->getOrderItemId(); //This is during credit memo creation, no ID available
|
162 |
+
$lineItem->quantity = $mageItem->getQty();
|
163 |
+
$lineItem->shipFromAddress = $this->_getShipFromAddress();
|
164 |
+
$lineItem->shipToAddress = $this->_getShippingToAddress($mageOrderAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
|
165 |
+
|
166 |
+
//Price of row total, not unit price
|
167 |
+
$lineItemPrice = new stdClass();
|
168 |
+
$lineItemPrice->decimalValue = $taxableAmount;
|
169 |
+
$lineItem->salesAmount = $lineItemPrice;
|
170 |
+
|
171 |
+
$lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
172 |
+
$sptxInvoice->lineItems[] = $lineItem;
|
173 |
+
}
|
174 |
+
|
175 |
+
// ----- Other line items ----- //
|
176 |
+
//If global store config specifies: "is_tax_shipping", then create shipping cost line item.
|
177 |
+
//The tax code of this line item is specified by system config
|
178 |
+
if($mageOrderCreditmemo->getShippingAmount() === null){
|
179 |
+
$mageOrderCreditmemo->collectTotals();
|
180 |
+
}
|
181 |
+
$shipingAmount = $mageOrderCreditmemo->getShippingAmount();
|
182 |
+
$shipingTaxAmount = $mageOrderInvoice->getShippingTaxAmount();
|
183 |
+
// Must check shipping tax amount is NOT forced to 0 by Magento
|
184 |
+
if(!!Mage::getStoreConfig("speedtax/speedtax/is_tax_shipping") && $shipingAmount > 0.0 && $shipingTaxAmount > 0.0){
|
185 |
+
$shippingLineItem = $this->_generateLineItemFromShippingCost($mageOrderAddress, $shipingAmount);
|
186 |
+
$shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
|
187 |
+
$sptxInvoice->lineItems[] = $shippingLineItem;
|
188 |
+
}
|
189 |
+
|
190 |
+
$sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
|
191 |
+
return $sptxInvoice;
|
192 |
+
}
|
193 |
+
|
194 |
+
// ========================== Utilities ========================== //
|
195 |
+
public function mapAddressExceptions($sourceAddress){
|
196 |
+
//By default the we take the source address as the ship to address for tax calculation
|
197 |
+
$mappedAddress = $sourceAddress;
|
198 |
+
|
199 |
+
//However, we also allow exceptions where billing address is used for calculation, if:
|
200 |
+
//1) The source address in NOT in the exception list, and
|
201 |
+
//2) The billing address (of the corresponding order or quote) is in the exception list
|
202 |
+
$isExceptionEnabled = Mage::getStoreConfig('speedtax/tax_by_billing/is_enabled');
|
203 |
+
$exceptionOrigin = explode(',', Mage::getStoreConfig('speedtax/tax_by_billing/billing_origins'));
|
204 |
+
if($isExceptionEnabled && !in_array($sourceAddress->getRegionId(), $exceptionOrigin)){
|
205 |
+
//Seach for billing address
|
206 |
+
$billingAddress = null;
|
207 |
+
if($sourceAddress instanceof Mage_Sales_Model_Quote_Address){
|
208 |
+
$quote = $sourceAddress->getQuote();
|
209 |
+
if(!!$quote && !!$quote->getBillingAddress()
|
210 |
+
&& in_array($quote->getBillingAddress()->getRegionId(), $exceptionOrigin)
|
211 |
+
){
|
212 |
+
$mappedAddress = $quote->getBillingAddress();
|
213 |
+
}
|
214 |
+
}elseif($sourceAddress instanceof Mage_Sales_Model_Order_Address){
|
215 |
+
$order = $sourceAddress->getOrder();
|
216 |
+
if(!!$order && !!$order->getBillingAddress()
|
217 |
+
&& in_array($order->getBillingAddress()->getRegionId(), $exceptionOrigin)
|
218 |
+
){
|
219 |
+
$mappedAddress = $order->getBillingAddress();
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
return $mappedAddress;
|
224 |
+
}
|
225 |
+
|
226 |
+
protected function _generateLineItemFromShippingCost($mageAddress, $shipingAmount) {
|
227 |
+
$shippingLineItem = new stdClass();
|
228 |
+
$shippingLineItem->productCode = Mage::getStoreConfig("speedtax/speedtax/shipping_tax_code");
|
229 |
+
$shippingLineItem->customReference = Mage::getStoreConfig("speedtax/speedtax/shipping_tax_code");
|
230 |
+
$shippingLineItem->quantity = 1;
|
231 |
+
$shippingLineItem->shipFromAddress = $this->_getShipFromAddress();
|
232 |
+
$shippingLineItem->shipToAddress = $this->_getShippingToAddress($mageAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
|
233 |
+
|
234 |
+
$shippingPrice = new stdClass();
|
235 |
+
$shippingPrice->decimalValue = $shipingAmount;
|
236 |
+
$shippingLineItem->salesAmount = $shippingPrice;
|
237 |
+
|
238 |
+
return $shippingLineItem;
|
239 |
+
}
|
240 |
+
|
241 |
+
//Shipping Origin Address
|
242 |
+
protected function _getShipFromAddress() {
|
243 |
+
if($this->_shipFromAddress === null){
|
244 |
+
$this->_shipFromAddress = new stdClass();
|
245 |
+
$countryId = Mage::getStoreConfig('shipping/origin/country_id');
|
246 |
+
$zip = Mage::getStoreConfig('shipping/origin/postcode');
|
247 |
+
$regionId = Mage::getStoreConfig('shipping/origin/region_id');
|
248 |
+
$state = Mage::getModel('directory/region')->load($regionId)->getName();
|
249 |
+
$city = Mage::getStoreConfig('shipping/origin/city');
|
250 |
+
$street = Mage::getStoreConfig('shipping/origin/street');
|
251 |
+
|
252 |
+
$this->_shipFromAddress->address1 = $street;
|
253 |
+
$this->_shipFromAddress->address2 = $city . ", " . $state . " " . $zip; //. ", " . $countryId;
|
254 |
+
}
|
255 |
+
return $this->_shipFromAddress;
|
256 |
+
}
|
257 |
+
|
258 |
+
//Shipping Destination Address
|
259 |
+
protected function _getShippingToAddress($sourceAddress) {
|
260 |
+
if($this->_shipToAddress === null){
|
261 |
+
|
262 |
+
//We need to test for exceptions where billing address is used for calculation
|
263 |
+
$mappedAddress = $this->mapAddressExceptions($sourceAddress);
|
264 |
+
|
265 |
+
$this->_shipToAddress = new stdClass();
|
266 |
+
$country = $mappedAddress->getCountry();
|
267 |
+
$zip = $mappedAddress->getPostcode(); //$zip = preg_replace('/[^0-9\-]*/', '', $mappedAddress->getPostcode()); //US zip code clean up
|
268 |
+
$state = $mappedAddress->getRegion(); //No region resolution needed, $this->_getStateCodeByRegionId($mappedAddress->getState());
|
269 |
+
$city = $mappedAddress->getCity();
|
270 |
+
$street = implode(' ', $mappedAddress->getStreet()); //In case of multiple line address
|
271 |
+
|
272 |
+
$this->_shipToAddress->address1 = $street;
|
273 |
+
$this->_shipToAddress->address2 = $city . ", " . $state . " " . $zip; //. ", " . $county;
|
274 |
+
}
|
275 |
+
return $this->_shipToAddress;
|
276 |
+
}
|
277 |
+
|
278 |
+
protected function _resetAllAddresses(){
|
279 |
+
// Avoid potential cache contamination
|
280 |
+
$this->_shipFromAddress = null;
|
281 |
+
$this->_shipToAddress = null;
|
282 |
+
}
|
283 |
+
|
284 |
+
//In a standard setup, tax is calculated by tax class (i.e. product code), if empty use default
|
285 |
+
//Advanced calculation by product SKU is also possible. Please contact SpeedTax support to setup advanced service
|
286 |
+
protected function _getProductCode($item){
|
287 |
+
if(!Mage::helper('speedtax')->isUseProductTaxClass()){
|
288 |
+
return $item->getSku();
|
289 |
+
}
|
290 |
+
$taxCode = $this->_getTaxClassByItem($item);
|
291 |
+
if(!$taxCode){
|
292 |
+
$taxCode = $item->getSku();
|
293 |
+
}
|
294 |
+
return $taxCode;
|
295 |
+
}
|
296 |
+
|
297 |
+
protected function _getTaxClassByItem($item){
|
298 |
+
$storeId = Mage::app()->getStore()->getId();
|
299 |
+
$taxClassId = Mage::getResourceModel('catalog/product')->getAttributeRawValue($item->getProductId(), 'tax_class_id', $storeId);
|
300 |
+
if($taxClassId){
|
301 |
+
$taxClassCode = Mage::getModel('tax/class_source_product')->getOptionText($taxClassId);
|
302 |
+
}else{
|
303 |
+
$taxClassCode = null;
|
304 |
+
}
|
305 |
+
return $taxClassCode;
|
306 |
+
}
|
307 |
+
|
308 |
}
|
app/code/community/Harapartners/SpeedTax/Helper/Connector/Speedtax.php
CHANGED
@@ -1,185 +1,185 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Helper_Connector_Speedtax extends Harapartners_ConnectorHub_Helper_Connector_Core {
|
14 |
-
|
15 |
-
const REQUEST_ACTION_CALCULATE_INVOICE = 'CalculateInvoice';
|
16 |
-
const REQUEST_ACTION_POST_INVOICE = 'PostInvoice';
|
17 |
-
const REQUEST_ACTION_POST_CREDITMEMO = 'PostCreditmemo';
|
18 |
-
const REQUEST_ACTION_VOID_INVOICE = 'VoidInvoice';
|
19 |
-
const REQUEST_ACTION_BATCH_VOID_INVOICES = 'BatchVoidInvoices';
|
20 |
-
|
21 |
-
const RESPONSE_TYPE_SUCCESS = 'SUCCESS';
|
22 |
-
const RESPONSE_TYPE_FAILED_WITH_ERRORS = 'FAILED_WITH_ERRORS';
|
23 |
-
const RESPONSE_TYPE_FAILED_INVOICE_NUMBER = 'FAILED_INVOICE_NUMBER';
|
24 |
-
|
25 |
-
protected $_serviceType = 'speedtax';
|
26 |
-
|
27 |
-
// ======================= Essential overrides ======================= //
|
28 |
-
public function getServiceMode($request = null){
|
29 |
-
//Always default to production for safety
|
30 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
31 |
-
|
32 |
-
//Check from request first (in case it's a new authorization), default to last saved config value
|
33 |
-
if(!!Mage::getStoreConfig($this->_getConfigDataBasePath('is_test_mode'))){
|
34 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
35 |
-
}
|
36 |
-
if(isset($request['meta']['credentials']['service_mode'])){
|
37 |
-
$serviceMode = $request['meta']['credentials']['service_mode']; //Allow 0 and other empty values
|
38 |
-
}
|
39 |
-
|
40 |
-
return $serviceMode;
|
41 |
-
}
|
42 |
-
|
43 |
-
public function getIsDebugMode(){
|
44 |
-
return Mage::getStoreConfig($this->_getConfigDataBasePath('is_debug_transaction'));
|
45 |
-
}
|
46 |
-
|
47 |
-
protected function _getConnectorHubUrl(){
|
48 |
-
return $this->_getConnectorHubRootUrl() . 'SpeedTax.php';
|
49 |
-
}
|
50 |
-
|
51 |
-
protected function _getConfigDataBasePath($key){
|
52 |
-
return 'speedtax/speedtax/' . $key;
|
53 |
-
}
|
54 |
-
|
55 |
-
protected function _prepareCredentials(){
|
56 |
-
$username = Mage::getStoreConfig($this->_getConfigDataBasePath('username'));
|
57 |
-
$password = Mage::helper('core')->decrypt(Mage::getStoreConfig($this->_getConfigDataBasePath('password')));
|
58 |
-
$companyCode = Mage::getStoreConfig($this->_getConfigDataBasePath('company_code'));
|
59 |
-
$isTestMode = Mage::getStoreConfig($this->_getConfigDataBasePath('is_test_mode'));
|
60 |
-
if(!!$isTestMode){
|
61 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
62 |
-
}else{
|
63 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
64 |
-
}
|
65 |
-
|
66 |
-
$credentials = array(
|
67 |
-
'username' => $username,
|
68 |
-
'password' => $password,
|
69 |
-
'company_code' => $companyCode,
|
70 |
-
'service_mode' => $serviceMode
|
71 |
-
);
|
72 |
-
return $credentials;
|
73 |
-
}
|
74 |
-
|
75 |
-
// ====================== Requests ====================== //
|
76 |
-
public function calculateInvoiceRequest($sptxInvoice){
|
77 |
-
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_CALCULATE_INVOICE);
|
78 |
-
return $response->data->result;
|
79 |
-
}
|
80 |
-
|
81 |
-
public function postInvoiceRequest($sptxInvoice){
|
82 |
-
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_INVOICE);
|
83 |
-
return $response->data->result;
|
84 |
-
}
|
85 |
-
|
86 |
-
public function postCreditmemoRequest($sptxInvoice){
|
87 |
-
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_CREDITMEMO);
|
88 |
-
return $response->data->result;
|
89 |
-
}
|
90 |
-
|
91 |
-
public function batchVoidInvoices($invoiceNumbers){
|
92 |
-
$credentials = $this->_prepareCredentials();
|
93 |
-
$request = array(
|
94 |
-
'meta' => array(
|
95 |
-
'action' => self::REQUEST_ACTION_BATCH_VOID_INVOICES
|
96 |
-
),
|
97 |
-
'data' => array(
|
98 |
-
'credentials' => $credentials,
|
99 |
-
'invoice_numbers' => $invoiceNumbers
|
100 |
-
)
|
101 |
-
);
|
102 |
-
$response = $this->_processRequest($request);
|
103 |
-
$this->_validateResponse($response);
|
104 |
-
return $response;
|
105 |
-
}
|
106 |
-
|
107 |
-
protected function _doInvoiceRequest($sptxInvoice, $actionType){
|
108 |
-
$credentials = $this->_prepareCredentials();
|
109 |
-
$request = array(
|
110 |
-
'meta' => array(
|
111 |
-
'action' => $actionType
|
112 |
-
),
|
113 |
-
'data' => array(
|
114 |
-
'credentials' => $credentials,
|
115 |
-
'invoice' => $sptxInvoice
|
116 |
-
)
|
117 |
-
);
|
118 |
-
|
119 |
-
$response = $this->_loadCachedInvoiceResponse($sptxInvoice, $actionType);
|
120 |
-
if(!$response){
|
121 |
-
$response = $this->_processRequest($request);
|
122 |
-
//Save cache upon successful transactions only
|
123 |
-
if(isset($response->meta->status) && $response->meta->status == Harapartners_ConnectorHub_Helper_Connector_Core::RESPONSE_STATUS_SUCCESS){
|
124 |
-
$this->_saveCachedInvoiceResponse($response, $sptxInvoice, $actionType);
|
125 |
-
}
|
126 |
-
}
|
127 |
-
$this->_validateResponse($response);
|
128 |
-
return $response;
|
129 |
-
}
|
130 |
-
|
131 |
-
protected function _loadCachedInvoiceResponse($sptxInvoice, $actionType){
|
132 |
-
if(!$this->_isCacheRequestAllowed($actionType)){
|
133 |
-
return false;
|
134 |
-
}
|
135 |
-
$sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
|
136 |
-
$response = Mage::getSingleton('speedtax/session')->loadCachedResponse($sptxInvoiceCacheKey);
|
137 |
-
return $response;
|
138 |
-
}
|
139 |
-
|
140 |
-
protected function _saveCachedInvoiceResponse($response, $sptxInvoice, $actionType){
|
141 |
-
if(!$this->_isCacheRequestAllowed($actionType)){
|
142 |
-
return false;
|
143 |
-
}
|
144 |
-
$sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
|
145 |
-
$response = Mage::getSingleton('speedtax/session')->saveCachedResponse($sptxInvoiceCacheKey, $response);
|
146 |
-
return true;
|
147 |
-
}
|
148 |
-
|
149 |
-
protected function _validateResponse($response){
|
150 |
-
//Essential validation for SpeedTax response data structure
|
151 |
-
if(empty($response->data->result->resultType)){
|
152 |
-
Mage::throwException('Invalid tax response');
|
153 |
-
}
|
154 |
-
switch ($response->data->result->resultType) {
|
155 |
-
case self::RESPONSE_TYPE_SUCCESS:
|
156 |
-
break;
|
157 |
-
case self::RESPONSE_TYPE_FAILED_WITH_ERRORS:
|
158 |
-
case self::RESPONSE_TYPE_FAILED_INVOICE_NUMBER:
|
159 |
-
default :
|
160 |
-
Mage::throwException('Tax request failed');
|
161 |
-
break;
|
162 |
-
}
|
163 |
-
return $this;
|
164 |
-
}
|
165 |
-
|
166 |
-
protected function _isCacheRequestAllowed($actionType){
|
167 |
-
$allRequestCache = false;
|
168 |
-
switch($actionType){
|
169 |
-
case self::REQUEST_ACTION_CALCULATE_INVOICE:
|
170 |
-
$allRequestCache = true;
|
171 |
-
break;
|
172 |
-
default:
|
173 |
-
$allRequestCache = false;
|
174 |
-
break;
|
175 |
-
}
|
176 |
-
return $allRequestCache;
|
177 |
-
}
|
178 |
-
|
179 |
-
protected function _generateInvoiceCacheKey($sptxInvoice){
|
180 |
-
$sptxInvoice = clone $sptxInvoice;
|
181 |
-
$sptxInvoice->invoiceDate = null;
|
182 |
-
return md5(json_encode($sptxInvoice));
|
183 |
-
}
|
184 |
-
|
185 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Helper_Connector_Speedtax extends Harapartners_ConnectorHub_Helper_Connector_Core {
|
14 |
+
|
15 |
+
const REQUEST_ACTION_CALCULATE_INVOICE = 'CalculateInvoice';
|
16 |
+
const REQUEST_ACTION_POST_INVOICE = 'PostInvoice';
|
17 |
+
const REQUEST_ACTION_POST_CREDITMEMO = 'PostCreditmemo';
|
18 |
+
const REQUEST_ACTION_VOID_INVOICE = 'VoidInvoice';
|
19 |
+
const REQUEST_ACTION_BATCH_VOID_INVOICES = 'BatchVoidInvoices';
|
20 |
+
|
21 |
+
const RESPONSE_TYPE_SUCCESS = 'SUCCESS';
|
22 |
+
const RESPONSE_TYPE_FAILED_WITH_ERRORS = 'FAILED_WITH_ERRORS';
|
23 |
+
const RESPONSE_TYPE_FAILED_INVOICE_NUMBER = 'FAILED_INVOICE_NUMBER';
|
24 |
+
|
25 |
+
protected $_serviceType = 'speedtax';
|
26 |
+
|
27 |
+
// ======================= Essential overrides ======================= //
|
28 |
+
public function getServiceMode($request = null){
|
29 |
+
//Always default to production for safety
|
30 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
31 |
+
|
32 |
+
//Check from request first (in case it's a new authorization), default to last saved config value
|
33 |
+
if(!!Mage::getStoreConfig($this->_getConfigDataBasePath('is_test_mode'))){
|
34 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
35 |
+
}
|
36 |
+
if(isset($request['meta']['credentials']['service_mode'])){
|
37 |
+
$serviceMode = $request['meta']['credentials']['service_mode']; //Allow 0 and other empty values
|
38 |
+
}
|
39 |
+
|
40 |
+
return $serviceMode;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getIsDebugMode(){
|
44 |
+
return Mage::getStoreConfig($this->_getConfigDataBasePath('is_debug_transaction'));
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function _getConnectorHubUrl(){
|
48 |
+
return $this->_getConnectorHubRootUrl() . 'SpeedTax.php';
|
49 |
+
}
|
50 |
+
|
51 |
+
protected function _getConfigDataBasePath($key){
|
52 |
+
return 'speedtax/speedtax/' . $key;
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function _prepareCredentials(){
|
56 |
+
$username = Mage::getStoreConfig($this->_getConfigDataBasePath('username'));
|
57 |
+
$password = Mage::helper('core')->decrypt(Mage::getStoreConfig($this->_getConfigDataBasePath('password')));
|
58 |
+
$companyCode = Mage::getStoreConfig($this->_getConfigDataBasePath('company_code'));
|
59 |
+
$isTestMode = Mage::getStoreConfig($this->_getConfigDataBasePath('is_test_mode'));
|
60 |
+
if(!!$isTestMode){
|
61 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
62 |
+
}else{
|
63 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
64 |
+
}
|
65 |
+
|
66 |
+
$credentials = array(
|
67 |
+
'username' => $username,
|
68 |
+
'password' => $password,
|
69 |
+
'company_code' => $companyCode,
|
70 |
+
'service_mode' => $serviceMode
|
71 |
+
);
|
72 |
+
return $credentials;
|
73 |
+
}
|
74 |
+
|
75 |
+
// ====================== Requests ====================== //
|
76 |
+
public function calculateInvoiceRequest($sptxInvoice){
|
77 |
+
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_CALCULATE_INVOICE);
|
78 |
+
return $response->data->result;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function postInvoiceRequest($sptxInvoice){
|
82 |
+
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_INVOICE);
|
83 |
+
return $response->data->result;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function postCreditmemoRequest($sptxInvoice){
|
87 |
+
$response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_CREDITMEMO);
|
88 |
+
return $response->data->result;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function batchVoidInvoices($invoiceNumbers){
|
92 |
+
$credentials = $this->_prepareCredentials();
|
93 |
+
$request = array(
|
94 |
+
'meta' => array(
|
95 |
+
'action' => self::REQUEST_ACTION_BATCH_VOID_INVOICES
|
96 |
+
),
|
97 |
+
'data' => array(
|
98 |
+
'credentials' => $credentials,
|
99 |
+
'invoice_numbers' => $invoiceNumbers
|
100 |
+
)
|
101 |
+
);
|
102 |
+
$response = $this->_processRequest($request);
|
103 |
+
$this->_validateResponse($response);
|
104 |
+
return $response;
|
105 |
+
}
|
106 |
+
|
107 |
+
protected function _doInvoiceRequest($sptxInvoice, $actionType){
|
108 |
+
$credentials = $this->_prepareCredentials();
|
109 |
+
$request = array(
|
110 |
+
'meta' => array(
|
111 |
+
'action' => $actionType
|
112 |
+
),
|
113 |
+
'data' => array(
|
114 |
+
'credentials' => $credentials,
|
115 |
+
'invoice' => $sptxInvoice
|
116 |
+
)
|
117 |
+
);
|
118 |
+
|
119 |
+
$response = $this->_loadCachedInvoiceResponse($sptxInvoice, $actionType);
|
120 |
+
if(!$response){
|
121 |
+
$response = $this->_processRequest($request);
|
122 |
+
//Save cache upon successful transactions only
|
123 |
+
if(isset($response->meta->status) && $response->meta->status == Harapartners_ConnectorHub_Helper_Connector_Core::RESPONSE_STATUS_SUCCESS){
|
124 |
+
$this->_saveCachedInvoiceResponse($response, $sptxInvoice, $actionType);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$this->_validateResponse($response);
|
128 |
+
return $response;
|
129 |
+
}
|
130 |
+
|
131 |
+
protected function _loadCachedInvoiceResponse($sptxInvoice, $actionType){
|
132 |
+
if(!$this->_isCacheRequestAllowed($actionType)){
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
$sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
|
136 |
+
$response = Mage::getSingleton('speedtax/session')->loadCachedResponse($sptxInvoiceCacheKey);
|
137 |
+
return $response;
|
138 |
+
}
|
139 |
+
|
140 |
+
protected function _saveCachedInvoiceResponse($response, $sptxInvoice, $actionType){
|
141 |
+
if(!$this->_isCacheRequestAllowed($actionType)){
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
$sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
|
145 |
+
$response = Mage::getSingleton('speedtax/session')->saveCachedResponse($sptxInvoiceCacheKey, $response);
|
146 |
+
return true;
|
147 |
+
}
|
148 |
+
|
149 |
+
protected function _validateResponse($response){
|
150 |
+
//Essential validation for SpeedTax response data structure
|
151 |
+
if(empty($response->data->result->resultType)){
|
152 |
+
Mage::throwException('Invalid tax response');
|
153 |
+
}
|
154 |
+
switch ($response->data->result->resultType) {
|
155 |
+
case self::RESPONSE_TYPE_SUCCESS:
|
156 |
+
break;
|
157 |
+
case self::RESPONSE_TYPE_FAILED_WITH_ERRORS:
|
158 |
+
case self::RESPONSE_TYPE_FAILED_INVOICE_NUMBER:
|
159 |
+
default :
|
160 |
+
Mage::throwException('Tax request failed');
|
161 |
+
break;
|
162 |
+
}
|
163 |
+
return $this;
|
164 |
+
}
|
165 |
+
|
166 |
+
protected function _isCacheRequestAllowed($actionType){
|
167 |
+
$allRequestCache = false;
|
168 |
+
switch($actionType){
|
169 |
+
case self::REQUEST_ACTION_CALCULATE_INVOICE:
|
170 |
+
$allRequestCache = true;
|
171 |
+
break;
|
172 |
+
default:
|
173 |
+
$allRequestCache = false;
|
174 |
+
break;
|
175 |
+
}
|
176 |
+
return $allRequestCache;
|
177 |
+
}
|
178 |
+
|
179 |
+
protected function _generateInvoiceCacheKey($sptxInvoice){
|
180 |
+
$sptxInvoice = clone $sptxInvoice;
|
181 |
+
$sptxInvoice->invoiceDate = null;
|
182 |
+
return md5(json_encode($sptxInvoice));
|
183 |
+
}
|
184 |
+
|
185 |
}
|
app/code/community/Harapartners/SpeedTax/Helper/Data.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Helper_Data extends Mage_Core_Helper_Abstract {
|
14 |
-
|
15 |
-
// Notification settings
|
16 |
-
const XML_PATH_NOTIFICATION_DISABLED_COMPRESS = 'speedtax/notification/disabled_compress';
|
17 |
-
const NOTIFICATION_KEY_TAX_ON_DISCOUNT = 'tax_on_discount';
|
18 |
-
const ERROR_LOG_FILE = 'speedtax_error.log';
|
19 |
-
const DEFAULT_MAGENTO_COLLECTION_PAGE_SIZE = 50;
|
20 |
-
|
21 |
-
protected $_xmlPathPrefix = 'speedtax/speedtax/';
|
22 |
-
|
23 |
-
// =========================== config and essential flags =========================== //
|
24 |
-
public function isSpeedTaxEnabled(){
|
25 |
-
return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'is_enabled' );
|
26 |
-
}
|
27 |
-
|
28 |
-
public function isUseProductTaxClass(){
|
29 |
-
return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'is_use_product_tax_class' );
|
30 |
-
}
|
31 |
-
|
32 |
-
public function isAddressValidationOn($address, $storeId) {
|
33 |
-
return Mage::getStoreConfig( $this->_xmlPathPrefix . 'validate_address', $storeId);
|
34 |
-
}
|
35 |
-
|
36 |
-
public function isFailsafeEnabled(){
|
37 |
-
return Mage::getStoreConfig ( 'speedtax/failsafe/is_enabled' );
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getSpeedtaxInvoiceStatusValues() {
|
41 |
-
return array(
|
42 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_PENDING => Mage::helper('speedtax')->__('Pending'),
|
43 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_POSTED => Mage::helper('speedtax')->__('Posted'),
|
44 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_VOID => Mage::helper('speedtax')->__('Void'),
|
45 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_ERROR => Mage::helper('speedtax')->__('Error'),
|
46 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE => Mage::helper('speedtax')->__('Failsafe'),
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Helper_Data extends Mage_Core_Helper_Abstract {
|
14 |
+
|
15 |
+
// Notification settings
|
16 |
+
const XML_PATH_NOTIFICATION_DISABLED_COMPRESS = 'speedtax/notification/disabled_compress';
|
17 |
+
const NOTIFICATION_KEY_TAX_ON_DISCOUNT = 'tax_on_discount';
|
18 |
+
const ERROR_LOG_FILE = 'speedtax_error.log';
|
19 |
+
const DEFAULT_MAGENTO_COLLECTION_PAGE_SIZE = 50;
|
20 |
+
|
21 |
+
protected $_xmlPathPrefix = 'speedtax/speedtax/';
|
22 |
+
|
23 |
+
// =========================== config and essential flags =========================== //
|
24 |
+
public function isSpeedTaxEnabled(){
|
25 |
+
return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'is_enabled' );
|
26 |
+
}
|
27 |
+
|
28 |
+
public function isUseProductTaxClass(){
|
29 |
+
return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'is_use_product_tax_class' );
|
30 |
+
}
|
31 |
+
|
32 |
+
public function isAddressValidationOn($address, $storeId) {
|
33 |
+
return Mage::getStoreConfig( $this->_xmlPathPrefix . 'validate_address', $storeId);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function isFailsafeEnabled(){
|
37 |
+
return Mage::getStoreConfig ( 'speedtax/failsafe/is_enabled' );
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getSpeedtaxInvoiceStatusValues() {
|
41 |
+
return array(
|
42 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_PENDING => Mage::helper('speedtax')->__('Pending'),
|
43 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_POSTED => Mage::helper('speedtax')->__('Posted'),
|
44 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_VOID => Mage::helper('speedtax')->__('Void'),
|
45 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_ERROR => Mage::helper('speedtax')->__('Error'),
|
46 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE => Mage::helper('speedtax')->__('Failsafe'),
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
}
|
app/code/community/Harapartners/SpeedTax/Helper/Failsafe.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Helper_Failsafe extends Mage_Core_Helper_Abstract {
|
14 |
-
|
15 |
-
const FALLBACK_CALCULATION_PRECISION = 4;
|
16 |
-
|
17 |
-
public function updateFailsafeRate(Mage_Sales_Model_Quote_Address $mageQuoteAddress, $responseResult){
|
18 |
-
if(!$mageQuoteAddress || !$responseResult){
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
|
22 |
-
$decPrecision = pow(0.1, Harapartners_SpeedTax_Helper_Failsafe::FALLBACK_CALCULATION_PRECISION);
|
23 |
-
$requestData = array();
|
24 |
-
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageQuoteAddress($mageQuoteAddress);
|
25 |
-
if(!empty($sptxInvoice->lineItems)){
|
26 |
-
foreach($sptxInvoice->lineItems as $lineItem){
|
27 |
-
if(!empty($lineItem->customReference) && !empty($lineItem->salesAmount->decimalValue)){
|
28 |
-
$requestData[$lineItem->customReference] = $lineItem->salesAmount->decimalValue;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
}
|
32 |
-
$responseData = array();
|
33 |
-
if(!empty($responseResult->lineItemBundles->lineItems)){
|
34 |
-
foreach($responseResult->lineItemBundles->lineItems as $lineItem){
|
35 |
-
if(!empty($lineItem->customReference) && !empty($lineItem->taxAmount->decimalValue)){
|
36 |
-
$responseData[$lineItem->customReference] = $lineItem->taxAmount->decimalValue;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
$taxRate = 0.0; //This is a percentage
|
42 |
-
foreach($requestData as $customReference => $salesAmount){
|
43 |
-
if($salesAmount > $decPrecision && isset($responseData[$customReference])) {
|
44 |
-
$taxRate = round($responseData[$customReference] / $salesAmount * 100.0, Harapartners_SpeedTax_Helper_Failsafe::FALLBACK_CALCULATION_PRECISION);
|
45 |
-
break;
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
//Do not update zero tax rates
|
50 |
-
if($taxRate <= $decPrecision){
|
51 |
-
return;
|
52 |
-
}
|
53 |
-
|
54 |
-
$countryId = $mageQuoteAddress->getCountryId();
|
55 |
-
$regionId = $mageQuoteAddress->getRegionId();
|
56 |
-
$postcode = $mageQuoteAddress->getPostcode(); //$postcode = preg_replace('/[^0-9\-]*/', '', $address->getPostcode()); //US zip code clean up
|
57 |
-
$failsafeCalRate = Mage::getModel('speedtax/failsafe_calculation_rate');
|
58 |
-
$failsafeCalRate->loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode);
|
59 |
-
|
60 |
-
if($failsafeCalRate->getTaxRate() != $taxRate){
|
61 |
-
$failsafeCalRate->setData(array(
|
62 |
-
'country_id' => $countryId,
|
63 |
-
'region_id' => $regionId,
|
64 |
-
'postcode' => $postcode,
|
65 |
-
'tax_rate' => $taxRate
|
66 |
-
));
|
67 |
-
$failsafeCalRate->save();
|
68 |
-
}
|
69 |
-
|
70 |
-
return null;
|
71 |
-
}
|
72 |
-
|
73 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Helper_Failsafe extends Mage_Core_Helper_Abstract {
|
14 |
+
|
15 |
+
const FALLBACK_CALCULATION_PRECISION = 4;
|
16 |
+
|
17 |
+
public function updateFailsafeRate(Mage_Sales_Model_Quote_Address $mageQuoteAddress, $responseResult){
|
18 |
+
if(!$mageQuoteAddress || !$responseResult){
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
$decPrecision = pow(0.1, Harapartners_SpeedTax_Helper_Failsafe::FALLBACK_CALCULATION_PRECISION);
|
23 |
+
$requestData = array();
|
24 |
+
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageQuoteAddress($mageQuoteAddress);
|
25 |
+
if(!empty($sptxInvoice->lineItems)){
|
26 |
+
foreach($sptxInvoice->lineItems as $lineItem){
|
27 |
+
if(!empty($lineItem->customReference) && !empty($lineItem->salesAmount->decimalValue)){
|
28 |
+
$requestData[$lineItem->customReference] = $lineItem->salesAmount->decimalValue;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
$responseData = array();
|
33 |
+
if(!empty($responseResult->lineItemBundles->lineItems)){
|
34 |
+
foreach($responseResult->lineItemBundles->lineItems as $lineItem){
|
35 |
+
if(!empty($lineItem->customReference) && !empty($lineItem->taxAmount->decimalValue)){
|
36 |
+
$responseData[$lineItem->customReference] = $lineItem->taxAmount->decimalValue;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
$taxRate = 0.0; //This is a percentage
|
42 |
+
foreach($requestData as $customReference => $salesAmount){
|
43 |
+
if($salesAmount > $decPrecision && isset($responseData[$customReference])) {
|
44 |
+
$taxRate = round($responseData[$customReference] / $salesAmount * 100.0, Harapartners_SpeedTax_Helper_Failsafe::FALLBACK_CALCULATION_PRECISION);
|
45 |
+
break;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
//Do not update zero tax rates
|
50 |
+
if($taxRate <= $decPrecision){
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
$countryId = $mageQuoteAddress->getCountryId();
|
55 |
+
$regionId = $mageQuoteAddress->getRegionId();
|
56 |
+
$postcode = $mageQuoteAddress->getPostcode(); //$postcode = preg_replace('/[^0-9\-]*/', '', $address->getPostcode()); //US zip code clean up
|
57 |
+
$failsafeCalRate = Mage::getModel('speedtax/failsafe_calculation_rate');
|
58 |
+
$failsafeCalRate->loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode);
|
59 |
+
|
60 |
+
if($failsafeCalRate->getTaxRate() != $taxRate){
|
61 |
+
$failsafeCalRate->setData(array(
|
62 |
+
'country_id' => $countryId,
|
63 |
+
'region_id' => $regionId,
|
64 |
+
'postcode' => $postcode,
|
65 |
+
'tax_rate' => $taxRate
|
66 |
+
));
|
67 |
+
$failsafeCalRate->save();
|
68 |
+
}
|
69 |
+
|
70 |
+
return null;
|
71 |
+
}
|
72 |
+
|
73 |
}
|
app/code/community/Harapartners/SpeedTax/Helper/Processor.php
CHANGED
@@ -1,241 +1,241 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.harapartners.com/license [^]
|
9 |
-
* If you did not receive a copy of the license and are unable to
|
10 |
-
* obtain it through the world-wide-web, please send an email
|
11 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
|
15 |
-
class Harapartners_SpeedTax_Helper_Processor extends Mage_Core_Helper_Abstract {
|
16 |
-
|
17 |
-
const SPEEDTAX_INVOICE_STATUS_PENDING = 0;
|
18 |
-
const SPEEDTAX_INVOICE_STATUS_POSTED = 100;
|
19 |
-
const SPEEDTAX_INVOICE_STATUS_VOID = 200;
|
20 |
-
const SPEEDTAX_INVOICE_STATUS_ERROR = 300;
|
21 |
-
const SPEEDTAX_INVOICE_STATUS_FAILSAFE = 900;
|
22 |
-
|
23 |
-
// ========================== Actions ========================== //
|
24 |
-
public function queryQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
25 |
-
if (!$this->_isTaxable($mageQuoteAddress)){
|
26 |
-
$this->_clearQuoteAddressTax($mageQuoteAddress);
|
27 |
-
return false;
|
28 |
-
}
|
29 |
-
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageQuoteAddress($mageQuoteAddress);
|
30 |
-
if(!$sptxInvoice|| !$sptxInvoice->lineItems){
|
31 |
-
$this->_clearQuoteAddressTax($mageQuoteAddress);
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
$responseResult = Mage::helper('speedtax/connector_speedtax')->calculateInvoiceRequest($sptxInvoice);
|
35 |
-
$this->_applyResponseToQuote($responseResult, $mageQuoteAddress);
|
36 |
-
return $responseResult;
|
37 |
-
}
|
38 |
-
|
39 |
-
public function postOrderInvoice(Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
|
40 |
-
if(!!$mageOrderInvoice->getData('speedtax_transaction_id')){
|
41 |
-
Mage::throwException('This invoice was already posted through SalesTax.');
|
42 |
-
}
|
43 |
-
|
44 |
-
$customerGroupId = $mageOrderInvoice->getOrder()->getCustomerGroupId();
|
45 |
-
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
|
49 |
-
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderInvoice($mageOrderInvoice);
|
50 |
-
if(!$sptxInvoice || !$sptxInvoice->lineItems){
|
51 |
-
return false;
|
52 |
-
}
|
53 |
-
//No caching allowed for order invoice
|
54 |
-
$responseResult = Mage::helper('speedtax/connector_speedtax')->postInvoiceRequest($sptxInvoice);
|
55 |
-
$this->_applyResponseToInvoice($responseResult, $mageOrderInvoice);
|
56 |
-
|
57 |
-
return $responseResult;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function postOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo) {
|
61 |
-
if(!!$mageOrderCreditmemo->getData('speedtax_transaction_id')){
|
62 |
-
Mage::throwException('This credit memo was already posted through SalesTax.');
|
63 |
-
}
|
64 |
-
|
65 |
-
$customerGroupId = $mageOrderCreditmemo->getOrder()->getCustomerGroupId();
|
66 |
-
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderCreditmemo($mageOrderCreditmemo);
|
71 |
-
if(!$sptxInvoice || !$sptxInvoice->lineItems){
|
72 |
-
return false;
|
73 |
-
}
|
74 |
-
//No caching allowed for order invoice
|
75 |
-
$responseResult = Mage::helper('speedtax/connector_speedtax')->postCreditmemoRequest($sptxInvoice);
|
76 |
-
$this->_applyResponseToCreditmemo($responseResult, $mageOrderCreditmemo);
|
77 |
-
|
78 |
-
return $responseResult;
|
79 |
-
}
|
80 |
-
|
81 |
-
public function cancelAllOrderTransactions(Mage_Sales_Model_Order $mageOrder) {
|
82 |
-
$invoiceNumbers = array();
|
83 |
-
$updateObjectArray = array();
|
84 |
-
foreach($mageOrder->getInvoiceCollection() as $mageOrderInvoice){
|
85 |
-
if(!!$mageOrderInvoice->getData('speedtax_invoice_number')
|
86 |
-
&& $mageOrderInvoice->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
|
87 |
-
$invoiceNumbers[] = $mageOrderInvoice->getData('speedtax_invoice_number');
|
88 |
-
$updateObjectArray[$mageOrderInvoice->getData('speedtax_invoice_number')] = $mageOrderInvoice;
|
89 |
-
}
|
90 |
-
}
|
91 |
-
foreach($mageOrder->getCreditmemosCollection() as $mageOrderCreditmemo){
|
92 |
-
if(!!$mageOrderCreditmemo->getData('speedtax_invoice_number')
|
93 |
-
&& $mageOrderCreditmemo->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
|
94 |
-
$invoiceNumbers[] = $mageOrderCreditmemo->getData('speedtax_invoice_number');
|
95 |
-
$updateObjectArray[$mageOrderCreditmemo->getData('speedtax_invoice_number')] = $mageOrderCreditmemo;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
if(!$invoiceNumbers){
|
100 |
-
return false;
|
101 |
-
}
|
102 |
-
//No caching allowed for order invoice
|
103 |
-
$responseResult = Mage::helper('speedtax/connector_speedtax')->batchVoidInvoices($invoiceNumbers);
|
104 |
-
|
105 |
-
//Update status
|
106 |
-
$batchVoidResults = json_decode($responseResult->data->result->batchVoidResults, 1);
|
107 |
-
foreach($batchVoidResults as $invoiceNumber => $voidResult){
|
108 |
-
$updateObject = $updateObjectArray[$invoiceNumber];
|
109 |
-
if($voidResult == Harapartners_SpeedTax_Helper_Connector_Speedtax::RESPONSE_TYPE_SUCCESS){
|
110 |
-
$updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_VOID);
|
111 |
-
}else{
|
112 |
-
$updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_ERROR);
|
113 |
-
}
|
114 |
-
$updateObject->save();
|
115 |
-
}
|
116 |
-
|
117 |
-
return $responseResult;
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
// ========================== Utility Functions ========================== //
|
122 |
-
//Mage_Sales_Model_Quote_Address or Mage_Sales_Model_Order_Address
|
123 |
-
protected function _isTaxable($mageAddress) {
|
124 |
-
//$mageAddress can be quote of order address, or null for virtual product
|
125 |
-
//Note: only check shipping to avoid double tax calculation
|
126 |
-
if(!($mageAddress instanceof Varien_Object)
|
127 |
-
|| $mageAddress->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
|
128 |
-
){
|
129 |
-
return false;
|
130 |
-
}
|
131 |
-
|
132 |
-
//Check tax exempt customer group
|
133 |
-
//Only for quote, order/inovice will always reports the amount the tax captured
|
134 |
-
if($mageAddress instanceof Mage_Sales_Model_Quote_Address && !!$mageAddress->getQuote()){
|
135 |
-
//Note, 0 for guest group
|
136 |
-
$customerGroupId = $mageAddress->getQuote()->getCustomerGroupId();
|
137 |
-
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
138 |
-
return false;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
//Nexus test
|
143 |
-
//We need to test for exceptions where billing address is used for calculation
|
144 |
-
//Note this is after the address type test to avoid double tax calculation
|
145 |
-
$mappedAddress = Mage::helper('speedtax/connector_data')->mapAddressExceptions($mageAddress);
|
146 |
-
$originsString = Mage::getStoreConfig('speedtax/speedtax/origins');
|
147 |
-
if(!in_array($mappedAddress->getRegionId(), explode(',', $originsString))){
|
148 |
-
return false;
|
149 |
-
}
|
150 |
-
|
151 |
-
//By default, calculation tax
|
152 |
-
return true;
|
153 |
-
}
|
154 |
-
|
155 |
-
protected function _isCustomerGroupTaxExempt($customerGroupId) {
|
156 |
-
$taxExemptCustomerGroupString = Mage::getStoreConfig('speedtax/speedtax/tax_exempt_customer_group');
|
157 |
-
return in_array($customerGroupId, explode(',', $taxExemptCustomerGroupString));
|
158 |
-
}
|
159 |
-
|
160 |
-
//Mage_Sales_Model_Quote_Address ONLY
|
161 |
-
protected function _applyResponseToQuote($responseResult, Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
162 |
-
foreach ( $mageQuoteAddress->getAllItems() as $mageQuoteItem ) {
|
163 |
-
$taxAmount = $this->_getLineItemTaxAmountByItemId($responseResult, $mageQuoteItem->getId());
|
164 |
-
$mageQuoteItem->setTaxAmount($taxAmount);
|
165 |
-
$mageQuoteItem->setBaseTaxAmount($taxAmount);
|
166 |
-
if(($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount()) > 0){
|
167 |
-
$mageQuoteItem->setTaxPercent (sprintf("%.4f", 100*$taxAmount/($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount())));
|
168 |
-
}
|
169 |
-
}
|
170 |
-
$taxShippingAmount = $this->_getTaxShippingAmount($responseResult);
|
171 |
-
if(!!$taxShippingAmount){
|
172 |
-
$mageQuoteAddress->setShippingTaxAmount($taxShippingAmount);
|
173 |
-
$mageQuoteAddress->setBaseShippingTaxAmount($taxShippingAmount);
|
174 |
-
}
|
175 |
-
return;
|
176 |
-
}
|
177 |
-
|
178 |
-
protected function _clearQuoteAddressTax(Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
179 |
-
//Only clear tax related to this quote address
|
180 |
-
foreach ( $mageQuoteAddress->getAllItems() as $mageQuoteItem ) {
|
181 |
-
$mageQuoteItem->setTaxAmount(0.0);
|
182 |
-
$mageQuoteItem->setBaseTaxAmount(0.0);
|
183 |
-
$mageQuoteItem->setTaxPercent(0.0);
|
184 |
-
}
|
185 |
-
$mageQuoteAddress->setShippingTaxAmount(0.0);
|
186 |
-
$mageQuoteAddress->setBaseShippingTaxAmount(0.0);
|
187 |
-
return;
|
188 |
-
}
|
189 |
-
|
190 |
-
protected function _applyResponseToInvoice($responseResult, Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
|
191 |
-
$mageOrderInvoice->setData('speedtax_transaction_id', $responseResult->transactionId);
|
192 |
-
$mageOrderInvoice->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
|
193 |
-
$mageOrderInvoice->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
|
194 |
-
$mageOrderInvoice->save();
|
195 |
-
return;
|
196 |
-
}
|
197 |
-
|
198 |
-
protected function _applyResponseToCreditmemo($responseResult, Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo){
|
199 |
-
$mageOrderCreditmemo->setData('speedtax_transaction_id', $responseResult->transactionId);
|
200 |
-
$mageOrderCreditmemo->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
|
201 |
-
$mageOrderCreditmemo->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
|
202 |
-
$mageOrderCreditmemo->save();
|
203 |
-
return;
|
204 |
-
}
|
205 |
-
|
206 |
-
public function getTotalTax($responseResult) {
|
207 |
-
return $responseResult->totalTax->decimalValue;
|
208 |
-
}
|
209 |
-
|
210 |
-
protected function _getLineItemTaxAmountByItemId($responseResult, $itemId) {
|
211 |
-
foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
|
212 |
-
if($responseLineItem->customReference == $itemId){
|
213 |
-
return $responseLineItem->taxAmount->decimalValue;
|
214 |
-
}
|
215 |
-
}
|
216 |
-
return 0.0;
|
217 |
-
}
|
218 |
-
|
219 |
-
protected function _getTaxShippingAmount($responseResult) {
|
220 |
-
if(isset($responseResult->lineItemBundles->lineItems)){
|
221 |
-
foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
|
222 |
-
if($responseLineItem->productCode == Mage::getStoreConfig("speedtax/speedtax/shipping_tax_code")){
|
223 |
-
return $responseLineItem->taxAmount->decimalValue;
|
224 |
-
}
|
225 |
-
}
|
226 |
-
}
|
227 |
-
return 0.0;
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
//Adds a comment to order history. Method choosen based on Magento version.
|
232 |
-
// protected function _addStatusHistoryComment($order, $comment) {
|
233 |
-
// if(method_exists($order, 'addStatusHistoryComment')) {
|
234 |
-
// $order->addStatusHistoryComment($comment)->save();;
|
235 |
-
// } elseif(method_exists($order, 'addStatusToHistory')) {
|
236 |
-
// $order->addStatusToHistory($order->getStatus(), $comment, false)->save();;
|
237 |
-
// }
|
238 |
-
// return $this;
|
239 |
-
// }
|
240 |
-
|
241 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.harapartners.com/license [^]
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Harapartners_SpeedTax_Helper_Processor extends Mage_Core_Helper_Abstract {
|
16 |
+
|
17 |
+
const SPEEDTAX_INVOICE_STATUS_PENDING = 0;
|
18 |
+
const SPEEDTAX_INVOICE_STATUS_POSTED = 100;
|
19 |
+
const SPEEDTAX_INVOICE_STATUS_VOID = 200;
|
20 |
+
const SPEEDTAX_INVOICE_STATUS_ERROR = 300;
|
21 |
+
const SPEEDTAX_INVOICE_STATUS_FAILSAFE = 900;
|
22 |
+
|
23 |
+
// ========================== Actions ========================== //
|
24 |
+
public function queryQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
25 |
+
if (!$this->_isTaxable($mageQuoteAddress)){
|
26 |
+
$this->_clearQuoteAddressTax($mageQuoteAddress);
|
27 |
+
return false;
|
28 |
+
}
|
29 |
+
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageQuoteAddress($mageQuoteAddress);
|
30 |
+
if(!$sptxInvoice|| !$sptxInvoice->lineItems){
|
31 |
+
$this->_clearQuoteAddressTax($mageQuoteAddress);
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
$responseResult = Mage::helper('speedtax/connector_speedtax')->calculateInvoiceRequest($sptxInvoice);
|
35 |
+
$this->_applyResponseToQuote($responseResult, $mageQuoteAddress);
|
36 |
+
return $responseResult;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function postOrderInvoice(Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
|
40 |
+
if(!!$mageOrderInvoice->getData('speedtax_transaction_id')){
|
41 |
+
Mage::throwException('This invoice was already posted through SalesTax.');
|
42 |
+
}
|
43 |
+
|
44 |
+
$customerGroupId = $mageOrderInvoice->getOrder()->getCustomerGroupId();
|
45 |
+
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderInvoice($mageOrderInvoice);
|
50 |
+
if(!$sptxInvoice || !$sptxInvoice->lineItems){
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
//No caching allowed for order invoice
|
54 |
+
$responseResult = Mage::helper('speedtax/connector_speedtax')->postInvoiceRequest($sptxInvoice);
|
55 |
+
$this->_applyResponseToInvoice($responseResult, $mageOrderInvoice);
|
56 |
+
|
57 |
+
return $responseResult;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function postOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo) {
|
61 |
+
if(!!$mageOrderCreditmemo->getData('speedtax_transaction_id')){
|
62 |
+
Mage::throwException('This credit memo was already posted through SalesTax.');
|
63 |
+
}
|
64 |
+
|
65 |
+
$customerGroupId = $mageOrderCreditmemo->getOrder()->getCustomerGroupId();
|
66 |
+
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
$sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderCreditmemo($mageOrderCreditmemo);
|
71 |
+
if(!$sptxInvoice || !$sptxInvoice->lineItems){
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
//No caching allowed for order invoice
|
75 |
+
$responseResult = Mage::helper('speedtax/connector_speedtax')->postCreditmemoRequest($sptxInvoice);
|
76 |
+
$this->_applyResponseToCreditmemo($responseResult, $mageOrderCreditmemo);
|
77 |
+
|
78 |
+
return $responseResult;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function cancelAllOrderTransactions(Mage_Sales_Model_Order $mageOrder) {
|
82 |
+
$invoiceNumbers = array();
|
83 |
+
$updateObjectArray = array();
|
84 |
+
foreach($mageOrder->getInvoiceCollection() as $mageOrderInvoice){
|
85 |
+
if(!!$mageOrderInvoice->getData('speedtax_invoice_number')
|
86 |
+
&& $mageOrderInvoice->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
|
87 |
+
$invoiceNumbers[] = $mageOrderInvoice->getData('speedtax_invoice_number');
|
88 |
+
$updateObjectArray[$mageOrderInvoice->getData('speedtax_invoice_number')] = $mageOrderInvoice;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
foreach($mageOrder->getCreditmemosCollection() as $mageOrderCreditmemo){
|
92 |
+
if(!!$mageOrderCreditmemo->getData('speedtax_invoice_number')
|
93 |
+
&& $mageOrderCreditmemo->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
|
94 |
+
$invoiceNumbers[] = $mageOrderCreditmemo->getData('speedtax_invoice_number');
|
95 |
+
$updateObjectArray[$mageOrderCreditmemo->getData('speedtax_invoice_number')] = $mageOrderCreditmemo;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
if(!$invoiceNumbers){
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
//No caching allowed for order invoice
|
103 |
+
$responseResult = Mage::helper('speedtax/connector_speedtax')->batchVoidInvoices($invoiceNumbers);
|
104 |
+
|
105 |
+
//Update status
|
106 |
+
$batchVoidResults = json_decode($responseResult->data->result->batchVoidResults, 1);
|
107 |
+
foreach($batchVoidResults as $invoiceNumber => $voidResult){
|
108 |
+
$updateObject = $updateObjectArray[$invoiceNumber];
|
109 |
+
if($voidResult == Harapartners_SpeedTax_Helper_Connector_Speedtax::RESPONSE_TYPE_SUCCESS){
|
110 |
+
$updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_VOID);
|
111 |
+
}else{
|
112 |
+
$updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_ERROR);
|
113 |
+
}
|
114 |
+
$updateObject->save();
|
115 |
+
}
|
116 |
+
|
117 |
+
return $responseResult;
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
// ========================== Utility Functions ========================== //
|
122 |
+
//Mage_Sales_Model_Quote_Address or Mage_Sales_Model_Order_Address
|
123 |
+
protected function _isTaxable($mageAddress) {
|
124 |
+
//$mageAddress can be quote of order address, or null for virtual product
|
125 |
+
//Note: only check shipping to avoid double tax calculation
|
126 |
+
if(!($mageAddress instanceof Varien_Object)
|
127 |
+
|| $mageAddress->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
|
128 |
+
){
|
129 |
+
return false;
|
130 |
+
}
|
131 |
+
|
132 |
+
//Check tax exempt customer group
|
133 |
+
//Only for quote, order/inovice will always reports the amount the tax captured
|
134 |
+
if($mageAddress instanceof Mage_Sales_Model_Quote_Address && !!$mageAddress->getQuote()){
|
135 |
+
//Note, 0 for guest group
|
136 |
+
$customerGroupId = $mageAddress->getQuote()->getCustomerGroupId();
|
137 |
+
if($this->_isCustomerGroupTaxExempt($customerGroupId)){
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
//Nexus test
|
143 |
+
//We need to test for exceptions where billing address is used for calculation
|
144 |
+
//Note this is after the address type test to avoid double tax calculation
|
145 |
+
$mappedAddress = Mage::helper('speedtax/connector_data')->mapAddressExceptions($mageAddress);
|
146 |
+
$originsString = Mage::getStoreConfig('speedtax/speedtax/origins');
|
147 |
+
if(!in_array($mappedAddress->getRegionId(), explode(',', $originsString))){
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
//By default, calculation tax
|
152 |
+
return true;
|
153 |
+
}
|
154 |
+
|
155 |
+
protected function _isCustomerGroupTaxExempt($customerGroupId) {
|
156 |
+
$taxExemptCustomerGroupString = Mage::getStoreConfig('speedtax/speedtax/tax_exempt_customer_group');
|
157 |
+
return in_array($customerGroupId, explode(',', $taxExemptCustomerGroupString));
|
158 |
+
}
|
159 |
+
|
160 |
+
//Mage_Sales_Model_Quote_Address ONLY
|
161 |
+
protected function _applyResponseToQuote($responseResult, Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
162 |
+
foreach ( $mageQuoteAddress->getAllItems() as $mageQuoteItem ) {
|
163 |
+
$taxAmount = $this->_getLineItemTaxAmountByItemId($responseResult, $mageQuoteItem->getId());
|
164 |
+
$mageQuoteItem->setTaxAmount($taxAmount);
|
165 |
+
$mageQuoteItem->setBaseTaxAmount($taxAmount);
|
166 |
+
if(($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount()) > 0){
|
167 |
+
$mageQuoteItem->setTaxPercent (sprintf("%.4f", 100*$taxAmount/($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount())));
|
168 |
+
}
|
169 |
+
}
|
170 |
+
$taxShippingAmount = $this->_getTaxShippingAmount($responseResult);
|
171 |
+
if(!!$taxShippingAmount){
|
172 |
+
$mageQuoteAddress->setShippingTaxAmount($taxShippingAmount);
|
173 |
+
$mageQuoteAddress->setBaseShippingTaxAmount($taxShippingAmount);
|
174 |
+
}
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
protected function _clearQuoteAddressTax(Mage_Sales_Model_Quote_Address $mageQuoteAddress){
|
179 |
+
//Only clear tax related to this quote address
|
180 |
+
foreach ( $mageQuoteAddress->getAllItems() as $mageQuoteItem ) {
|
181 |
+
$mageQuoteItem->setTaxAmount(0.0);
|
182 |
+
$mageQuoteItem->setBaseTaxAmount(0.0);
|
183 |
+
$mageQuoteItem->setTaxPercent(0.0);
|
184 |
+
}
|
185 |
+
$mageQuoteAddress->setShippingTaxAmount(0.0);
|
186 |
+
$mageQuoteAddress->setBaseShippingTaxAmount(0.0);
|
187 |
+
return;
|
188 |
+
}
|
189 |
+
|
190 |
+
protected function _applyResponseToInvoice($responseResult, Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
|
191 |
+
$mageOrderInvoice->setData('speedtax_transaction_id', $responseResult->transactionId);
|
192 |
+
$mageOrderInvoice->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
|
193 |
+
$mageOrderInvoice->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
|
194 |
+
$mageOrderInvoice->save();
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
|
198 |
+
protected function _applyResponseToCreditmemo($responseResult, Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo){
|
199 |
+
$mageOrderCreditmemo->setData('speedtax_transaction_id', $responseResult->transactionId);
|
200 |
+
$mageOrderCreditmemo->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
|
201 |
+
$mageOrderCreditmemo->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
|
202 |
+
$mageOrderCreditmemo->save();
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
|
206 |
+
public function getTotalTax($responseResult) {
|
207 |
+
return $responseResult->totalTax->decimalValue;
|
208 |
+
}
|
209 |
+
|
210 |
+
protected function _getLineItemTaxAmountByItemId($responseResult, $itemId) {
|
211 |
+
foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
|
212 |
+
if($responseLineItem->customReference == $itemId){
|
213 |
+
return $responseLineItem->taxAmount->decimalValue;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
return 0.0;
|
217 |
+
}
|
218 |
+
|
219 |
+
protected function _getTaxShippingAmount($responseResult) {
|
220 |
+
if(isset($responseResult->lineItemBundles->lineItems)){
|
221 |
+
foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
|
222 |
+
if($responseLineItem->productCode == Mage::getStoreConfig("speedtax/speedtax/shipping_tax_code")){
|
223 |
+
return $responseLineItem->taxAmount->decimalValue;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
return 0.0;
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
//Adds a comment to order history. Method choosen based on Magento version.
|
232 |
+
// protected function _addStatusHistoryComment($order, $comment) {
|
233 |
+
// if(method_exists($order, 'addStatusHistoryComment')) {
|
234 |
+
// $order->addStatusHistoryComment($comment)->save();;
|
235 |
+
// } elseif(method_exists($order, 'addStatusToHistory')) {
|
236 |
+
// $order->addStatusToHistory($order->getStatus(), $comment, false)->save();;
|
237 |
+
// }
|
238 |
+
// return $this;
|
239 |
+
// }
|
240 |
+
|
241 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Failsafe/Calculation.php
CHANGED
@@ -1,42 +1,42 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Model_Failsafe_Calculation extends Mage_Tax_Model_Calculation {
|
14 |
-
|
15 |
-
public function getRate($request)
|
16 |
-
{
|
17 |
-
if (!$request->getCountryId() || !$request->getRegionId() || !$request->getPostcode()) {
|
18 |
-
return 0;
|
19 |
-
}
|
20 |
-
|
21 |
-
//Ignore default non-taxable goods, product_class_id = 0 or missing
|
22 |
-
if(!$request->getData('product_class_id')){
|
23 |
-
return 0.0;
|
24 |
-
}
|
25 |
-
|
26 |
-
$failsafeCalRate = Mage::getModel('speedtax/failsafe_calculation_rate');
|
27 |
-
// Level 1: exact match
|
28 |
-
$failsafeCalRate->loadByCountryIdRegionIdPostcode($request->getCountryId(), $request->getRegionId(), $request->getPostcode());
|
29 |
-
if(!!$failsafeCalRate->getId() && !!$failsafeCalRate->getTaxRate()){
|
30 |
-
return $failsafeCalRate->getTaxRate();
|
31 |
-
}
|
32 |
-
// Level 2: partial match
|
33 |
-
$failsafeCalRate->loadByCountryIdRegionId($request->getCountryId(), $request->getRegionId());
|
34 |
-
if(!!$failsafeCalRate->getId() && !!$failsafeCalRate->getTaxRate()){
|
35 |
-
return $failsafeCalRate->getTaxRate();
|
36 |
-
}
|
37 |
-
|
38 |
-
// Default
|
39 |
-
return 0.0;
|
40 |
-
}
|
41 |
-
|
42 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Model_Failsafe_Calculation extends Mage_Tax_Model_Calculation {
|
14 |
+
|
15 |
+
public function getRate($request)
|
16 |
+
{
|
17 |
+
if (!$request->getCountryId() || !$request->getRegionId() || !$request->getPostcode()) {
|
18 |
+
return 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
//Ignore default non-taxable goods, product_class_id = 0 or missing
|
22 |
+
if(!$request->getData('product_class_id')){
|
23 |
+
return 0.0;
|
24 |
+
}
|
25 |
+
|
26 |
+
$failsafeCalRate = Mage::getModel('speedtax/failsafe_calculation_rate');
|
27 |
+
// Level 1: exact match
|
28 |
+
$failsafeCalRate->loadByCountryIdRegionIdPostcode($request->getCountryId(), $request->getRegionId(), $request->getPostcode());
|
29 |
+
if(!!$failsafeCalRate->getId() && !!$failsafeCalRate->getTaxRate()){
|
30 |
+
return $failsafeCalRate->getTaxRate();
|
31 |
+
}
|
32 |
+
// Level 2: partial match
|
33 |
+
$failsafeCalRate->loadByCountryIdRegionId($request->getCountryId(), $request->getRegionId());
|
34 |
+
if(!!$failsafeCalRate->getId() && !!$failsafeCalRate->getTaxRate()){
|
35 |
+
return $failsafeCalRate->getTaxRate();
|
36 |
+
}
|
37 |
+
|
38 |
+
// Default
|
39 |
+
return 0.0;
|
40 |
+
}
|
41 |
+
|
42 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Failsafe/Calculation/Rate.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Harapartners_SpeedTax_Model_Failsafe_Calculation_Rate extends Mage_Core_Model_Abstract {
|
15 |
-
|
16 |
-
protected function _construct() {
|
17 |
-
$this->_init('speedtax/failsafe_calculation_rate');
|
18 |
-
}
|
19 |
-
|
20 |
-
public function loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode){
|
21 |
-
$this->addData($this->getResource()->loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode));
|
22 |
-
return $this;
|
23 |
-
}
|
24 |
-
|
25 |
-
public function loadByCountryIdRegionId($countryId, $regionId){
|
26 |
-
$this->addData($this->getResource()->loadByCountryIdRegionId($countryId, $regionId));
|
27 |
-
return $this;
|
28 |
-
}
|
29 |
-
|
30 |
-
protected function _beforeSave(){
|
31 |
-
$datetime = date('Y-m-d H:i:s');
|
32 |
-
if(!$this->getId()){
|
33 |
-
$this->setData('created_at', $datetime);
|
34 |
-
}
|
35 |
-
$this->setData('updated_at', $datetime);
|
36 |
-
parent::_beforeSave();
|
37 |
-
}
|
38 |
-
|
39 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Harapartners_SpeedTax_Model_Failsafe_Calculation_Rate extends Mage_Core_Model_Abstract {
|
15 |
+
|
16 |
+
protected function _construct() {
|
17 |
+
$this->_init('speedtax/failsafe_calculation_rate');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode){
|
21 |
+
$this->addData($this->getResource()->loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode));
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function loadByCountryIdRegionId($countryId, $regionId){
|
26 |
+
$this->addData($this->getResource()->loadByCountryIdRegionId($countryId, $regionId));
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _beforeSave(){
|
31 |
+
$datetime = date('Y-m-d H:i:s');
|
32 |
+
if(!$this->getId()){
|
33 |
+
$this->setData('created_at', $datetime);
|
34 |
+
}
|
35 |
+
$this->setData('updated_at', $datetime);
|
36 |
+
parent::_beforeSave();
|
37 |
+
}
|
38 |
+
|
39 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Failsafe/Sales/Total/Quote/Tax.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Model_Failsafe_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
14 |
-
|
15 |
-
public function __construct(){
|
16 |
-
parent::__construct();
|
17 |
-
$this->_calculator = Mage::getSingleton('speedtax/failsafe_calculation');
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest){
|
21 |
-
if(!Mage::getStoreConfig("speedtax/speedtax/is_tax_shipping")){
|
22 |
-
return $this;
|
23 |
-
}
|
24 |
-
return parent::_calculateShippingTax($address, $taxRateRequest);
|
25 |
-
}
|
26 |
-
|
27 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Model_Failsafe_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
14 |
+
|
15 |
+
public function __construct(){
|
16 |
+
parent::__construct();
|
17 |
+
$this->_calculator = Mage::getSingleton('speedtax/failsafe_calculation');
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest){
|
21 |
+
if(!Mage::getStoreConfig("speedtax/speedtax/is_tax_shipping")){
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
return parent::_calculateShippingTax($address, $taxRateRequest);
|
25 |
+
}
|
26 |
+
|
27 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Observer.php
CHANGED
@@ -1,168 +1,168 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.harapartners.com/license [^]
|
9 |
-
* If you did not receive a copy of the license and are unable to
|
10 |
-
* obtain it through the world-wide-web, please send an email
|
11 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
|
15 |
-
class Harapartners_SpeedTax_Model_Observer extends Mage_Core_Model_Abstract {
|
16 |
-
|
17 |
-
// ============================== Checkout process, failsafe calculation can be enabled ============================== //
|
18 |
-
public function saleOrderSaveBefore(Varien_Event_Observer $observer) {
|
19 |
-
//Flag orders with speedtax failsafe calculation
|
20 |
-
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
$order = $observer->getEvent()->getOrder();
|
24 |
-
if (Mage::helper('speedtax')->isFailsafeEnabled()){
|
25 |
-
if(Mage::registry('is_speedtax_failsafe_calculation')){
|
26 |
-
$order->setData('is_speedtax_failsafe_calculation', 1);
|
27 |
-
Mage::unregister('is_speedtax_failsafe_calculation');
|
28 |
-
}
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
// ============================== Post invoices to SpeedTax (failsafe can be enabled) ============================== //
|
33 |
-
public function saleOrderInvoicePay(Varien_Event_Observer $observer) {
|
34 |
-
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
35 |
-
return;
|
36 |
-
}
|
37 |
-
$invoice = $observer->getEvent()->getInvoice();
|
38 |
-
if (Mage::helper('speedtax')->isFailsafeEnabled()){
|
39 |
-
if(!!$invoice->getOrder()){
|
40 |
-
$invoice->setData('is_speedtax_failsafe_calculation', $invoice->getOrder()->getData('is_speedtax_failsafe_calculation'));
|
41 |
-
}
|
42 |
-
}
|
43 |
-
try {
|
44 |
-
$processor = Mage::helper('speedtax/processor');
|
45 |
-
$responseResult = $processor->postOrderInvoice($invoice);
|
46 |
-
if(isset($responseResult->totalTax->decimalValue)){
|
47 |
-
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
48 |
-
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
49 |
-
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
50 |
-
}
|
51 |
-
} catch( Exception $e ) {
|
52 |
-
//Suppress exception so that the transaction is not reverted (payment already processed)
|
53 |
-
//Mage::logException($e);
|
54 |
-
Mage::log("Cannot post order invoice: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
55 |
-
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
56 |
-
//Failsafe logic: mark invoice for "post invoice failsafe"
|
57 |
-
$invoice->setData('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
58 |
-
}else{
|
59 |
-
$maskedErrorMessage = 'There is an error processing tax information.';
|
60 |
-
if (Mage::app()->getStore()->isAdmin()) {
|
61 |
-
Mage::getSingleton('adminhtml/session')->addError($maskedErrorMessage);
|
62 |
-
}else{
|
63 |
-
Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
// ============================== Cancel invoices in SpeedTax ============================== //
|
70 |
-
public function salesOrderCreditmemoRefund(Varien_Event_Observer $observer) {
|
71 |
-
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
72 |
-
return;
|
73 |
-
}
|
74 |
-
$creditmemo = $observer->getEvent()->getCreditmemo();
|
75 |
-
try {
|
76 |
-
$processor = Mage::helper('speedtax/processor');
|
77 |
-
$responseResult = $processor->postOrderCreditmemo($creditmemo);
|
78 |
-
} catch( Exception $e ) {
|
79 |
-
//Suppress exception so that the transaction is not reverted (payment already processed)
|
80 |
-
//Mage::logException($e);
|
81 |
-
Mage::log("Cannot post order credit memo: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
82 |
-
$maskedErrorMessage = 'There is an error processing tax information for order credit memo.';
|
83 |
-
|
84 |
-
//This is backend only activity, do NOT suppress exceptions
|
85 |
-
//Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
86 |
-
Mage::throwException($maskedErrorMessage);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
//Upon order cancel/edit, credit memo must be created manually for existing invoices, SpeedTax invoices will NOT be voided
|
91 |
-
public function orderCancelAfter(Varien_Event_Observer $observer) {
|
92 |
-
return;
|
93 |
-
// if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
94 |
-
// return;
|
95 |
-
// }
|
96 |
-
// $order = $observer->getEvent()->getOrder();
|
97 |
-
// try {
|
98 |
-
// $processor = Mage::helper('speedtax/processor');
|
99 |
-
// $responseResult = $processor->cancelAllOrderTransactions($order);
|
100 |
-
// } catch( Exception $e ) {
|
101 |
-
// //Suppress exception so that the transaction is not reverted (payment already processed)
|
102 |
-
// //Mage::logException($e);
|
103 |
-
// Mage::log("Cannot cancel all order transactions: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
104 |
-
// $maskedErrorMessage = 'There is an error processing tax information for all order transactions.';
|
105 |
-
//
|
106 |
-
// //This is backend only activity, do NOT suppress exceptions
|
107 |
-
// //Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
108 |
-
// Mage::throwException($maskedErrorMessage);
|
109 |
-
// }
|
110 |
-
}
|
111 |
-
|
112 |
-
// ============================================================================================ //
|
113 |
-
// ---------------------------------------- Admin only ---------------------------------------- //
|
114 |
-
/**
|
115 |
-
* Prepare important admin panel messages, set data in session
|
116 |
-
*
|
117 |
-
* @param Varien_Event_Observer $observer
|
118 |
-
*/
|
119 |
-
public function adminhtmlOnlyLayoutGenerateBlocksAfter(Varien_Event_Observer $observer){
|
120 |
-
$controllerAction = $observer->getEvent()->getData('action');
|
121 |
-
$layout = $observer->getEvent()->getData('layout');
|
122 |
-
|
123 |
-
//Only add message for administrator who already logged in
|
124 |
-
if(!!Mage::getSingleton('admin/session')->getUser() && !!Mage::getSingleton('admin/session')->getUser()->getId()){
|
125 |
-
$notificationsBlock = $layout->getBlock('notifications');
|
126 |
-
if(!!$notificationsBlock && !!($notificationsBlock instanceof Mage_Core_Block_Abstract)){
|
127 |
-
$nsNotificationBlock = $layout->createBlock('speedtax/adminhtml_notification');
|
128 |
-
$notificationsBlock->append($nsNotificationBlock, 'speedtax_notification');
|
129 |
-
}
|
130 |
-
}
|
131 |
-
return;
|
132 |
-
}
|
133 |
-
|
134 |
-
// ============================================================================================ //
|
135 |
-
// ---------------------------------------- CRON jobs ---------------------------------------- //
|
136 |
-
public function batchPostFailsafeInvoice(){
|
137 |
-
if(!Mage::getStoreConfig ( 'speedtax/failsafe/is_auto_post_failsafe_invoice' )){
|
138 |
-
return;
|
139 |
-
}
|
140 |
-
$sptxProcessor = Mage::helper('speedtax/processor');
|
141 |
-
$invoicCollection = Mage::getModel('sales/order_invoice')->getCollection();
|
142 |
-
$invoicCollection->addAttributeToFilter('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
143 |
-
$invoicCollection->setPageSize(Harapartners_SpeedTax_Helper_Data::DEFAULT_MAGENTO_COLLECTION_PAGE_SIZE);
|
144 |
-
$currentPage = 1;
|
145 |
-
$totalNumPages = $invoicCollection->getLastPageNumber();
|
146 |
-
do {
|
147 |
-
$invoicCollection->setCurPage($currentPage);
|
148 |
-
foreach ($invoicCollection as $invoice) {
|
149 |
-
try{
|
150 |
-
$responseResult = $sptxProcessor->postOrderInvoice($invoice);
|
151 |
-
if(isset($responseResult->totalTax->decimalValue)){
|
152 |
-
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
153 |
-
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
154 |
-
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
155 |
-
$invoice->save();
|
156 |
-
}
|
157 |
-
}catch (Exception $ex){
|
158 |
-
//Suppress errors in cronjob
|
159 |
-
}
|
160 |
-
unset($invoice);
|
161 |
-
}
|
162 |
-
// Pagination Loop Control
|
163 |
-
$currentPage ++;
|
164 |
-
$invoicCollection->clear();
|
165 |
-
} while ($currentPage <= $totalNumPages);
|
166 |
-
}
|
167 |
-
|
168 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.harapartners.com/license [^]
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Harapartners_SpeedTax_Model_Observer extends Mage_Core_Model_Abstract {
|
16 |
+
|
17 |
+
// ============================== Checkout process, failsafe calculation can be enabled ============================== //
|
18 |
+
public function saleOrderSaveBefore(Varien_Event_Observer $observer) {
|
19 |
+
//Flag orders with speedtax failsafe calculation
|
20 |
+
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
$order = $observer->getEvent()->getOrder();
|
24 |
+
if (Mage::helper('speedtax')->isFailsafeEnabled()){
|
25 |
+
if(Mage::registry('is_speedtax_failsafe_calculation')){
|
26 |
+
$order->setData('is_speedtax_failsafe_calculation', 1);
|
27 |
+
Mage::unregister('is_speedtax_failsafe_calculation');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// ============================== Post invoices to SpeedTax (failsafe can be enabled) ============================== //
|
33 |
+
public function saleOrderInvoicePay(Varien_Event_Observer $observer) {
|
34 |
+
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
$invoice = $observer->getEvent()->getInvoice();
|
38 |
+
if (Mage::helper('speedtax')->isFailsafeEnabled()){
|
39 |
+
if(!!$invoice->getOrder()){
|
40 |
+
$invoice->setData('is_speedtax_failsafe_calculation', $invoice->getOrder()->getData('is_speedtax_failsafe_calculation'));
|
41 |
+
}
|
42 |
+
}
|
43 |
+
try {
|
44 |
+
$processor = Mage::helper('speedtax/processor');
|
45 |
+
$responseResult = $processor->postOrderInvoice($invoice);
|
46 |
+
if(isset($responseResult->totalTax->decimalValue)){
|
47 |
+
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
48 |
+
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
49 |
+
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
50 |
+
}
|
51 |
+
} catch( Exception $e ) {
|
52 |
+
//Suppress exception so that the transaction is not reverted (payment already processed)
|
53 |
+
//Mage::logException($e);
|
54 |
+
Mage::log("Cannot post order invoice: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
55 |
+
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
56 |
+
//Failsafe logic: mark invoice for "post invoice failsafe"
|
57 |
+
$invoice->setData('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
58 |
+
}else{
|
59 |
+
$maskedErrorMessage = 'There is an error processing tax information.';
|
60 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
61 |
+
Mage::getSingleton('adminhtml/session')->addError($maskedErrorMessage);
|
62 |
+
}else{
|
63 |
+
Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
// ============================== Cancel invoices in SpeedTax ============================== //
|
70 |
+
public function salesOrderCreditmemoRefund(Varien_Event_Observer $observer) {
|
71 |
+
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
75 |
+
try {
|
76 |
+
$processor = Mage::helper('speedtax/processor');
|
77 |
+
$responseResult = $processor->postOrderCreditmemo($creditmemo);
|
78 |
+
} catch( Exception $e ) {
|
79 |
+
//Suppress exception so that the transaction is not reverted (payment already processed)
|
80 |
+
//Mage::logException($e);
|
81 |
+
Mage::log("Cannot post order credit memo: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
82 |
+
$maskedErrorMessage = 'There is an error processing tax information for order credit memo.';
|
83 |
+
|
84 |
+
//This is backend only activity, do NOT suppress exceptions
|
85 |
+
//Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
86 |
+
Mage::throwException($maskedErrorMessage);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
//Upon order cancel/edit, credit memo must be created manually for existing invoices, SpeedTax invoices will NOT be voided
|
91 |
+
public function orderCancelAfter(Varien_Event_Observer $observer) {
|
92 |
+
return;
|
93 |
+
// if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
94 |
+
// return;
|
95 |
+
// }
|
96 |
+
// $order = $observer->getEvent()->getOrder();
|
97 |
+
// try {
|
98 |
+
// $processor = Mage::helper('speedtax/processor');
|
99 |
+
// $responseResult = $processor->cancelAllOrderTransactions($order);
|
100 |
+
// } catch( Exception $e ) {
|
101 |
+
// //Suppress exception so that the transaction is not reverted (payment already processed)
|
102 |
+
// //Mage::logException($e);
|
103 |
+
// Mage::log("Cannot cancel all order transactions: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
104 |
+
// $maskedErrorMessage = 'There is an error processing tax information for all order transactions.';
|
105 |
+
//
|
106 |
+
// //This is backend only activity, do NOT suppress exceptions
|
107 |
+
// //Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
108 |
+
// Mage::throwException($maskedErrorMessage);
|
109 |
+
// }
|
110 |
+
}
|
111 |
+
|
112 |
+
// ============================================================================================ //
|
113 |
+
// ---------------------------------------- Admin only ---------------------------------------- //
|
114 |
+
/**
|
115 |
+
* Prepare important admin panel messages, set data in session
|
116 |
+
*
|
117 |
+
* @param Varien_Event_Observer $observer
|
118 |
+
*/
|
119 |
+
public function adminhtmlOnlyLayoutGenerateBlocksAfter(Varien_Event_Observer $observer){
|
120 |
+
$controllerAction = $observer->getEvent()->getData('action');
|
121 |
+
$layout = $observer->getEvent()->getData('layout');
|
122 |
+
|
123 |
+
//Only add message for administrator who already logged in
|
124 |
+
if(!!Mage::getSingleton('admin/session')->getUser() && !!Mage::getSingleton('admin/session')->getUser()->getId()){
|
125 |
+
$notificationsBlock = $layout->getBlock('notifications');
|
126 |
+
if(!!$notificationsBlock && !!($notificationsBlock instanceof Mage_Core_Block_Abstract)){
|
127 |
+
$nsNotificationBlock = $layout->createBlock('speedtax/adminhtml_notification');
|
128 |
+
$notificationsBlock->append($nsNotificationBlock, 'speedtax_notification');
|
129 |
+
}
|
130 |
+
}
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
|
134 |
+
// ============================================================================================ //
|
135 |
+
// ---------------------------------------- CRON jobs ---------------------------------------- //
|
136 |
+
public function batchPostFailsafeInvoice(){
|
137 |
+
if(!Mage::getStoreConfig ( 'speedtax/failsafe/is_auto_post_failsafe_invoice' )){
|
138 |
+
return;
|
139 |
+
}
|
140 |
+
$sptxProcessor = Mage::helper('speedtax/processor');
|
141 |
+
$invoicCollection = Mage::getModel('sales/order_invoice')->getCollection();
|
142 |
+
$invoicCollection->addAttributeToFilter('speedtax_invoice_status', Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE);
|
143 |
+
$invoicCollection->setPageSize(Harapartners_SpeedTax_Helper_Data::DEFAULT_MAGENTO_COLLECTION_PAGE_SIZE);
|
144 |
+
$currentPage = 1;
|
145 |
+
$totalNumPages = $invoicCollection->getLastPageNumber();
|
146 |
+
do {
|
147 |
+
$invoicCollection->setCurPage($currentPage);
|
148 |
+
foreach ($invoicCollection as $invoice) {
|
149 |
+
try{
|
150 |
+
$responseResult = $sptxProcessor->postOrderInvoice($invoice);
|
151 |
+
if(isset($responseResult->totalTax->decimalValue)){
|
152 |
+
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
153 |
+
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
154 |
+
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
155 |
+
$invoice->save();
|
156 |
+
}
|
157 |
+
}catch (Exception $ex){
|
158 |
+
//Suppress errors in cronjob
|
159 |
+
}
|
160 |
+
unset($invoice);
|
161 |
+
}
|
162 |
+
// Pagination Loop Control
|
163 |
+
$currentPage ++;
|
164 |
+
$invoicCollection->clear();
|
165 |
+
} while ($currentPage <= $totalNumPages);
|
166 |
+
}
|
167 |
+
|
168 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Resource/Failsafe/Calculation/Rate.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Harapartners_SpeedTax_Model_Resource_Failsafe_Calculation_Rate extends Mage_Core_Model_Resource_Db_Abstract {
|
15 |
-
|
16 |
-
protected function _construct() {
|
17 |
-
$this->_init('speedtax/failsafe_calculation_rate', 'rate_id');
|
18 |
-
}
|
19 |
-
|
20 |
-
public function loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode){
|
21 |
-
$readAdapter = $this->_getReadAdapter();
|
22 |
-
$select = $readAdapter->select()
|
23 |
-
->from($this->getMainTable())
|
24 |
-
->where('country_id=:country_id')
|
25 |
-
->where('region_id=:region_id')
|
26 |
-
->where('postcode=:postcode');
|
27 |
-
$result = $readAdapter->fetchRow($select, array('country_id' => $countryId, 'region_id' => $regionId, 'postcode' => $postcode));
|
28 |
-
if (!$result) {
|
29 |
-
$result = array();
|
30 |
-
}
|
31 |
-
return $result;
|
32 |
-
}
|
33 |
-
|
34 |
-
public function loadByCountryIdRegionId($countryId, $regionId){
|
35 |
-
$readAdapter = $this->_getReadAdapter();
|
36 |
-
$select = $readAdapter->select()
|
37 |
-
->from($this->getMainTable())
|
38 |
-
->where('country_id=:country_id')
|
39 |
-
->where('region_id=:region_id');
|
40 |
-
$result = $readAdapter->fetchRow($select, array('country_id' => $countryId, 'region_id' => $regionId));
|
41 |
-
if (!$result) {
|
42 |
-
$result = array();
|
43 |
-
}
|
44 |
-
return $result;
|
45 |
-
}
|
46 |
-
|
47 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Harapartners_SpeedTax_Model_Resource_Failsafe_Calculation_Rate extends Mage_Core_Model_Resource_Db_Abstract {
|
15 |
+
|
16 |
+
protected function _construct() {
|
17 |
+
$this->_init('speedtax/failsafe_calculation_rate', 'rate_id');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function loadByCountryIdRegionIdPostcode($countryId, $regionId, $postcode){
|
21 |
+
$readAdapter = $this->_getReadAdapter();
|
22 |
+
$select = $readAdapter->select()
|
23 |
+
->from($this->getMainTable())
|
24 |
+
->where('country_id=:country_id')
|
25 |
+
->where('region_id=:region_id')
|
26 |
+
->where('postcode=:postcode');
|
27 |
+
$result = $readAdapter->fetchRow($select, array('country_id' => $countryId, 'region_id' => $regionId, 'postcode' => $postcode));
|
28 |
+
if (!$result) {
|
29 |
+
$result = array();
|
30 |
+
}
|
31 |
+
return $result;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function loadByCountryIdRegionId($countryId, $regionId){
|
35 |
+
$readAdapter = $this->_getReadAdapter();
|
36 |
+
$select = $readAdapter->select()
|
37 |
+
->from($this->getMainTable())
|
38 |
+
->where('country_id=:country_id')
|
39 |
+
->where('region_id=:region_id');
|
40 |
+
$result = $readAdapter->fetchRow($select, array('country_id' => $countryId, 'region_id' => $regionId));
|
41 |
+
if (!$result) {
|
42 |
+
$result = array();
|
43 |
+
}
|
44 |
+
return $result;
|
45 |
+
}
|
46 |
+
|
47 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Resource/Failsafe/Calculation/Rate/Collection.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
|
14 |
-
class Harapartners_SpeedTax_Model_Resource_Failsafe_Calculation_Rate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
|
15 |
-
|
16 |
-
public function _construct(){
|
17 |
-
$this->_init('speedtax/failsafe_calculation_rate');
|
18 |
-
}
|
19 |
-
|
20 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
class Harapartners_SpeedTax_Model_Resource_Failsafe_Calculation_Rate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
|
15 |
+
|
16 |
+
public function _construct(){
|
17 |
+
$this->_init('speedtax/failsafe_calculation_rate');
|
18 |
+
}
|
19 |
+
|
20 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Rewrite/Tax/Sales/Total/Quote/Tax.php
CHANGED
@@ -1,70 +1,70 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_SpeedTax_Model_Rewrite_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
14 |
-
|
15 |
-
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
16 |
-
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
17 |
-
return parent::collect($address);
|
18 |
-
}
|
19 |
-
|
20 |
-
$store = $address->getQuote()->getStore();
|
21 |
-
$customer = $address->getQuote()->getCustomer();
|
22 |
-
|
23 |
-
$address->setTotalAmount($this->getCode(), 0);
|
24 |
-
$address->setBaseTotalAmount($this->getCode(), 0);
|
25 |
-
|
26 |
-
$address->setTaxAmount(0);
|
27 |
-
$address->setBaseTaxAmount(0);
|
28 |
-
$address->setShippingTaxAmount(0);
|
29 |
-
$address->setBaseShippingTaxAmount(0);
|
30 |
-
|
31 |
-
//Init
|
32 |
-
$this->_setAddress($address);
|
33 |
-
$this->_setAmount(0);
|
34 |
-
$this->_setBaseAmount(0);
|
35 |
-
|
36 |
-
try {
|
37 |
-
$processor = Mage::helper('speedtax/processor');
|
38 |
-
$responseResult = $processor->queryQuoteAddress($address);
|
39 |
-
//Address line item amount and shipping tax amount are updated within the query
|
40 |
-
if (!!$responseResult) {
|
41 |
-
$taxAmount = $processor->getTotalTax($responseResult);
|
42 |
-
$this->_addAmount(Mage::app()->getStore()->convertPrice($taxAmount, false));
|
43 |
-
$this->_addBaseAmount($taxAmount);
|
44 |
-
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
45 |
-
//Failsafe logic: accumuate rates in preparation of future failure
|
46 |
-
Mage::helper('speedtax/failsafe')->updateFailsafeRate($address, $responseResult);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
} catch(Exception $e) {
|
50 |
-
//Tax collecting is very important, this is within the collect total (cannot bubble exceptions), force a redirect
|
51 |
-
//Mage::logException($e);
|
52 |
-
Mage::log("Cannot collect quote tax total: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
53 |
-
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
54 |
-
//Failsafe logic: mark "calculate by failsafe rates" in case the order is placed
|
55 |
-
Mage::unregister('is_speedtax_failsafe_calculation');
|
56 |
-
Mage::register('is_speedtax_failsafe_calculation', true);
|
57 |
-
//Failsafe logic: calculate by failsafe rates
|
58 |
-
$taxFailsafe = Mage::getModel('speedtax/failsafe_sales_total_quote_tax');
|
59 |
-
return $taxFailsafe->collect($address);
|
60 |
-
}else{
|
61 |
-
$maskedErrorMessage = 'There is an error calculating tax.';
|
62 |
-
Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
63 |
-
throw new Mage_Core_Model_Session_Exception($maskedErrorMessage); //Session exceptions will be redirected to base URL
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
return $this;
|
68 |
-
}
|
69 |
-
|
70 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_SpeedTax_Model_Rewrite_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
14 |
+
|
15 |
+
public function collect(Mage_Sales_Model_Quote_Address $address) {
|
16 |
+
if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
|
17 |
+
return parent::collect($address);
|
18 |
+
}
|
19 |
+
|
20 |
+
$store = $address->getQuote()->getStore();
|
21 |
+
$customer = $address->getQuote()->getCustomer();
|
22 |
+
|
23 |
+
$address->setTotalAmount($this->getCode(), 0);
|
24 |
+
$address->setBaseTotalAmount($this->getCode(), 0);
|
25 |
+
|
26 |
+
$address->setTaxAmount(0);
|
27 |
+
$address->setBaseTaxAmount(0);
|
28 |
+
$address->setShippingTaxAmount(0);
|
29 |
+
$address->setBaseShippingTaxAmount(0);
|
30 |
+
|
31 |
+
//Init
|
32 |
+
$this->_setAddress($address);
|
33 |
+
$this->_setAmount(0);
|
34 |
+
$this->_setBaseAmount(0);
|
35 |
+
|
36 |
+
try {
|
37 |
+
$processor = Mage::helper('speedtax/processor');
|
38 |
+
$responseResult = $processor->queryQuoteAddress($address);
|
39 |
+
//Address line item amount and shipping tax amount are updated within the query
|
40 |
+
if (!!$responseResult) {
|
41 |
+
$taxAmount = $processor->getTotalTax($responseResult);
|
42 |
+
$this->_addAmount(Mage::app()->getStore()->convertPrice($taxAmount, false));
|
43 |
+
$this->_addBaseAmount($taxAmount);
|
44 |
+
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
45 |
+
//Failsafe logic: accumuate rates in preparation of future failure
|
46 |
+
Mage::helper('speedtax/failsafe')->updateFailsafeRate($address, $responseResult);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
} catch(Exception $e) {
|
50 |
+
//Tax collecting is very important, this is within the collect total (cannot bubble exceptions), force a redirect
|
51 |
+
//Mage::logException($e);
|
52 |
+
Mage::log("Cannot collect quote tax total: {$e->getMessage()}\r\n{$e->getTraceAsString()}", null, Harapartners_SpeedTax_Helper_Data::ERROR_LOG_FILE, true);
|
53 |
+
if (Mage::helper('speedtax')->isFailsafeEnabled()) {
|
54 |
+
//Failsafe logic: mark "calculate by failsafe rates" in case the order is placed
|
55 |
+
Mage::unregister('is_speedtax_failsafe_calculation');
|
56 |
+
Mage::register('is_speedtax_failsafe_calculation', true);
|
57 |
+
//Failsafe logic: calculate by failsafe rates
|
58 |
+
$taxFailsafe = Mage::getModel('speedtax/failsafe_sales_total_quote_tax');
|
59 |
+
return $taxFailsafe->collect($address);
|
60 |
+
}else{
|
61 |
+
$maskedErrorMessage = 'There is an error calculating tax.';
|
62 |
+
Mage::getSingleton('core/session')->addError($maskedErrorMessage);
|
63 |
+
throw new Mage_Core_Model_Session_Exception($maskedErrorMessage); //Session exceptions will be redirected to base URL
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Session.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.harapartners.com/license [^]
|
9 |
-
* If you did not receive a copy of the license and are unable to
|
10 |
-
* obtain it through the world-wide-web, please send an email
|
11 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
|
15 |
-
class Harapartners_SpeedTax_Model_Session extends Mage_Core_Model_Session_Abstract {
|
16 |
-
|
17 |
-
const REQUEST_CACHE_TTL = 600;
|
18 |
-
|
19 |
-
public function __construct() {
|
20 |
-
$this->init('speedtax');
|
21 |
-
}
|
22 |
-
|
23 |
-
public function loadCachedResponse($sptxInvoiceCacheKey){
|
24 |
-
$cacheStorage = $this->getData('cache_storage');
|
25 |
-
if(!isset($cacheStorage[$sptxInvoiceCacheKey])){
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
$cacheEntry = $cacheStorage[$sptxInvoiceCacheKey];
|
29 |
-
if($this->_isCacheEntryValid($cacheEntry)){
|
30 |
-
return json_decode($cacheEntry['response_json']);
|
31 |
-
}
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
public function saveCachedResponse($sptxInvoiceCacheKey, $response){
|
36 |
-
$cacheStorage = $this->getData('cache_storage');
|
37 |
-
if(!$cacheStorage){
|
38 |
-
$cacheStorage = array();
|
39 |
-
}
|
40 |
-
$cacheStorage[$sptxInvoiceCacheKey] = array(
|
41 |
-
'timestamp' => time(),
|
42 |
-
'response_json' => json_encode($response)
|
43 |
-
);
|
44 |
-
$cacheStorage = $this->_clearExpiredEnties($cacheStorage);
|
45 |
-
$this->setData('cache_storage', $cacheStorage);
|
46 |
-
return true;
|
47 |
-
}
|
48 |
-
|
49 |
-
protected function _clearExpiredEnties($cacheStorage){
|
50 |
-
foreach($cacheStorage as $sptxInvoiceCacheKey => $cacheEntry){
|
51 |
-
if(!$this->_isCacheEntryValid($cacheEntry)){
|
52 |
-
unset($cacheStorage[$sptxInvoiceCacheKey]);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
return $cacheStorage;
|
56 |
-
}
|
57 |
-
|
58 |
-
protected function _isCacheEntryValid($cacheEntry){
|
59 |
-
return isset($cacheEntry['timestamp'])
|
60 |
-
&& $cacheEntry['timestamp'] + self::REQUEST_CACHE_TTL > time()
|
61 |
-
&& isset($cacheEntry['response_json']);
|
62 |
-
}
|
63 |
-
|
64 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.harapartners.com/license [^]
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
|
15 |
+
class Harapartners_SpeedTax_Model_Session extends Mage_Core_Model_Session_Abstract {
|
16 |
+
|
17 |
+
const REQUEST_CACHE_TTL = 600;
|
18 |
+
|
19 |
+
public function __construct() {
|
20 |
+
$this->init('speedtax');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function loadCachedResponse($sptxInvoiceCacheKey){
|
24 |
+
$cacheStorage = $this->getData('cache_storage');
|
25 |
+
if(!isset($cacheStorage[$sptxInvoiceCacheKey])){
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
$cacheEntry = $cacheStorage[$sptxInvoiceCacheKey];
|
29 |
+
if($this->_isCacheEntryValid($cacheEntry)){
|
30 |
+
return json_decode($cacheEntry['response_json']);
|
31 |
+
}
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function saveCachedResponse($sptxInvoiceCacheKey, $response){
|
36 |
+
$cacheStorage = $this->getData('cache_storage');
|
37 |
+
if(!$cacheStorage){
|
38 |
+
$cacheStorage = array();
|
39 |
+
}
|
40 |
+
$cacheStorage[$sptxInvoiceCacheKey] = array(
|
41 |
+
'timestamp' => time(),
|
42 |
+
'response_json' => json_encode($response)
|
43 |
+
);
|
44 |
+
$cacheStorage = $this->_clearExpiredEnties($cacheStorage);
|
45 |
+
$this->setData('cache_storage', $cacheStorage);
|
46 |
+
return true;
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _clearExpiredEnties($cacheStorage){
|
50 |
+
foreach($cacheStorage as $sptxInvoiceCacheKey => $cacheEntry){
|
51 |
+
if(!$this->_isCacheEntryValid($cacheEntry)){
|
52 |
+
unset($cacheStorage[$sptxInvoiceCacheKey]);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
return $cacheStorage;
|
56 |
+
}
|
57 |
+
|
58 |
+
protected function _isCacheEntryValid($cacheEntry){
|
59 |
+
return isset($cacheEntry['timestamp'])
|
60 |
+
&& $cacheEntry['timestamp'] + self::REQUEST_CACHE_TTL > time()
|
61 |
+
&& isset($cacheEntry['response_json']);
|
62 |
+
}
|
63 |
+
|
64 |
}
|
app/code/community/Harapartners/SpeedTax/Model/Source/Usregions.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
class Harapartners_Speedtax_Model_Source_Usregions
|
14 |
-
{
|
15 |
-
protected $_options;
|
16 |
-
|
17 |
-
public function toOptionArray($isMultiselect=false)
|
18 |
-
{
|
19 |
-
if (!$this->_options) {
|
20 |
-
$regionCollection = Mage::getModel( 'directory/region' )->getCollection();
|
21 |
-
$regionCollection->getSelect()->where( 'country_id = ?', 'US' );
|
22 |
-
$regionOptions = array();
|
23 |
-
foreach( $regionCollection as $region ) {
|
24 |
-
$regionOptions[] = array( 'label' => $region->getDefaultName(), 'value' => $region->getId() );
|
25 |
-
}
|
26 |
-
$this->_options = $regionOptions;
|
27 |
-
}
|
28 |
-
$options = $this->_options;
|
29 |
-
if(!$isMultiselect){
|
30 |
-
array_unshift($options, array('value'=>'', 'label'=>''));
|
31 |
-
}
|
32 |
-
|
33 |
-
return $options;
|
34 |
-
}
|
35 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Harapartners_Speedtax_Model_Source_Usregions
|
14 |
+
{
|
15 |
+
protected $_options;
|
16 |
+
|
17 |
+
public function toOptionArray($isMultiselect=false)
|
18 |
+
{
|
19 |
+
if (!$this->_options) {
|
20 |
+
$regionCollection = Mage::getModel( 'directory/region' )->getCollection();
|
21 |
+
$regionCollection->getSelect()->where( 'country_id = ?', 'US' );
|
22 |
+
$regionOptions = array();
|
23 |
+
foreach( $regionCollection as $region ) {
|
24 |
+
$regionOptions[] = array( 'label' => $region->getDefaultName(), 'value' => $region->getId() );
|
25 |
+
}
|
26 |
+
$this->_options = $regionOptions;
|
27 |
+
}
|
28 |
+
$options = $this->_options;
|
29 |
+
if(!$isMultiselect){
|
30 |
+
array_unshift($options, array('value'=>'', 'label'=>''));
|
31 |
+
}
|
32 |
+
|
33 |
+
return $options;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/InvoiceController.php
CHANGED
@@ -1,80 +1,80 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Adminhtml_InvoiceController extends Mage_Adminhtml_Controller_Action {
|
14 |
-
|
15 |
-
public function indexAction() {
|
16 |
-
$this->loadLayout ();
|
17 |
-
$this->_setActiveMenu ( 'speedtax/invoice' );
|
18 |
-
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_all_index' ) );
|
19 |
-
$this->renderLayout ();
|
20 |
-
}
|
21 |
-
|
22 |
-
public function failsafeIndexAction() {
|
23 |
-
$this->loadLayout ();
|
24 |
-
$this->_setActiveMenu ( 'speedtax/invoice' );
|
25 |
-
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_failsafe_index' ) );
|
26 |
-
$this->renderLayout ();
|
27 |
-
}
|
28 |
-
|
29 |
-
public function rateVerificationIndexAction() {
|
30 |
-
$this->loadLayout ();
|
31 |
-
$this->_setActiveMenu ( 'speedtax/invoice' );
|
32 |
-
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_rateverification_index' ) );
|
33 |
-
$this->renderLayout ();
|
34 |
-
}
|
35 |
-
|
36 |
-
public function massPostToSpeedtaxAction(){
|
37 |
-
$invoiceIds = $this->getRequest()->getPost('invoice_ids', array());
|
38 |
-
$sptxProcessor = Mage::helper('speedtax/processor');
|
39 |
-
$successInvoiceIds = array();
|
40 |
-
$noticeInvoiceIds = array();
|
41 |
-
$errorInvoiceIds = array();
|
42 |
-
$allowedInovicePostStatusArray = array(
|
43 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_PENDING,
|
44 |
-
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE
|
45 |
-
);
|
46 |
-
foreach ($invoiceIds as $invoiceId) {
|
47 |
-
$invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
|
48 |
-
if(!in_array($invoice->getData('speedtax_invoice_status'), $allowedInovicePostStatusArray)){
|
49 |
-
$noticeInvoiceIds[] = $invoice->getData('increment_id');
|
50 |
-
continue;
|
51 |
-
}
|
52 |
-
try{
|
53 |
-
$responseResult = $sptxProcessor->postOrderInvoice($invoice);
|
54 |
-
if(isset($responseResult->totalTax->decimalValue)){
|
55 |
-
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
56 |
-
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
57 |
-
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
58 |
-
$invoice->save();
|
59 |
-
}
|
60 |
-
$successInvoiceIds[] = $invoice->getData('increment_id');
|
61 |
-
}catch (Exception $ex){
|
62 |
-
$errorInvoiceIds[] = $invoice->getData('increment_id');
|
63 |
-
}
|
64 |
-
unset($invoice);
|
65 |
-
}
|
66 |
-
|
67 |
-
if(count($successInvoiceIds)){
|
68 |
-
Mage::getSingleton('adminhtml/session')->addSuccess("Invoice posted to SalesTax. Invoice #" . implode(", #", $successInvoiceIds));
|
69 |
-
}
|
70 |
-
if(count($noticeInvoiceIds)){
|
71 |
-
Mage::getSingleton('adminhtml/session')->addNotice("Only inovices with Failsafe or Pending status can be posted. Invoice #" . implode(", #", $noticeInvoiceIds));
|
72 |
-
}
|
73 |
-
if(count($errorInvoiceIds)){
|
74 |
-
Mage::getSingleton('adminhtml/session')->addError("Cannot post invoices to SalesTax. Invoice: #" . implode(", #", $errorInvoiceIds));
|
75 |
-
}
|
76 |
-
|
77 |
-
$this->_redirectReferer();
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Adminhtml_InvoiceController extends Mage_Adminhtml_Controller_Action {
|
14 |
+
|
15 |
+
public function indexAction() {
|
16 |
+
$this->loadLayout ();
|
17 |
+
$this->_setActiveMenu ( 'speedtax/invoice' );
|
18 |
+
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_all_index' ) );
|
19 |
+
$this->renderLayout ();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function failsafeIndexAction() {
|
23 |
+
$this->loadLayout ();
|
24 |
+
$this->_setActiveMenu ( 'speedtax/invoice' );
|
25 |
+
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_failsafe_index' ) );
|
26 |
+
$this->renderLayout ();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function rateVerificationIndexAction() {
|
30 |
+
$this->loadLayout ();
|
31 |
+
$this->_setActiveMenu ( 'speedtax/invoice' );
|
32 |
+
$this->_addContent ( $this->getLayout ()->createBlock ( 'speedtax/adminhtml_invoice_rateverification_index' ) );
|
33 |
+
$this->renderLayout ();
|
34 |
+
}
|
35 |
+
|
36 |
+
public function massPostToSpeedtaxAction(){
|
37 |
+
$invoiceIds = $this->getRequest()->getPost('invoice_ids', array());
|
38 |
+
$sptxProcessor = Mage::helper('speedtax/processor');
|
39 |
+
$successInvoiceIds = array();
|
40 |
+
$noticeInvoiceIds = array();
|
41 |
+
$errorInvoiceIds = array();
|
42 |
+
$allowedInovicePostStatusArray = array(
|
43 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_PENDING,
|
44 |
+
Harapartners_SpeedTax_Helper_Processor::SPEEDTAX_INVOICE_STATUS_FAILSAFE
|
45 |
+
);
|
46 |
+
foreach ($invoiceIds as $invoiceId) {
|
47 |
+
$invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
|
48 |
+
if(!in_array($invoice->getData('speedtax_invoice_status'), $allowedInovicePostStatusArray)){
|
49 |
+
$noticeInvoiceIds[] = $invoice->getData('increment_id');
|
50 |
+
continue;
|
51 |
+
}
|
52 |
+
try{
|
53 |
+
$responseResult = $sptxProcessor->postOrderInvoice($invoice);
|
54 |
+
if(isset($responseResult->totalTax->decimalValue)){
|
55 |
+
$baseSpeedTaxTaxAmount = $responseResult->totalTax->decimalValue;
|
56 |
+
$invoice->setData('base_speedtax_tax_amount', $baseSpeedTaxTaxAmount);
|
57 |
+
$invoice->setData('speedtax_tax_amount', Mage::app()->getStore()->convertPrice($baseSpeedTaxTaxAmount, false));
|
58 |
+
$invoice->save();
|
59 |
+
}
|
60 |
+
$successInvoiceIds[] = $invoice->getData('increment_id');
|
61 |
+
}catch (Exception $ex){
|
62 |
+
$errorInvoiceIds[] = $invoice->getData('increment_id');
|
63 |
+
}
|
64 |
+
unset($invoice);
|
65 |
+
}
|
66 |
+
|
67 |
+
if(count($successInvoiceIds)){
|
68 |
+
Mage::getSingleton('adminhtml/session')->addSuccess("Invoice posted to SalesTax. Invoice #" . implode(", #", $successInvoiceIds));
|
69 |
+
}
|
70 |
+
if(count($noticeInvoiceIds)){
|
71 |
+
Mage::getSingleton('adminhtml/session')->addNotice("Only inovices with Failsafe or Pending status can be posted. Invoice #" . implode(", #", $noticeInvoiceIds));
|
72 |
+
}
|
73 |
+
if(count($errorInvoiceIds)){
|
74 |
+
Mage::getSingleton('adminhtml/session')->addError("Cannot post invoices to SalesTax. Invoice: #" . implode(", #", $errorInvoiceIds));
|
75 |
+
}
|
76 |
+
|
77 |
+
$this->_redirectReferer();
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/NotificationController.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Adminhtml_NotificationController extends Mage_Adminhtml_Controller_Action {
|
14 |
-
|
15 |
-
public function disableAction() {
|
16 |
-
try{
|
17 |
-
$notificationkey = $this->getRequest()->getParam('notification_key');
|
18 |
-
$coreConfigData = Mage::getModel('core/config_data')->load(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS, 'path');
|
19 |
-
//In case the first time save
|
20 |
-
$coreConfigData->setpath(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS);
|
21 |
-
$notificationDisabled = json_decode($coreConfigData->getValue(), 1);
|
22 |
-
$notificationDisabled[$notificationkey] = 1;
|
23 |
-
$coreConfigData->setValue(json_encode($notificationDisabled));
|
24 |
-
$coreConfigData->save();
|
25 |
-
}catch (Exception $ex){
|
26 |
-
//Silence
|
27 |
-
}
|
28 |
-
$this->_redirectReferer();
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Adminhtml_NotificationController extends Mage_Adminhtml_Controller_Action {
|
14 |
+
|
15 |
+
public function disableAction() {
|
16 |
+
try{
|
17 |
+
$notificationkey = $this->getRequest()->getParam('notification_key');
|
18 |
+
$coreConfigData = Mage::getModel('core/config_data')->load(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS, 'path');
|
19 |
+
//In case the first time save
|
20 |
+
$coreConfigData->setpath(Harapartners_SpeedTax_Helper_Data::XML_PATH_NOTIFICATION_DISABLED_COMPRESS);
|
21 |
+
$notificationDisabled = json_decode($coreConfigData->getValue(), 1);
|
22 |
+
$notificationDisabled[$notificationkey] = 1;
|
23 |
+
$coreConfigData->setValue(json_encode($notificationDisabled));
|
24 |
+
$coreConfigData->save();
|
25 |
+
}catch (Exception $ex){
|
26 |
+
//Silence
|
27 |
+
}
|
28 |
+
$this->_redirectReferer();
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
}
|
app/code/community/Harapartners/SpeedTax/controllers/Adminhtml/System/Config/AjaxController.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*/
|
12 |
-
|
13 |
-
class Harapartners_SpeedTax_Adminhtml_System_Config_AjaxController extends Mage_Adminhtml_Controller_Action {
|
14 |
-
|
15 |
-
public function authenticationAction() {
|
16 |
-
|
17 |
-
try{
|
18 |
-
$username = $this->getRequest()->getParam('username');
|
19 |
-
$password = $this->getRequest()->getParam('password');
|
20 |
-
$companyCode = $this->getRequest()->getParam('company_code');
|
21 |
-
$isTestMode = $this->getRequest()->getParam('is_test_mode');
|
22 |
-
|
23 |
-
//Check encrypted config
|
24 |
-
if (preg_match('/^\*+$/', $password)) {
|
25 |
-
$password = Mage::helper('core')->decrypt(Mage::getStoreConfig('speedtax/speedtax/password'));
|
26 |
-
}
|
27 |
-
|
28 |
-
if(!!$isTestMode){
|
29 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
30 |
-
}else{
|
31 |
-
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
32 |
-
}
|
33 |
-
|
34 |
-
$credentials = array(
|
35 |
-
'username' => $username,
|
36 |
-
'password' => $password,
|
37 |
-
'company_code' => $companyCode,
|
38 |
-
'service_mode' => $serviceMode
|
39 |
-
);
|
40 |
-
|
41 |
-
//auth_token and data_token are handled within
|
42 |
-
$result = Mage::helper ('speedtax/connector_speedtax')->authenticationRequest($credentials);
|
43 |
-
|
44 |
-
}catch(Exception $e){
|
45 |
-
$errorMessage = $e->getMessage();
|
46 |
-
if(!$errorMessage){
|
47 |
-
$errorMessage = 'Connection failed.';
|
48 |
-
}
|
49 |
-
echo json_encode(array(
|
50 |
-
'status' => 0,
|
51 |
-
'message' => $errorMessage
|
52 |
-
)); //Json error
|
53 |
-
exit;
|
54 |
-
}
|
55 |
-
//Need to send $websiteResultJson, the store config is still the cache value, not our new value
|
56 |
-
echo json_encode(array(
|
57 |
-
'status' => 1,
|
58 |
-
'message' => 'Validation successful!'
|
59 |
-
)); //Json success
|
60 |
-
exit;
|
61 |
-
}
|
62 |
-
|
63 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Harapartners_SpeedTax_Adminhtml_System_Config_AjaxController extends Mage_Adminhtml_Controller_Action {
|
14 |
+
|
15 |
+
public function authenticationAction() {
|
16 |
+
|
17 |
+
try{
|
18 |
+
$username = $this->getRequest()->getParam('username');
|
19 |
+
$password = $this->getRequest()->getParam('password');
|
20 |
+
$companyCode = $this->getRequest()->getParam('company_code');
|
21 |
+
$isTestMode = $this->getRequest()->getParam('is_test_mode');
|
22 |
+
|
23 |
+
//Check encrypted config
|
24 |
+
if (preg_match('/^\*+$/', $password)) {
|
25 |
+
$password = Mage::helper('core')->decrypt(Mage::getStoreConfig('speedtax/speedtax/password'));
|
26 |
+
}
|
27 |
+
|
28 |
+
if(!!$isTestMode){
|
29 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_TEST;
|
30 |
+
}else{
|
31 |
+
$serviceMode = Harapartners_ConnectorHub_Helper_Connector_Core::REQUEST_SERVICE_MODE_PRODUCTION;
|
32 |
+
}
|
33 |
+
|
34 |
+
$credentials = array(
|
35 |
+
'username' => $username,
|
36 |
+
'password' => $password,
|
37 |
+
'company_code' => $companyCode,
|
38 |
+
'service_mode' => $serviceMode
|
39 |
+
);
|
40 |
+
|
41 |
+
//auth_token and data_token are handled within
|
42 |
+
$result = Mage::helper ('speedtax/connector_speedtax')->authenticationRequest($credentials);
|
43 |
+
|
44 |
+
}catch(Exception $e){
|
45 |
+
$errorMessage = $e->getMessage();
|
46 |
+
if(!$errorMessage){
|
47 |
+
$errorMessage = 'Connection failed.';
|
48 |
+
}
|
49 |
+
echo json_encode(array(
|
50 |
+
'status' => 0,
|
51 |
+
'message' => $errorMessage
|
52 |
+
)); //Json error
|
53 |
+
exit;
|
54 |
+
}
|
55 |
+
//Need to send $websiteResultJson, the store config is still the cache value, not our new value
|
56 |
+
echo json_encode(array(
|
57 |
+
'status' => 1,
|
58 |
+
'message' => 'Validation successful!'
|
59 |
+
)); //Json success
|
60 |
+
exit;
|
61 |
+
}
|
62 |
+
|
63 |
}
|
app/code/community/Harapartners/SpeedTax/etc/adminhtml.xml
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*
|
13 |
-
-->
|
14 |
-
<config>
|
15 |
-
<acl>
|
16 |
-
<resources>
|
17 |
-
<admin>
|
18 |
-
<children>
|
19 |
-
<speedtax translate="title" module="speedtax">
|
20 |
-
<title>SalesTax</title>
|
21 |
-
<children>
|
22 |
-
<invoice>
|
23 |
-
<title>Manage Invoices</title>
|
24 |
-
</invoice>
|
25 |
-
</children>
|
26 |
-
</speedtax>
|
27 |
-
<system>
|
28 |
-
<children>
|
29 |
-
<config>
|
30 |
-
<children>
|
31 |
-
<speedtax translate="title" module="speedtax">
|
32 |
-
<title>SpeedTax Configuration</title>
|
33 |
-
</speedtax>
|
34 |
-
</children>
|
35 |
-
</config>
|
36 |
-
</children>
|
37 |
-
</system>
|
38 |
-
</children>
|
39 |
-
</admin>
|
40 |
-
</resources>
|
41 |
-
</acl>
|
42 |
-
<menu>
|
43 |
-
<speedtax translate="title" module="speedtax">
|
44 |
-
<title>SalesTax</title>
|
45 |
-
<sort_order>900</sort_order>
|
46 |
-
<children>
|
47 |
-
<!-- Core -->
|
48 |
-
<config translate="title" module="speedtax">
|
49 |
-
<title>SalesTax Config</title>
|
50 |
-
<sort_order>10</sort_order>
|
51 |
-
<action>adminhtml/system_config/edit/section/speedtax</action>
|
52 |
-
</config>
|
53 |
-
<invoice_index translate="title" module="speedtax">
|
54 |
-
<title>All Invoices</title>
|
55 |
-
<sort_order>100</sort_order>
|
56 |
-
<action>speedtax_adminhtml/invoice/index</action>
|
57 |
-
</invoice_index>
|
58 |
-
<invoice_failsafe_index translate="title" module="speedtax">
|
59 |
-
<title>Failsafe Invoices</title>
|
60 |
-
<sort_order>200</sort_order>
|
61 |
-
<action>speedtax_adminhtml/invoice/failsafeIndex</action>
|
62 |
-
</invoice_failsafe_index>
|
63 |
-
<invoice_ratevalidation_index translate="title" module="speedtax">
|
64 |
-
<title>Failsafe Rate Verification</title>
|
65 |
-
<sort_order>300</sort_order>
|
66 |
-
<action>speedtax_adminhtml/invoice/rateVerificationIndex</action>
|
67 |
-
</invoice_ratevalidation_index>
|
68 |
-
</children>
|
69 |
-
</speedtax>
|
70 |
-
</menu>
|
71 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*
|
13 |
+
-->
|
14 |
+
<config>
|
15 |
+
<acl>
|
16 |
+
<resources>
|
17 |
+
<admin>
|
18 |
+
<children>
|
19 |
+
<speedtax translate="title" module="speedtax">
|
20 |
+
<title>SalesTax</title>
|
21 |
+
<children>
|
22 |
+
<invoice>
|
23 |
+
<title>Manage Invoices</title>
|
24 |
+
</invoice>
|
25 |
+
</children>
|
26 |
+
</speedtax>
|
27 |
+
<system>
|
28 |
+
<children>
|
29 |
+
<config>
|
30 |
+
<children>
|
31 |
+
<speedtax translate="title" module="speedtax">
|
32 |
+
<title>SpeedTax Configuration</title>
|
33 |
+
</speedtax>
|
34 |
+
</children>
|
35 |
+
</config>
|
36 |
+
</children>
|
37 |
+
</system>
|
38 |
+
</children>
|
39 |
+
</admin>
|
40 |
+
</resources>
|
41 |
+
</acl>
|
42 |
+
<menu>
|
43 |
+
<speedtax translate="title" module="speedtax">
|
44 |
+
<title>SalesTax</title>
|
45 |
+
<sort_order>900</sort_order>
|
46 |
+
<children>
|
47 |
+
<!-- Core -->
|
48 |
+
<config translate="title" module="speedtax">
|
49 |
+
<title>SalesTax Config</title>
|
50 |
+
<sort_order>10</sort_order>
|
51 |
+
<action>adminhtml/system_config/edit/section/speedtax</action>
|
52 |
+
</config>
|
53 |
+
<invoice_index translate="title" module="speedtax">
|
54 |
+
<title>All Invoices</title>
|
55 |
+
<sort_order>100</sort_order>
|
56 |
+
<action>speedtax_adminhtml/invoice/index</action>
|
57 |
+
</invoice_index>
|
58 |
+
<invoice_failsafe_index translate="title" module="speedtax">
|
59 |
+
<title>Failsafe Invoices</title>
|
60 |
+
<sort_order>200</sort_order>
|
61 |
+
<action>speedtax_adminhtml/invoice/failsafeIndex</action>
|
62 |
+
</invoice_failsafe_index>
|
63 |
+
<invoice_ratevalidation_index translate="title" module="speedtax">
|
64 |
+
<title>Failsafe Rate Verification</title>
|
65 |
+
<sort_order>300</sort_order>
|
66 |
+
<action>speedtax_adminhtml/invoice/rateVerificationIndex</action>
|
67 |
+
</invoice_ratevalidation_index>
|
68 |
+
</children>
|
69 |
+
</speedtax>
|
70 |
+
</menu>
|
71 |
+
</config>
|
app/code/community/Harapartners/SpeedTax/etc/config.xml
CHANGED
@@ -1,170 +1,170 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.harapartners.com/license
|
9 |
-
* If you did not receive a copy of the license and are unable to
|
10 |
-
* obtain it through the world-wide-web, please send an email
|
11 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
-->
|
15 |
-
<config>
|
16 |
-
<modules>
|
17 |
-
<Harapartners_SpeedTax>
|
18 |
-
<version>4.1.
|
19 |
-
</Harapartners_SpeedTax>
|
20 |
-
</modules>
|
21 |
-
<global>
|
22 |
-
<blocks>
|
23 |
-
<speedtax>
|
24 |
-
<class>Harapartners_SpeedTax_Block</class>
|
25 |
-
</speedtax>
|
26 |
-
</blocks>
|
27 |
-
<models>
|
28 |
-
<speedtax>
|
29 |
-
<class>Harapartners_SpeedTax_Model</class>
|
30 |
-
<resourceModel>speedtax_resource</resourceModel>
|
31 |
-
</speedtax>
|
32 |
-
<speedtax_resource>
|
33 |
-
<class>Harapartners_SpeedTax_Model_Resource</class>
|
34 |
-
<entities>
|
35 |
-
<failsafe_calculation_rate>
|
36 |
-
<table>speedtax_failsafe_calculation_rate</table>
|
37 |
-
</failsafe_calculation_rate>
|
38 |
-
</entities>
|
39 |
-
</speedtax_resource>
|
40 |
-
<tax>
|
41 |
-
<rewrite>
|
42 |
-
<sales_total_quote_tax>Harapartners_SpeedTax_Model_Rewrite_Tax_Sales_Total_Quote_Tax</sales_total_quote_tax>
|
43 |
-
</rewrite>
|
44 |
-
</tax>
|
45 |
-
</models>
|
46 |
-
<helpers>
|
47 |
-
<speedtax>
|
48 |
-
<class>Harapartners_SpeedTax_Helper</class>
|
49 |
-
</speedtax>
|
50 |
-
</helpers>
|
51 |
-
<resources>
|
52 |
-
<speedtax_setup>
|
53 |
-
<setup>
|
54 |
-
<module>Harapartners_SpeedTax</module>
|
55 |
-
</setup>
|
56 |
-
<connection>
|
57 |
-
<use>core_setup</use>
|
58 |
-
</connection>
|
59 |
-
</speedtax_setup>
|
60 |
-
</resources>
|
61 |
-
<events>
|
62 |
-
<!-- Checkout process, (failsafe calculation can be enabled) -->
|
63 |
-
<sales_order_save_before>
|
64 |
-
<observers>
|
65 |
-
<speedtax>
|
66 |
-
<type>singleton</type>
|
67 |
-
<class>speedtax/observer</class>
|
68 |
-
<method>saleOrderSaveBefore</method>
|
69 |
-
</speedtax>
|
70 |
-
</observers>
|
71 |
-
</sales_order_save_before>
|
72 |
-
|
73 |
-
<!-- Post invoices to SpeedTax (failsafe delayed invoice post can be enabled) -->
|
74 |
-
<sales_order_invoice_pay>
|
75 |
-
<observers>
|
76 |
-
<speedtax>
|
77 |
-
<type>singleton</type>
|
78 |
-
<class>speedtax/observer</class>
|
79 |
-
<method>saleOrderInvoicePay</method>
|
80 |
-
</speedtax>
|
81 |
-
</observers>
|
82 |
-
</sales_order_invoice_pay>
|
83 |
-
|
84 |
-
<!-- Post credit memo to SpeedTax (admin only function, no failsafe needed) -->
|
85 |
-
<sales_order_creditmemo_refund>
|
86 |
-
<observers>
|
87 |
-
<speedtax>
|
88 |
-
<type>singleton</type>
|
89 |
-
<class>speedtax/observer</class>
|
90 |
-
<method>salesOrderCreditmemoRefund</method>
|
91 |
-
</speedtax>
|
92 |
-
</observers>
|
93 |
-
</sales_order_creditmemo_refund>
|
94 |
-
|
95 |
-
<!-- Upon order cancel/edit, credit memo must be created manually for existing invoices, SpeedTax invoices will NOT be voided -->
|
96 |
-
<!--order_cancel_after>
|
97 |
-
<observers>
|
98 |
-
<speedtax>
|
99 |
-
<type>singleton</type>
|
100 |
-
<class>speedtax/observer</class>
|
101 |
-
<method>orderCancelAfter</method>
|
102 |
-
</speedtax>
|
103 |
-
</observers>
|
104 |
-
</order_cancel_after-->
|
105 |
-
</events>
|
106 |
-
</global>
|
107 |
-
<adminhtml>
|
108 |
-
<events>
|
109 |
-
<controller_action_layout_generate_blocks_after>
|
110 |
-
<!-- Global layout modifications -->
|
111 |
-
<!-- Prepare and render important admin panel messages -->
|
112 |
-
<observers>
|
113 |
-
<speedtax_adminhtml_only_layout_generate_blocks_after>
|
114 |
-
<type>singleton</type>
|
115 |
-
<class>speedtax/observer</class>
|
116 |
-
<method>adminhtmlOnlyLayoutGenerateBlocksAfter</method>
|
117 |
-
</speedtax_adminhtml_only_layout_generate_blocks_after>
|
118 |
-
</observers>
|
119 |
-
</controller_action_layout_generate_blocks_after>
|
120 |
-
</events>
|
121 |
-
</adminhtml>
|
122 |
-
<admin>
|
123 |
-
<routers>
|
124 |
-
<speedtax_adminhtml>
|
125 |
-
<use>admin</use>
|
126 |
-
<args>
|
127 |
-
<module>Harapartners_SpeedTax_Adminhtml</module>
|
128 |
-
<frontName>speedtax_adminhtml</frontName>
|
129 |
-
</args>
|
130 |
-
</speedtax_adminhtml>
|
131 |
-
</routers>
|
132 |
-
</admin>
|
133 |
-
<crontab>
|
134 |
-
<jobs>
|
135 |
-
<speedtax_batch_post_failsafe_invoice>
|
136 |
-
<schedule>
|
137 |
-
<cron_expr>23 * * * *</cron_expr>
|
138 |
-
</schedule>
|
139 |
-
<run>
|
140 |
-
<model>speedtax/observer::batchPostFailsafeInvoice</model>
|
141 |
-
</run>
|
142 |
-
</speedtax_batch_post_failsafe_invoice>
|
143 |
-
</jobs>
|
144 |
-
</crontab>
|
145 |
-
<default>
|
146 |
-
<speedtax>
|
147 |
-
<speedtax>
|
148 |
-
<action>0</action>
|
149 |
-
<is_tax_shipping>0</is_tax_shipping>
|
150 |
-
<shipping_tax_code>Shipping</shipping_tax_code>
|
151 |
-
<is_use_product_tax_class>0</is_use_product_tax_class>
|
152 |
-
<url>https://www.speedtax.com/</url>
|
153 |
-
<shipping_sku>Shipping</shipping_sku>
|
154 |
-
<adjustment_positive_sku>Adjustment</adjustment_positive_sku>
|
155 |
-
<adjustment_negative_sku>Adjustment</adjustment_negative_sku>
|
156 |
-
<sales_person_code>Magento</sales_person_code>
|
157 |
-
<error_full_stop>1</error_full_stop>
|
158 |
-
<error_frontend_action>2</error_frontend_action>
|
159 |
-
<error_frontend_message>Unfortunately, we could not calculate tax for your order. Please try again with a different address or contact us to complete your order.</error_frontend_message>
|
160 |
-
<error_backend_message>There was an error getting tax rates from Speedtax. Please see the error log for details.</error_backend_message>
|
161 |
-
<error_notification_toolbar>1</error_notification_toolbar>
|
162 |
-
<onepage_normalize_message>Your shipping address has been modified during our validation process. Please confirm the address to the right is accurate.</onepage_normalize_message>
|
163 |
-
</speedtax>
|
164 |
-
<failsafe>
|
165 |
-
<is_enabled>1</is_enabled>
|
166 |
-
<is_auto_post_failsafe_invoice>1</is_auto_post_failsafe_invoice>
|
167 |
-
</failsafe>
|
168 |
-
</speedtax>
|
169 |
-
</default>
|
170 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.harapartners.com/license
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<modules>
|
17 |
+
<Harapartners_SpeedTax>
|
18 |
+
<version>4.1.2</version>
|
19 |
+
</Harapartners_SpeedTax>
|
20 |
+
</modules>
|
21 |
+
<global>
|
22 |
+
<blocks>
|
23 |
+
<speedtax>
|
24 |
+
<class>Harapartners_SpeedTax_Block</class>
|
25 |
+
</speedtax>
|
26 |
+
</blocks>
|
27 |
+
<models>
|
28 |
+
<speedtax>
|
29 |
+
<class>Harapartners_SpeedTax_Model</class>
|
30 |
+
<resourceModel>speedtax_resource</resourceModel>
|
31 |
+
</speedtax>
|
32 |
+
<speedtax_resource>
|
33 |
+
<class>Harapartners_SpeedTax_Model_Resource</class>
|
34 |
+
<entities>
|
35 |
+
<failsafe_calculation_rate>
|
36 |
+
<table>speedtax_failsafe_calculation_rate</table>
|
37 |
+
</failsafe_calculation_rate>
|
38 |
+
</entities>
|
39 |
+
</speedtax_resource>
|
40 |
+
<tax>
|
41 |
+
<rewrite>
|
42 |
+
<sales_total_quote_tax>Harapartners_SpeedTax_Model_Rewrite_Tax_Sales_Total_Quote_Tax</sales_total_quote_tax>
|
43 |
+
</rewrite>
|
44 |
+
</tax>
|
45 |
+
</models>
|
46 |
+
<helpers>
|
47 |
+
<speedtax>
|
48 |
+
<class>Harapartners_SpeedTax_Helper</class>
|
49 |
+
</speedtax>
|
50 |
+
</helpers>
|
51 |
+
<resources>
|
52 |
+
<speedtax_setup>
|
53 |
+
<setup>
|
54 |
+
<module>Harapartners_SpeedTax</module>
|
55 |
+
</setup>
|
56 |
+
<connection>
|
57 |
+
<use>core_setup</use>
|
58 |
+
</connection>
|
59 |
+
</speedtax_setup>
|
60 |
+
</resources>
|
61 |
+
<events>
|
62 |
+
<!-- Checkout process, (failsafe calculation can be enabled) -->
|
63 |
+
<sales_order_save_before>
|
64 |
+
<observers>
|
65 |
+
<speedtax>
|
66 |
+
<type>singleton</type>
|
67 |
+
<class>speedtax/observer</class>
|
68 |
+
<method>saleOrderSaveBefore</method>
|
69 |
+
</speedtax>
|
70 |
+
</observers>
|
71 |
+
</sales_order_save_before>
|
72 |
+
|
73 |
+
<!-- Post invoices to SpeedTax (failsafe delayed invoice post can be enabled) -->
|
74 |
+
<sales_order_invoice_pay>
|
75 |
+
<observers>
|
76 |
+
<speedtax>
|
77 |
+
<type>singleton</type>
|
78 |
+
<class>speedtax/observer</class>
|
79 |
+
<method>saleOrderInvoicePay</method>
|
80 |
+
</speedtax>
|
81 |
+
</observers>
|
82 |
+
</sales_order_invoice_pay>
|
83 |
+
|
84 |
+
<!-- Post credit memo to SpeedTax (admin only function, no failsafe needed) -->
|
85 |
+
<sales_order_creditmemo_refund>
|
86 |
+
<observers>
|
87 |
+
<speedtax>
|
88 |
+
<type>singleton</type>
|
89 |
+
<class>speedtax/observer</class>
|
90 |
+
<method>salesOrderCreditmemoRefund</method>
|
91 |
+
</speedtax>
|
92 |
+
</observers>
|
93 |
+
</sales_order_creditmemo_refund>
|
94 |
+
|
95 |
+
<!-- Upon order cancel/edit, credit memo must be created manually for existing invoices, SpeedTax invoices will NOT be voided -->
|
96 |
+
<!--order_cancel_after>
|
97 |
+
<observers>
|
98 |
+
<speedtax>
|
99 |
+
<type>singleton</type>
|
100 |
+
<class>speedtax/observer</class>
|
101 |
+
<method>orderCancelAfter</method>
|
102 |
+
</speedtax>
|
103 |
+
</observers>
|
104 |
+
</order_cancel_after-->
|
105 |
+
</events>
|
106 |
+
</global>
|
107 |
+
<adminhtml>
|
108 |
+
<events>
|
109 |
+
<controller_action_layout_generate_blocks_after>
|
110 |
+
<!-- Global layout modifications -->
|
111 |
+
<!-- Prepare and render important admin panel messages -->
|
112 |
+
<observers>
|
113 |
+
<speedtax_adminhtml_only_layout_generate_blocks_after>
|
114 |
+
<type>singleton</type>
|
115 |
+
<class>speedtax/observer</class>
|
116 |
+
<method>adminhtmlOnlyLayoutGenerateBlocksAfter</method>
|
117 |
+
</speedtax_adminhtml_only_layout_generate_blocks_after>
|
118 |
+
</observers>
|
119 |
+
</controller_action_layout_generate_blocks_after>
|
120 |
+
</events>
|
121 |
+
</adminhtml>
|
122 |
+
<admin>
|
123 |
+
<routers>
|
124 |
+
<speedtax_adminhtml>
|
125 |
+
<use>admin</use>
|
126 |
+
<args>
|
127 |
+
<module>Harapartners_SpeedTax_Adminhtml</module>
|
128 |
+
<frontName>speedtax_adminhtml</frontName>
|
129 |
+
</args>
|
130 |
+
</speedtax_adminhtml>
|
131 |
+
</routers>
|
132 |
+
</admin>
|
133 |
+
<crontab>
|
134 |
+
<jobs>
|
135 |
+
<speedtax_batch_post_failsafe_invoice>
|
136 |
+
<schedule>
|
137 |
+
<cron_expr>23 * * * *</cron_expr>
|
138 |
+
</schedule>
|
139 |
+
<run>
|
140 |
+
<model>speedtax/observer::batchPostFailsafeInvoice</model>
|
141 |
+
</run>
|
142 |
+
</speedtax_batch_post_failsafe_invoice>
|
143 |
+
</jobs>
|
144 |
+
</crontab>
|
145 |
+
<default>
|
146 |
+
<speedtax>
|
147 |
+
<speedtax>
|
148 |
+
<action>0</action>
|
149 |
+
<is_tax_shipping>0</is_tax_shipping>
|
150 |
+
<shipping_tax_code>Shipping</shipping_tax_code>
|
151 |
+
<is_use_product_tax_class>0</is_use_product_tax_class>
|
152 |
+
<url>https://www.speedtax.com/</url>
|
153 |
+
<shipping_sku>Shipping</shipping_sku>
|
154 |
+
<adjustment_positive_sku>Adjustment</adjustment_positive_sku>
|
155 |
+
<adjustment_negative_sku>Adjustment</adjustment_negative_sku>
|
156 |
+
<sales_person_code>Magento</sales_person_code>
|
157 |
+
<error_full_stop>1</error_full_stop>
|
158 |
+
<error_frontend_action>2</error_frontend_action>
|
159 |
+
<error_frontend_message>Unfortunately, we could not calculate tax for your order. Please try again with a different address or contact us to complete your order.</error_frontend_message>
|
160 |
+
<error_backend_message>There was an error getting tax rates from Speedtax. Please see the error log for details.</error_backend_message>
|
161 |
+
<error_notification_toolbar>1</error_notification_toolbar>
|
162 |
+
<onepage_normalize_message>Your shipping address has been modified during our validation process. Please confirm the address to the right is accurate.</onepage_normalize_message>
|
163 |
+
</speedtax>
|
164 |
+
<failsafe>
|
165 |
+
<is_enabled>1</is_enabled>
|
166 |
+
<is_auto_post_failsafe_invoice>1</is_auto_post_failsafe_invoice>
|
167 |
+
</failsafe>
|
168 |
+
</speedtax>
|
169 |
+
</default>
|
170 |
</config>
|
app/code/community/Harapartners/SpeedTax/etc/system.xml
CHANGED
@@ -1,299 +1,299 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.harapartners.com/license
|
9 |
-
* If you did not receive a copy of the license and are unable to
|
10 |
-
* obtain it through the world-wide-web, please send an email
|
11 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
-->
|
15 |
-
<config>
|
16 |
-
<sections>
|
17 |
-
<speedtax translate="label" module="speedtax">
|
18 |
-
<class>speedtax-section</class>
|
19 |
-
<label><![CDATA[SalesTax.com by <br/><img src="https://www.harapartners.com/skin/frontend/enterprise/harapartners/images/hp/HP2.0Logo.png" alt="HaraPartners" width="100" height="20">]]></label>
|
20 |
-
<header_css>speedtax-header</header_css>
|
21 |
-
<tab>sales</tab>
|
22 |
-
<sort_order>304</sort_order>
|
23 |
-
<show_in_default>1</show_in_default>
|
24 |
-
<show_in_website>1</show_in_website>
|
25 |
-
<show_in_store>0</show_in_store>
|
26 |
-
<groups>
|
27 |
-
<signup>
|
28 |
-
<label>Sign up for SalesTax.com</label>
|
29 |
-
<comment><![CDATA[
|
30 |
-
<p class="switcher">
|
31 |
-
Sign up for a <a href="http://harapartners.com/solutions/salestax/30daytrial" target="_blank" style="color: #00C3FF;">Free 30 Day Trial</a>.<br/>
|
32 |
-
<a href="http://www.harapartners.com/solutions/salestax/signup" target="_blank" style="color: #00C3FF;">Sign up for SalesTax.com to process your Sales Taxes.</a>.<br/>
|
33 |
-
Call with questions at <b>646-663-5672</b> or find more information under <a href="http://www.harapartners.com/salestax" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax</a>.
|
34 |
-
</p>
|
35 |
-
]]></comment>
|
36 |
-
<sort_order>0</sort_order>
|
37 |
-
<show_in_default>1</show_in_default>
|
38 |
-
<show_in_website>1</show_in_website>
|
39 |
-
<show_in_store>0</show_in_store>
|
40 |
-
<expanded>1</expanded>
|
41 |
-
</signup>
|
42 |
-
<speedtax>
|
43 |
-
<label>SalesTax.com Configuration</label>
|
44 |
-
<sort_order>100</sort_order>
|
45 |
-
<show_in_default>1</show_in_default>
|
46 |
-
<show_in_website>1</show_in_website>
|
47 |
-
<show_in_store>0</show_in_store>
|
48 |
-
<fields>
|
49 |
-
<is_enabled translate="label">
|
50 |
-
<label>Status</label>
|
51 |
-
<comment><![CDATA[If "No", default Magento tax calculations will be used.]]></comment>
|
52 |
-
<frontend_type>select</frontend_type>
|
53 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
54 |
-
<sort_order>100</sort_order>
|
55 |
-
<show_in_default>1</show_in_default>
|
56 |
-
<show_in_website>1</show_in_website>
|
57 |
-
<show_in_store>0</show_in_store>
|
58 |
-
</is_enabled>
|
59 |
-
<username translate="label">
|
60 |
-
<label>Username</label>
|
61 |
-
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
62 |
-
<frontend_type>text</frontend_type>
|
63 |
-
<sort_order>110</sort_order>
|
64 |
-
<show_in_default>1</show_in_default>
|
65 |
-
<show_in_website>1</show_in_website>
|
66 |
-
<show_in_store>0</show_in_store>
|
67 |
-
<validate>required-entry</validate>
|
68 |
-
</username>
|
69 |
-
<password translate="label">
|
70 |
-
<label>Password</label>
|
71 |
-
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
72 |
-
<frontend_type>obscure</frontend_type>
|
73 |
-
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
74 |
-
<sort_order>115</sort_order>
|
75 |
-
<show_in_default>1</show_in_default>
|
76 |
-
<show_in_website>1</show_in_website>
|
77 |
-
<show_in_store>0</show_in_store>
|
78 |
-
<validate>required-entry</validate>
|
79 |
-
</password>
|
80 |
-
<company_code translate="label">
|
81 |
-
<label>Company Code</label>
|
82 |
-
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
83 |
-
<frontend_type>text</frontend_type>
|
84 |
-
<sort_order>120</sort_order>
|
85 |
-
<show_in_default>1</show_in_default>
|
86 |
-
<show_in_website>1</show_in_website>
|
87 |
-
<show_in_store>0</show_in_store>
|
88 |
-
<validate>required-entry</validate>
|
89 |
-
</company_code>
|
90 |
-
<is_test_mode translate="label">
|
91 |
-
<label>Test Mode</label>
|
92 |
-
<comment><![CDATA[
|
93 |
-
Switching between test and production accounts.<br/>
|
94 |
-
Please make sure to select the correct account with your credentials.]]>
|
95 |
-
</comment>
|
96 |
-
<frontend_type>select</frontend_type>
|
97 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
-
<sort_order>125</sort_order>
|
99 |
-
<show_in_default>1</show_in_default>
|
100 |
-
<show_in_website>1</show_in_website>
|
101 |
-
<show_in_store>0</show_in_store>
|
102 |
-
</is_test_mode>
|
103 |
-
<authentication_wizard translate="button_label">
|
104 |
-
<label></label>
|
105 |
-
<comment><![CDATA[
|
106 |
-
Please <b style="color: red;">save</b> the configuration after validating your login credentials.
|
107 |
-
]]></comment>
|
108 |
-
<button_label>Validate login credentials</button_label>
|
109 |
-
<frontend_model>speedtax/adminhtml_system_config_form_field_authentication</frontend_model>
|
110 |
-
<sort_order>150</sort_order>
|
111 |
-
<show_in_default>1</show_in_default>
|
112 |
-
<show_in_website>1</show_in_website>
|
113 |
-
<show_in_store>0</show_in_store>
|
114 |
-
</authentication_wizard>
|
115 |
-
<is_tax_shipping translate="label">
|
116 |
-
<label>Calculate Taxes On Shipping/Handling Cost</label>
|
117 |
-
<comment><![CDATA[
|
118 |
-
If "Yes", a separate shipping line item will be used to calculate the shipping tax.<br/>
|
119 |
-
The tax code of this line item can be specified below.
|
120 |
-
]]></comment>
|
121 |
-
<frontend_type>select</frontend_type>
|
122 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
123 |
-
<sort_order>300</sort_order>
|
124 |
-
<show_in_default>1</show_in_default>
|
125 |
-
<show_in_website>1</show_in_website>
|
126 |
-
<show_in_store>0</show_in_store>
|
127 |
-
</is_tax_shipping>
|
128 |
-
<shipping_tax_code translate="label">
|
129 |
-
<label>Shipping Tax Code</label>
|
130 |
-
<comment><![CDATA[Default value: "Shipping"]]></comment>
|
131 |
-
<frontend_type>text</frontend_type>
|
132 |
-
<sort_order>310</sort_order>
|
133 |
-
<show_in_default>1</show_in_default>
|
134 |
-
<show_in_website>1</show_in_website>
|
135 |
-
<show_in_store>0</show_in_store>
|
136 |
-
</shipping_tax_code>
|
137 |
-
<is_use_product_tax_class translate="label">
|
138 |
-
<label>Use Product Tax Class as Tax Code</label>
|
139 |
-
<comment><![CDATA[
|
140 |
-
Default value: "No", where SKU will be used for product tax code.<br/>
|
141 |
-
If "Yes", product tax class name will be used instead.
|
142 |
-
]]></comment>
|
143 |
-
<frontend_type>select</frontend_type>
|
144 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
145 |
-
<sort_order>320</sort_order>
|
146 |
-
<show_in_default>1</show_in_default>
|
147 |
-
<show_in_website>1</show_in_website>
|
148 |
-
<show_in_store>0</show_in_store>
|
149 |
-
</is_use_product_tax_class>
|
150 |
-
<origins translate="label">
|
151 |
-
<label>Nexus</label>
|
152 |
-
<comment><![CDATA[
|
153 |
-
Multi-select. Select <b style="color: red;">all states</b> where you have nexus and want sales taxes to be used for.
|
154 |
-
]]></comment>
|
155 |
-
<frontend_type>multiselect</frontend_type>
|
156 |
-
<sort_order>350</sort_order>
|
157 |
-
<source_model>speedtax/source_usregions</source_model>
|
158 |
-
<show_in_default>1</show_in_default>
|
159 |
-
<show_in_website>1</show_in_website>
|
160 |
-
<show_in_store>0</show_in_store>
|
161 |
-
<validate>required-entry</validate>
|
162 |
-
</origins>
|
163 |
-
<tax_exempt_customer_group translate="label">
|
164 |
-
<label>Tax Exempt Customer Group</label>
|
165 |
-
<comment><![CDATA[
|
166 |
-
Multi-select.
|
167 |
-
]]></comment>
|
168 |
-
<frontend_type>multiselect</frontend_type>
|
169 |
-
<source_model>adminhtml/system_config_source_customer_group</source_model>
|
170 |
-
<sort_order>400</sort_order>
|
171 |
-
<show_in_default>1</show_in_default>
|
172 |
-
<show_in_website>1</show_in_website>
|
173 |
-
<show_in_store>0</show_in_store>
|
174 |
-
<can_be_empty>1</can_be_empty>
|
175 |
-
</tax_exempt_customer_group>
|
176 |
-
<is_debug_transaction translate="label">
|
177 |
-
<label>Debug Transactions</label>
|
178 |
-
<comment><![CDATA[If "Yes", transactions will be logged.]]></comment>
|
179 |
-
<frontend_type>select</frontend_type>
|
180 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
181 |
-
<sort_order>900</sort_order>
|
182 |
-
<show_in_default>1</show_in_default>
|
183 |
-
<show_in_website>1</show_in_website>
|
184 |
-
<show_in_store>0</show_in_store>
|
185 |
-
</is_debug_transaction>
|
186 |
-
</fields>
|
187 |
-
</speedtax>
|
188 |
-
<tax_by_billing>
|
189 |
-
<label>Tax By Billing Address Exceptions</label>
|
190 |
-
<sort_order>200</sort_order>
|
191 |
-
<show_in_default>1</show_in_default>
|
192 |
-
<show_in_website>1</show_in_website>
|
193 |
-
<show_in_store>0</show_in_store>
|
194 |
-
<comment><![CDATA[
|
195 |
-
<p class="switcher">
|
196 |
-
Exceptions can be created to allow tax calculated by billing address (instead of by shipping address), if:<br/>
|
197 |
-
1) The order is billed from a state listed in the "Billing Orgin States" section; and<br/>
|
198 |
-
2) The order is <b>NOT</b> shipped to any state listed in the "Billing Orgin States" section.
|
199 |
-
</p>
|
200 |
-
]]></comment>
|
201 |
-
<fields>
|
202 |
-
<is_enabled translate="label">
|
203 |
-
<label>Is Enabled</label>
|
204 |
-
<comment><![CDATA[]]></comment>
|
205 |
-
<frontend_type>select</frontend_type>
|
206 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
207 |
-
<sort_order>100</sort_order>
|
208 |
-
<show_in_default>1</show_in_default>
|
209 |
-
<show_in_website>1</show_in_website>
|
210 |
-
<show_in_store>0</show_in_store>
|
211 |
-
</is_enabled>
|
212 |
-
<billing_origins translate="label">
|
213 |
-
<label>Billing Orgin States</label>
|
214 |
-
<comment><![CDATA[Multiple-select. Please make sure the selected state(s) is in the list of your nexus.]]></comment>
|
215 |
-
<frontend_type>multiselect</frontend_type>
|
216 |
-
<sort_order>200</sort_order>
|
217 |
-
<source_model>speedtax/source_usregions</source_model>
|
218 |
-
<show_in_default>1</show_in_default>
|
219 |
-
<show_in_website>1</show_in_website>
|
220 |
-
<show_in_store>0</show_in_store>
|
221 |
-
</billing_origins>
|
222 |
-
</fields>
|
223 |
-
</tax_by_billing>
|
224 |
-
<failsafe>
|
225 |
-
<label>Fail Safe Configuration</label>
|
226 |
-
<comment><![CDATA[
|
227 |
-
<p class="switcher">
|
228 |
-
Fail safe logic provides an additional layer of robustness to the tax integration.<br/>
|
229 |
-
This mechanism allows the customer to complete checkout in case the SalesTax service is unreachable.<br/>
|
230 |
-
Magento processes supported for fail safe: checkout, place order and invoice pay.<br/>
|
231 |
-
1) During tax calculation, state level tax rates for default taxable goods are stored in Magento in case of a future failure.<br/>
|
232 |
-
2) If the invoice cannot be posted to SalesTax, the invoice processing workflow can continue. The problematic invoices can be posted to SalesTax later.
|
233 |
-
</p>
|
234 |
-
]]></comment>
|
235 |
-
<sort_order>200</sort_order>
|
236 |
-
<show_in_default>1</show_in_default>
|
237 |
-
<show_in_website>1</show_in_website>
|
238 |
-
<show_in_store>0</show_in_store>
|
239 |
-
<fields>
|
240 |
-
<is_enabled translate="label">
|
241 |
-
<label>Is Enabled</label>
|
242 |
-
<comment><![CDATA[]]></comment>
|
243 |
-
<frontend_type>select</frontend_type>
|
244 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
245 |
-
<sort_order>100</sort_order>
|
246 |
-
<show_in_default>1</show_in_default>
|
247 |
-
<show_in_website>1</show_in_website>
|
248 |
-
<show_in_store>0</show_in_store>
|
249 |
-
</is_enabled>
|
250 |
-
<is_auto_post_failsafe_invoice translate="label">
|
251 |
-
<label>Auto Post Fail Safe Invoice</label>
|
252 |
-
<comment><![CDATA[
|
253 |
-
If "Yes", fail safe invoice can be posted to SalesTax automatically.<br/>
|
254 |
-
Please make sure Magento cron job is running.
|
255 |
-
]]></comment>
|
256 |
-
<frontend_type>select</frontend_type>
|
257 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
258 |
-
<sort_order>200</sort_order>
|
259 |
-
<show_in_default>1</show_in_default>
|
260 |
-
<show_in_website>1</show_in_website>
|
261 |
-
<show_in_store>0</show_in_store>
|
262 |
-
</is_auto_post_failsafe_invoice>
|
263 |
-
</fields>
|
264 |
-
</failsafe>
|
265 |
-
<help_extra>
|
266 |
-
<label>SalesTax.com Help</label>
|
267 |
-
<comment><![CDATA[
|
268 |
-
<p class="switcher">
|
269 |
-
Get help with configuring and setting up the SalesTax.com module at <a href="http://www.harapartners.com/salestax/help#configuration" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax/help#configuration</a>.<br/>
|
270 |
-
Find more information at <a href="http://www.harapartners.com/salestax/help" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax/help</a>.<br/>
|
271 |
-
Learn more about the SalesTax.com solution, additional features, updates and help at <a href="http://www.harapartners.com/salestax" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax</a>.
|
272 |
-
</p>
|
273 |
-
]]></comment>
|
274 |
-
<sort_order>300</sort_order>
|
275 |
-
<show_in_default>1</show_in_default>
|
276 |
-
<show_in_website>1</show_in_website>
|
277 |
-
<show_in_store>0</show_in_store>
|
278 |
-
<expanded>1</expanded>
|
279 |
-
</help_extra>
|
280 |
-
</groups>
|
281 |
-
</speedtax>
|
282 |
-
<shipping>
|
283 |
-
<groups>
|
284 |
-
<origin>
|
285 |
-
<fields>
|
286 |
-
<street translate="label">
|
287 |
-
<label><![CDATA[Number & Street]]></label>
|
288 |
-
<frontend_type>text</frontend_type>
|
289 |
-
<sort_order>99</sort_order>
|
290 |
-
<show_in_default>1</show_in_default>
|
291 |
-
<show_in_website>1</show_in_website>
|
292 |
-
<show_in_store>0</show_in_store>
|
293 |
-
</street>
|
294 |
-
</fields>
|
295 |
-
</origin>
|
296 |
-
</groups>
|
297 |
-
</shipping>
|
298 |
-
</sections>
|
299 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.harapartners.com/license
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<sections>
|
17 |
+
<speedtax translate="label" module="speedtax">
|
18 |
+
<class>speedtax-section</class>
|
19 |
+
<label><![CDATA[SalesTax.com by <br/><img src="https://www.harapartners.com/skin/frontend/enterprise/harapartners/images/hp/HP2.0Logo.png" alt="HaraPartners" width="100" height="20">]]></label>
|
20 |
+
<header_css>speedtax-header</header_css>
|
21 |
+
<tab>sales</tab>
|
22 |
+
<sort_order>304</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<groups>
|
27 |
+
<signup>
|
28 |
+
<label>Sign up for SalesTax.com</label>
|
29 |
+
<comment><![CDATA[
|
30 |
+
<p class="switcher">
|
31 |
+
Sign up for a <a href="http://harapartners.com/solutions/salestax/30daytrial" target="_blank" style="color: #00C3FF;">Free 30 Day Trial</a>.<br/>
|
32 |
+
<a href="http://www.harapartners.com/solutions/salestax/signup" target="_blank" style="color: #00C3FF;">Sign up for SalesTax.com to process your Sales Taxes.</a>.<br/>
|
33 |
+
Call with questions at <b>646-663-5672</b> or find more information under <a href="http://www.harapartners.com/salestax" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax</a>.
|
34 |
+
</p>
|
35 |
+
]]></comment>
|
36 |
+
<sort_order>0</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
<expanded>1</expanded>
|
41 |
+
</signup>
|
42 |
+
<speedtax>
|
43 |
+
<label>SalesTax.com Configuration</label>
|
44 |
+
<sort_order>100</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<is_enabled translate="label">
|
50 |
+
<label>Status</label>
|
51 |
+
<comment><![CDATA[If "No", default Magento tax calculations will be used.]]></comment>
|
52 |
+
<frontend_type>select</frontend_type>
|
53 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
54 |
+
<sort_order>100</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>0</show_in_store>
|
58 |
+
</is_enabled>
|
59 |
+
<username translate="label">
|
60 |
+
<label>Username</label>
|
61 |
+
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>110</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>0</show_in_store>
|
67 |
+
<validate>required-entry</validate>
|
68 |
+
</username>
|
69 |
+
<password translate="label">
|
70 |
+
<label>Password</label>
|
71 |
+
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
72 |
+
<frontend_type>obscure</frontend_type>
|
73 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
74 |
+
<sort_order>115</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>0</show_in_store>
|
78 |
+
<validate>required-entry</validate>
|
79 |
+
</password>
|
80 |
+
<company_code translate="label">
|
81 |
+
<label>Company Code</label>
|
82 |
+
<comment><![CDATA[Please check the credentials in the sign up email.]]></comment>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>120</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>0</show_in_store>
|
88 |
+
<validate>required-entry</validate>
|
89 |
+
</company_code>
|
90 |
+
<is_test_mode translate="label">
|
91 |
+
<label>Test Mode</label>
|
92 |
+
<comment><![CDATA[
|
93 |
+
Switching between test and production accounts.<br/>
|
94 |
+
Please make sure to select the correct account with your credentials.]]>
|
95 |
+
</comment>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
+
<sort_order>125</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>0</show_in_store>
|
102 |
+
</is_test_mode>
|
103 |
+
<authentication_wizard translate="button_label">
|
104 |
+
<label></label>
|
105 |
+
<comment><![CDATA[
|
106 |
+
Please <b style="color: red;">save</b> the configuration after validating your login credentials.
|
107 |
+
]]></comment>
|
108 |
+
<button_label>Validate login credentials</button_label>
|
109 |
+
<frontend_model>speedtax/adminhtml_system_config_form_field_authentication</frontend_model>
|
110 |
+
<sort_order>150</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>0</show_in_store>
|
114 |
+
</authentication_wizard>
|
115 |
+
<is_tax_shipping translate="label">
|
116 |
+
<label>Calculate Taxes On Shipping/Handling Cost</label>
|
117 |
+
<comment><![CDATA[
|
118 |
+
If "Yes", a separate shipping line item will be used to calculate the shipping tax.<br/>
|
119 |
+
The tax code of this line item can be specified below.
|
120 |
+
]]></comment>
|
121 |
+
<frontend_type>select</frontend_type>
|
122 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
123 |
+
<sort_order>300</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
</is_tax_shipping>
|
128 |
+
<shipping_tax_code translate="label">
|
129 |
+
<label>Shipping Tax Code</label>
|
130 |
+
<comment><![CDATA[Default value: "Shipping"]]></comment>
|
131 |
+
<frontend_type>text</frontend_type>
|
132 |
+
<sort_order>310</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
</shipping_tax_code>
|
137 |
+
<is_use_product_tax_class translate="label">
|
138 |
+
<label>Use Product Tax Class as Tax Code</label>
|
139 |
+
<comment><![CDATA[
|
140 |
+
Default value: "No", where SKU will be used for product tax code.<br/>
|
141 |
+
If "Yes", product tax class name will be used instead.
|
142 |
+
]]></comment>
|
143 |
+
<frontend_type>select</frontend_type>
|
144 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
145 |
+
<sort_order>320</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>0</show_in_store>
|
149 |
+
</is_use_product_tax_class>
|
150 |
+
<origins translate="label">
|
151 |
+
<label>Nexus</label>
|
152 |
+
<comment><![CDATA[
|
153 |
+
Multi-select. Select <b style="color: red;">all states</b> where you have nexus and want sales taxes to be used for.
|
154 |
+
]]></comment>
|
155 |
+
<frontend_type>multiselect</frontend_type>
|
156 |
+
<sort_order>350</sort_order>
|
157 |
+
<source_model>speedtax/source_usregions</source_model>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>0</show_in_store>
|
161 |
+
<validate>required-entry</validate>
|
162 |
+
</origins>
|
163 |
+
<tax_exempt_customer_group translate="label">
|
164 |
+
<label>Tax Exempt Customer Group</label>
|
165 |
+
<comment><![CDATA[
|
166 |
+
Multi-select.
|
167 |
+
]]></comment>
|
168 |
+
<frontend_type>multiselect</frontend_type>
|
169 |
+
<source_model>adminhtml/system_config_source_customer_group</source_model>
|
170 |
+
<sort_order>400</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>0</show_in_store>
|
174 |
+
<can_be_empty>1</can_be_empty>
|
175 |
+
</tax_exempt_customer_group>
|
176 |
+
<is_debug_transaction translate="label">
|
177 |
+
<label>Debug Transactions</label>
|
178 |
+
<comment><![CDATA[If "Yes", transactions will be logged.]]></comment>
|
179 |
+
<frontend_type>select</frontend_type>
|
180 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
181 |
+
<sort_order>900</sort_order>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>0</show_in_store>
|
185 |
+
</is_debug_transaction>
|
186 |
+
</fields>
|
187 |
+
</speedtax>
|
188 |
+
<tax_by_billing>
|
189 |
+
<label>Tax By Billing Address Exceptions</label>
|
190 |
+
<sort_order>200</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>0</show_in_store>
|
194 |
+
<comment><![CDATA[
|
195 |
+
<p class="switcher">
|
196 |
+
Exceptions can be created to allow tax calculated by billing address (instead of by shipping address), if:<br/>
|
197 |
+
1) The order is billed from a state listed in the "Billing Orgin States" section; and<br/>
|
198 |
+
2) The order is <b>NOT</b> shipped to any state listed in the "Billing Orgin States" section.
|
199 |
+
</p>
|
200 |
+
]]></comment>
|
201 |
+
<fields>
|
202 |
+
<is_enabled translate="label">
|
203 |
+
<label>Is Enabled</label>
|
204 |
+
<comment><![CDATA[]]></comment>
|
205 |
+
<frontend_type>select</frontend_type>
|
206 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
207 |
+
<sort_order>100</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>0</show_in_store>
|
211 |
+
</is_enabled>
|
212 |
+
<billing_origins translate="label">
|
213 |
+
<label>Billing Orgin States</label>
|
214 |
+
<comment><![CDATA[Multiple-select. Please make sure the selected state(s) is in the list of your nexus.]]></comment>
|
215 |
+
<frontend_type>multiselect</frontend_type>
|
216 |
+
<sort_order>200</sort_order>
|
217 |
+
<source_model>speedtax/source_usregions</source_model>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>1</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
</billing_origins>
|
222 |
+
</fields>
|
223 |
+
</tax_by_billing>
|
224 |
+
<failsafe>
|
225 |
+
<label>Fail Safe Configuration</label>
|
226 |
+
<comment><![CDATA[
|
227 |
+
<p class="switcher">
|
228 |
+
Fail safe logic provides an additional layer of robustness to the tax integration.<br/>
|
229 |
+
This mechanism allows the customer to complete checkout in case the SalesTax service is unreachable.<br/>
|
230 |
+
Magento processes supported for fail safe: checkout, place order and invoice pay.<br/>
|
231 |
+
1) During tax calculation, state level tax rates for default taxable goods are stored in Magento in case of a future failure.<br/>
|
232 |
+
2) If the invoice cannot be posted to SalesTax, the invoice processing workflow can continue. The problematic invoices can be posted to SalesTax later.
|
233 |
+
</p>
|
234 |
+
]]></comment>
|
235 |
+
<sort_order>200</sort_order>
|
236 |
+
<show_in_default>1</show_in_default>
|
237 |
+
<show_in_website>1</show_in_website>
|
238 |
+
<show_in_store>0</show_in_store>
|
239 |
+
<fields>
|
240 |
+
<is_enabled translate="label">
|
241 |
+
<label>Is Enabled</label>
|
242 |
+
<comment><![CDATA[]]></comment>
|
243 |
+
<frontend_type>select</frontend_type>
|
244 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
245 |
+
<sort_order>100</sort_order>
|
246 |
+
<show_in_default>1</show_in_default>
|
247 |
+
<show_in_website>1</show_in_website>
|
248 |
+
<show_in_store>0</show_in_store>
|
249 |
+
</is_enabled>
|
250 |
+
<is_auto_post_failsafe_invoice translate="label">
|
251 |
+
<label>Auto Post Fail Safe Invoice</label>
|
252 |
+
<comment><![CDATA[
|
253 |
+
If "Yes", fail safe invoice can be posted to SalesTax automatically.<br/>
|
254 |
+
Please make sure Magento cron job is running.
|
255 |
+
]]></comment>
|
256 |
+
<frontend_type>select</frontend_type>
|
257 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
258 |
+
<sort_order>200</sort_order>
|
259 |
+
<show_in_default>1</show_in_default>
|
260 |
+
<show_in_website>1</show_in_website>
|
261 |
+
<show_in_store>0</show_in_store>
|
262 |
+
</is_auto_post_failsafe_invoice>
|
263 |
+
</fields>
|
264 |
+
</failsafe>
|
265 |
+
<help_extra>
|
266 |
+
<label>SalesTax.com Help</label>
|
267 |
+
<comment><![CDATA[
|
268 |
+
<p class="switcher">
|
269 |
+
Get help with configuring and setting up the SalesTax.com module at <a href="http://www.harapartners.com/salestax/help#configuration" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax/help#configuration</a>.<br/>
|
270 |
+
Find more information at <a href="http://www.harapartners.com/salestax/help" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax/help</a>.<br/>
|
271 |
+
Learn more about the SalesTax.com solution, additional features, updates and help at <a href="http://www.harapartners.com/salestax" target="_blank" style="color: #00C3FF;">http://www.harapartners.com/salestax</a>.
|
272 |
+
</p>
|
273 |
+
]]></comment>
|
274 |
+
<sort_order>300</sort_order>
|
275 |
+
<show_in_default>1</show_in_default>
|
276 |
+
<show_in_website>1</show_in_website>
|
277 |
+
<show_in_store>0</show_in_store>
|
278 |
+
<expanded>1</expanded>
|
279 |
+
</help_extra>
|
280 |
+
</groups>
|
281 |
+
</speedtax>
|
282 |
+
<shipping>
|
283 |
+
<groups>
|
284 |
+
<origin>
|
285 |
+
<fields>
|
286 |
+
<street translate="label">
|
287 |
+
<label><![CDATA[Number & Street]]></label>
|
288 |
+
<frontend_type>text</frontend_type>
|
289 |
+
<sort_order>99</sort_order>
|
290 |
+
<show_in_default>1</show_in_default>
|
291 |
+
<show_in_website>1</show_in_website>
|
292 |
+
<show_in_store>0</show_in_store>
|
293 |
+
</street>
|
294 |
+
</fields>
|
295 |
+
</origin>
|
296 |
+
</groups>
|
297 |
+
</shipping>
|
298 |
+
</sections>
|
299 |
+
</config>
|
app/code/community/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.0.9-3.1.0.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
$installer = $this;
|
14 |
-
$installer->startSetup();
|
15 |
-
|
16 |
-
// ================ Invoice ================ //
|
17 |
-
$installer->getConnection()->addColumn(
|
18 |
-
$installer->getTable('sales/invoice'),
|
19 |
-
"speedtax_invoice_number",
|
20 |
-
"VARCHAR(255) COMMENT 'SpeedTax Invoice Number'"
|
21 |
-
);
|
22 |
-
$installer->getConnection()->addColumn(
|
23 |
-
$installer->getTable('sales/invoice'),
|
24 |
-
"speedtax_invoice_status",
|
25 |
-
"SMALLINT(5) DEFAULT '0' COMMENT 'SpeedTax Invoice Status'"
|
26 |
-
);
|
27 |
-
$installer->getConnection()->addColumn(
|
28 |
-
$installer->getTable('sales/invoice'),
|
29 |
-
"speedtax_transaction_id",
|
30 |
-
"VARCHAR(255) COMMENT 'SpeedTax Transaction ID'"
|
31 |
-
);
|
32 |
-
|
33 |
-
// ================ Credit Memo ================ //
|
34 |
-
$installer->getConnection()->addColumn(
|
35 |
-
$installer->getTable('sales/creditmemo'),
|
36 |
-
"speedtax_invoice_number",
|
37 |
-
"VARCHAR(255) COMMENT 'SpeedTax Invoice Number'"
|
38 |
-
);
|
39 |
-
$installer->getConnection()->addColumn(
|
40 |
-
$installer->getTable('sales/creditmemo'),
|
41 |
-
"speedtax_invoice_status",
|
42 |
-
"SMALLINT(5) DEFAULT '0' COMMENT 'SpeedTax Invoice Status'"
|
43 |
-
);
|
44 |
-
$installer->getConnection()->addColumn(
|
45 |
-
$installer->getTable('sales/creditmemo'),
|
46 |
-
"speedtax_transaction_id",
|
47 |
-
"VARCHAR(255) COMMENT 'SpeedTax Transaction ID'"
|
48 |
-
);
|
49 |
-
|
50 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
$installer = $this;
|
14 |
+
$installer->startSetup();
|
15 |
+
|
16 |
+
// ================ Invoice ================ //
|
17 |
+
$installer->getConnection()->addColumn(
|
18 |
+
$installer->getTable('sales/invoice'),
|
19 |
+
"speedtax_invoice_number",
|
20 |
+
"VARCHAR(255) COMMENT 'SpeedTax Invoice Number'"
|
21 |
+
);
|
22 |
+
$installer->getConnection()->addColumn(
|
23 |
+
$installer->getTable('sales/invoice'),
|
24 |
+
"speedtax_invoice_status",
|
25 |
+
"SMALLINT(5) DEFAULT '0' COMMENT 'SpeedTax Invoice Status'"
|
26 |
+
);
|
27 |
+
$installer->getConnection()->addColumn(
|
28 |
+
$installer->getTable('sales/invoice'),
|
29 |
+
"speedtax_transaction_id",
|
30 |
+
"VARCHAR(255) COMMENT 'SpeedTax Transaction ID'"
|
31 |
+
);
|
32 |
+
|
33 |
+
// ================ Credit Memo ================ //
|
34 |
+
$installer->getConnection()->addColumn(
|
35 |
+
$installer->getTable('sales/creditmemo'),
|
36 |
+
"speedtax_invoice_number",
|
37 |
+
"VARCHAR(255) COMMENT 'SpeedTax Invoice Number'"
|
38 |
+
);
|
39 |
+
$installer->getConnection()->addColumn(
|
40 |
+
$installer->getTable('sales/creditmemo'),
|
41 |
+
"speedtax_invoice_status",
|
42 |
+
"SMALLINT(5) DEFAULT '0' COMMENT 'SpeedTax Invoice Status'"
|
43 |
+
);
|
44 |
+
$installer->getConnection()->addColumn(
|
45 |
+
$installer->getTable('sales/creditmemo'),
|
46 |
+
"speedtax_transaction_id",
|
47 |
+
"VARCHAR(255) COMMENT 'SpeedTax Transaction ID'"
|
48 |
+
);
|
49 |
+
|
50 |
$installer->endSetup();
|
app/code/community/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.9.9-4.0.0.php
CHANGED
@@ -1,101 +1,101 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* NOTICE OF LICENSE
|
4 |
-
*
|
5 |
-
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
-
* It is also available through the world-wide-web at this URL:
|
7 |
-
* http://www.harapartners.com/license [^]
|
8 |
-
* If you did not receive a copy of the license and are unable to
|
9 |
-
* obtain it through the world-wide-web, please send an email
|
10 |
-
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
$installer = $this;
|
14 |
-
$installer->startSetup();
|
15 |
-
|
16 |
-
// ================= Calculation Table ================= //
|
17 |
-
$calculationTable = $installer->getConnection()
|
18 |
-
->newTable($installer->getTable('speedtax/failsafe_calculation_rate'))
|
19 |
-
->addColumn('rate_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
-
'identity' => true,
|
21 |
-
'unsigned' => true,
|
22 |
-
'nullable' => false,
|
23 |
-
'primary' => true,
|
24 |
-
), 'Auto Increment Calculation Rate ID')
|
25 |
-
->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
26 |
-
'nullable' => true,
|
27 |
-
), 'Country ID')
|
28 |
-
->addColumn('region_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
29 |
-
'nullable' => true,
|
30 |
-
), 'Region ID')
|
31 |
-
->addColumn('postcode', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
32 |
-
'nullable' => true,
|
33 |
-
), 'Postcode')
|
34 |
-
->addColumn('customer_class_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
35 |
-
'unsigned' => true,
|
36 |
-
'nullable' => true,
|
37 |
-
), 'Customer Class ID')
|
38 |
-
->addColumn('product_class_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
39 |
-
'unsigned' => true,
|
40 |
-
'nullable' => true,
|
41 |
-
), 'Product Class ID')
|
42 |
-
->addColumn('tax_rate', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
|
43 |
-
'nullable' => true,
|
44 |
-
), 'Tax Rate')
|
45 |
-
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
46 |
-
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
|
47 |
-
), 'Created At')
|
48 |
-
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
49 |
-
'nullable' => true,
|
50 |
-
), 'Updated At')
|
51 |
-
->addIndex(
|
52 |
-
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('country_id')),
|
53 |
-
array('country_id'),
|
54 |
-
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
55 |
-
)
|
56 |
-
->addIndex(
|
57 |
-
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('region_id')),
|
58 |
-
array('region_id'),
|
59 |
-
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
60 |
-
)
|
61 |
-
->addIndex(
|
62 |
-
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('postcode')),
|
63 |
-
array('postcode'),
|
64 |
-
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
65 |
-
)
|
66 |
-
->addIndex(
|
67 |
-
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('customer_class_id')),
|
68 |
-
array('customer_class_id'),
|
69 |
-
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
70 |
-
)
|
71 |
-
->addIndex(
|
72 |
-
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('product_class_id')),
|
73 |
-
array('product_class_id'),
|
74 |
-
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
75 |
-
)
|
76 |
-
->setComment('SpeedTax Failsafe Calculation Rate');
|
77 |
-
$installer->getConnection()->createTable( $calculationTable );
|
78 |
-
|
79 |
-
$installer->getConnection()->addColumn(
|
80 |
-
$installer->getTable('sales/order'),
|
81 |
-
"is_speedtax_failsafe_calculation",
|
82 |
-
"SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Is SpeedTax Failsafe Calculation'"
|
83 |
-
);
|
84 |
-
|
85 |
-
$installer->getConnection()->addColumn(
|
86 |
-
$installer->getTable('sales/invoice'),
|
87 |
-
"is_speedtax_failsafe_calculation",
|
88 |
-
"SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Is SpeedTax Failsafe Calculation'"
|
89 |
-
);
|
90 |
-
$installer->getConnection()->addColumn(
|
91 |
-
$installer->getTable('sales/invoice'),
|
92 |
-
"base_speedtax_tax_amount",
|
93 |
-
"DECIMAL(12,4) DEFAULT NULL COMMENT 'Base SpeedTax Tax Amount'"
|
94 |
-
);
|
95 |
-
$installer->getConnection()->addColumn(
|
96 |
-
$installer->getTable('sales/invoice'),
|
97 |
-
"speedtax_tax_amount",
|
98 |
-
"DECIMAL(12,4) DEFAULT NULL COMMENT 'SpeedTax Tax Amount'"
|
99 |
-
);
|
100 |
-
|
101 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* NOTICE OF LICENSE
|
4 |
+
*
|
5 |
+
* This source file is subject to the End User Software Agreement (EULA).
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.harapartners.com/license [^]
|
8 |
+
* If you did not receive a copy of the license and are unable to
|
9 |
+
* obtain it through the world-wide-web, please send an email
|
10 |
+
* to eula@harapartners.com so we can send you a copy immediately.
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
$installer = $this;
|
14 |
+
$installer->startSetup();
|
15 |
+
|
16 |
+
// ================= Calculation Table ================= //
|
17 |
+
$calculationTable = $installer->getConnection()
|
18 |
+
->newTable($installer->getTable('speedtax/failsafe_calculation_rate'))
|
19 |
+
->addColumn('rate_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'identity' => true,
|
21 |
+
'unsigned' => true,
|
22 |
+
'nullable' => false,
|
23 |
+
'primary' => true,
|
24 |
+
), 'Auto Increment Calculation Rate ID')
|
25 |
+
->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
26 |
+
'nullable' => true,
|
27 |
+
), 'Country ID')
|
28 |
+
->addColumn('region_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
29 |
+
'nullable' => true,
|
30 |
+
), 'Region ID')
|
31 |
+
->addColumn('postcode', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
|
32 |
+
'nullable' => true,
|
33 |
+
), 'Postcode')
|
34 |
+
->addColumn('customer_class_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
35 |
+
'unsigned' => true,
|
36 |
+
'nullable' => true,
|
37 |
+
), 'Customer Class ID')
|
38 |
+
->addColumn('product_class_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
39 |
+
'unsigned' => true,
|
40 |
+
'nullable' => true,
|
41 |
+
), 'Product Class ID')
|
42 |
+
->addColumn('tax_rate', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
|
43 |
+
'nullable' => true,
|
44 |
+
), 'Tax Rate')
|
45 |
+
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
46 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
|
47 |
+
), 'Created At')
|
48 |
+
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
|
49 |
+
'nullable' => true,
|
50 |
+
), 'Updated At')
|
51 |
+
->addIndex(
|
52 |
+
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('country_id')),
|
53 |
+
array('country_id'),
|
54 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
55 |
+
)
|
56 |
+
->addIndex(
|
57 |
+
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('region_id')),
|
58 |
+
array('region_id'),
|
59 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
60 |
+
)
|
61 |
+
->addIndex(
|
62 |
+
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('postcode')),
|
63 |
+
array('postcode'),
|
64 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
65 |
+
)
|
66 |
+
->addIndex(
|
67 |
+
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('customer_class_id')),
|
68 |
+
array('customer_class_id'),
|
69 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
70 |
+
)
|
71 |
+
->addIndex(
|
72 |
+
$installer->getIdxName('speedtax/failsafe_calculation_rate', array('product_class_id')),
|
73 |
+
array('product_class_id'),
|
74 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
|
75 |
+
)
|
76 |
+
->setComment('SpeedTax Failsafe Calculation Rate');
|
77 |
+
$installer->getConnection()->createTable( $calculationTable );
|
78 |
+
|
79 |
+
$installer->getConnection()->addColumn(
|
80 |
+
$installer->getTable('sales/order'),
|
81 |
+
"is_speedtax_failsafe_calculation",
|
82 |
+
"SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Is SpeedTax Failsafe Calculation'"
|
83 |
+
);
|
84 |
+
|
85 |
+
$installer->getConnection()->addColumn(
|
86 |
+
$installer->getTable('sales/invoice'),
|
87 |
+
"is_speedtax_failsafe_calculation",
|
88 |
+
"SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Is SpeedTax Failsafe Calculation'"
|
89 |
+
);
|
90 |
+
$installer->getConnection()->addColumn(
|
91 |
+
$installer->getTable('sales/invoice'),
|
92 |
+
"base_speedtax_tax_amount",
|
93 |
+
"DECIMAL(12,4) DEFAULT NULL COMMENT 'Base SpeedTax Tax Amount'"
|
94 |
+
);
|
95 |
+
$installer->getConnection()->addColumn(
|
96 |
+
$installer->getTable('sales/invoice'),
|
97 |
+
"speedtax_tax_amount",
|
98 |
+
"DECIMAL(12,4) DEFAULT NULL COMMENT 'SpeedTax Tax Amount'"
|
99 |
+
);
|
100 |
+
|
101 |
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SalesTax_Connector</name>
|
4 |
-
<version>4.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.harapartners.com/terms/eula">Hara Partners End User License Agreement</license>
|
7 |
<channel>community</channel>
|
@@ -11,9 +11,9 @@
|
|
11 |
<notes>Simplify sales and use tax calculation, compliance, and management in the cloud!
|
12 |
</notes>
|
13 |
<authors><author><name>Ken Nunes</name><user>kennuneswo</user><email>ken.nunes@wolterskluwer.com</email></author></authors>
|
14 |
-
<date>
|
15 |
-
<time>18:
|
16 |
-
<contents><target name="magecommunity"><dir name="Harapartners"><dir name="SpeedTax"><dir name="Block"><dir name="Adminhtml"><dir name="Invoice"><dir name="All"><dir name="Index"><file name="Grid.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SalesTax_Connector</name>
|
4 |
+
<version>4.1.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.harapartners.com/terms/eula">Hara Partners End User License Agreement</license>
|
7 |
<channel>community</channel>
|
11 |
<notes>Simplify sales and use tax calculation, compliance, and management in the cloud!
|
12 |
</notes>
|
13 |
<authors><author><name>Ken Nunes</name><user>kennuneswo</user><email>ken.nunes@wolterskluwer.com</email></author></authors>
|
14 |
+
<date>2015-05-22</date>
|
15 |
+
<time>18:32:59</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Harapartners"><dir name="SpeedTax"><dir name="Block"><dir name="Adminhtml"><dir name="Invoice"><dir name="All"><dir name="Index"><file name="Grid.php" hash="9e30ba4540d93b90931653a26be84ca5"/></dir><file name="Index.php" hash="3bd888b08743237ba8cd5a3366b82487"/></dir><dir name="Failsafe"><dir name="Index"><file name="Grid.php" hash="8f8e68705a3f7abab5e93d114df741ca"/></dir><file name="Index.php" hash="a96810237abda83a9a6d6f7397a4847d"/></dir><dir name="Rateverification"><dir name="Index"><file name="Grid.php" hash="890971679f6eb41955ff0bd5ed7dac70"/></dir><file name="Index.php" hash="1c4345559aa6ed8e648e5ffd3d57f4bb"/></dir></dir><file name="Notification.php" hash="3b0541ce8d61c567ef5431c23f078e13"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Authentication.php" hash="8be5a91c0aa3d23ced5a2852b940dac3"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><dir name="Connector"><file name="Data.php" hash="72b911d098b162f2172727f00062db68"/><file name="Speedtax.php" hash="5ab1b418b258cc574eef0542490a096e"/></dir><file name="Data.php" hash="8c81060064b311461cdd8e45aceaafc1"/><file name="Failsafe.php" hash="f41b5e97350fe47b1b6fa73653b49871"/><file name="Processor.php" hash="283e6c818b011de5bee4a75cc036bcf6"/></dir><dir name="Model"><dir name="Failsafe"><dir name="Calculation"><file name="Rate.php" hash="811902f52d9fe42c71f5834b5f78fba9"/></dir><file name="Calculation.php" hash="892f32e0082bff2700ac7a8d98fe4a5a"/><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="bf8a959a1883a29f5020a190aeab2a47"/></dir></dir></dir></dir><file name="Observer.php" hash="0c8b0b6b37691e041b5314f2c1d75591"/><dir name="Resource"><dir name="Failsafe"><dir name="Calculation"><dir name="Rate"><file name="Collection.php" hash="2a1c5730b4be51104a27009300eb13c1"/></dir><file name="Rate.php" hash="59a6d553ad7544d431b7952aeeb6b8e7"/></dir></dir></dir><dir name="Rewrite"><dir name="Tax"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="266bcbb46c333e594869ce3fb51b9a49"/></dir></dir></dir></dir></dir><file name="Session.php" hash="46175fe01434d91757499d5c0f7f2bee"/><dir name="Source"><file name="Usregions.php" hash="2ab7713b5b46f142e133459952cd1ef5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="InvoiceController.php" hash="ad4c95583b2f36a2b9b3715cdb96440e"/><file name="NotificationController.php" hash="1221b23c9a8612fb9913a40c7fd639a8"/><dir name="System"><dir name="Config"><file name="AjaxController.php" hash="83fad83760a495f4915d4d369c4550b1"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9489898787655e78c390e036b4897aa5"/><file name="config.xml" hash="dca35bc9afbfe7d0fd9bd1ead3c61001"/><file name="system.xml" hash="5cd01b67dd669aa81aaec0545ccae7b6"/></dir><dir name="sql"><dir name="speedtax_setup"><file name="mysql4-upgrade-3.0.9-3.1.0.php" hash="c3f6ae6b94d838d019c1ffa86f4fb2cc"/><file name="mysql4-upgrade-3.9.9-4.0.0.php" hash="8603060cf362ca9303c3e28c5c00c0da"/></dir></dir></dir><dir name="ConnectorHub"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Json.php" hash="f6df5fa48d5e7daa0f5d646fe8572402"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><dir name="Connector"><file name="Config.php" hash="55c26b5014c735494f309cae1c44553a"/><file name="Core.php" hash="bc4656b5b6ae816beb458701577253a6"/></dir><file name="Data.php" hash="c9b83fb80f0f7bb5264f7f03e9d93ad3"/><file name="Mcrypt.php" hash="928572b4884d60f03ecde04b63186ea2"/><file name="Object.php" hash="487cd77c21c8bb9dec6189cc19d8c6a5"/></dir><dir name="Model"><file name="Observer.php" hash="d6d7f852fbde7e14e6fdd5f7c75e77cd"/><dir name="Rewrite"><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="e260f23f4093e7932286f81bf48f855a"/></dir><file name="Config.php" hash="642ee9fdd6ec30b8b18f9becab5b0682"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="899cbf6a6e8c4e63af5cdc01ac9eab2a"/><file name="config.xml" hash="5bc2d845e7a78fc3c96b9ae20d4b92e9"/><file name="system.xml" hash="b5cd61a820d493d91880e978fad38160"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Harapartners_SpeedTax.xml" hash="2d4196e38996a41cc79c425519053759"/><file name="Harapartners_ConnectorHub.xml" hash="f553017467b4b32a76b1af8d32765049"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|