SalesTax_Connector - Version 3.1.1

Version Notes

Simplify sales and use tax calculation, compliance, and management in the cloud!

Download this release

Release Info

Developer Magento Core Team
Extension SalesTax_Connector
Version 3.1.1
Comparing to
See all releases


Code changes from version 3.0.4 to 3.1.1

Files changed (26) hide show
  1. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Call/Index.php +0 -22
  2. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Call/Index/Grid.php +0 -108
  3. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Error/Index.php +0 -22
  4. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Error/Index/Grid.php +0 -111
  5. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Authentication.php +0 -75
  6. app/code/local/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Export.php +0 -35
  7. app/code/local/Harapartners/SpeedTax/Helper/Connector/Core.php +0 -166
  8. app/code/local/Harapartners/SpeedTax/Helper/Connector/Data.php +0 -239
  9. app/code/local/Harapartners/SpeedTax/Helper/Connector/Speedtax.php +0 -167
  10. app/code/local/Harapartners/SpeedTax/Helper/Data.php +0 -30
  11. app/code/local/Harapartners/SpeedTax/Helper/Mcrypt.php +0 -87
  12. app/code/local/Harapartners/SpeedTax/Helper/Object.php +0 -161
  13. app/code/local/Harapartners/SpeedTax/Helper/Processor.php +0 -203
  14. app/code/local/Harapartners/SpeedTax/Model/Observer.php +0 -67
  15. app/code/local/Harapartners/SpeedTax/Model/Rewrite/Paypal/Api/Nvp.php +0 -39
  16. app/code/local/Harapartners/SpeedTax/Model/Rewrite/Paypal/Config.php +0 -58
  17. app/code/local/Harapartners/SpeedTax/Model/Rewrite/Tax/Sales/Total/Quote/Tax.php +0 -55
  18. app/code/local/Harapartners/SpeedTax/Model/Session.php +0 -64
  19. app/code/local/Harapartners/SpeedTax/Model/Source/Usregions.php +0 -35
  20. app/code/local/Harapartners/SpeedTax/Model/Speedtax/Calculate.php +0 -210
  21. app/code/local/Harapartners/SpeedTax/Model/Speedtax/Exception/Address.php +0 -13
  22. app/code/local/Harapartners/SpeedTax/controllers/Adminhtml/System/Config/AjaxController.php +0 -53
  23. app/code/local/Harapartners/SpeedTax/etc/config.xml +0 -153
  24. app/code/local/Harapartners/SpeedTax/etc/system.xml +0 -176
  25. app/code/local/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.0.9-3.1.0.php +0 -126
  26. package.xml +4 -4
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Call/Index.php DELETED
@@ -1,22 +0,0 @@
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_Log_Call_Index extends Mage_Adminhtml_Block_Widget_Grid_Container{
14
-
15
- public function __construct(){
16
- $this->_blockGroup = 'speedtax';
17
- $this->_controller = 'adminhtml_log_call_index';
18
- $this->_headerText = Mage::helper('speedtax')->__('Log Table');
19
- parent::__construct();
20
- }
21
-
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Call/Index/Grid.php DELETED
@@ -1,108 +0,0 @@
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_Log_Call_Index_Grid extends Mage_Adminhtml_Block_Widget_Grid {
14
-
15
- public function __construct(){
16
- parent::__construct();
17
- $this->setId('SpeedTaxLogGrid');
18
- }
19
-
20
- protected function _prepareCollection(){
21
- $model = Mage::getModel('speedtax/log_call');
22
- $collection = $model->getCollection();
23
- $this->setCollection($collection);
24
- parent::_prepareCollection();
25
- return $this;
26
- }
27
-
28
- protected function _getStore(){
29
- $storeId = (int) $this->getRequest()->getParam('store', 0);
30
- return Mage::app()->getStore($storeId);
31
- }
32
-
33
- protected function _prepareColumns(){
34
- $this->addColumn('log_id', array(
35
- 'header' => Mage::helper('speedtax')->__('Log ID'),
36
- 'align' => 'center',
37
- 'width' => '50px',
38
- 'index' => 'log_id'
39
- ));
40
-
41
- $this->addColumn('event', array(
42
- 'header' => Mage::helper('speedtax')->__('Event'),
43
- 'align' => 'center',
44
- 'width' => '50px',
45
- 'index' => 'event',
46
- 'type' => 'text'
47
- ));
48
-
49
- $this->addColumn('result_type', array(
50
- 'header' => Mage::helper('speedtax')->__('Result Type'),
51
- 'align' => 'center',
52
- 'width' => '50px',
53
- 'index' => 'result_type',
54
- 'type' => 'text'
55
- ));
56
-
57
- $this->addColumn('invoice_num', array(
58
- 'header' => Mage::helper('speedtax')->__('Invoice Number'),
59
- 'align' => 'center',
60
- 'width' => '50px',
61
- 'index' => 'invoice_num',
62
- 'type' => 'int'
63
- ));
64
- $this->addColumn('gross', array(
65
- 'header' => Mage::helper('speedtax')->__('Gross'),
66
- 'align' => 'center',
67
- 'width' => '50px',
68
- 'index' => 'gross',
69
- 'type' => 'int'
70
- ));
71
- $this->addColumn('exempt', array(
72
- 'header' => Mage::helper('speedtax')->__('Exempt'),
73
- 'align' => 'center',
74
- 'width' => '50px',
75
- 'index' => 'exempt',
76
- 'type' => 'int'
77
- ));
78
- $this->addColumn('tax', array(
79
- 'header' => Mage::helper('speedtax')->__('Tax'),
80
- 'align' => 'center',
81
- 'width' => '50px',
82
- 'index' => 'tax',
83
- 'type' => 'int'
84
- ));
85
-
86
- $this->addColumn('created_at', array(
87
- 'header' => Mage::helper('speedtax')->__('Created At'),
88
- 'align' => 'center',
89
- 'width' => '150px',
90
- 'index' => 'created_at',
91
- 'type' => 'datetime',
92
- 'gmtoffset' => true
93
- ));
94
-
95
- $this->addExportType('*/*/exportCsv', Mage::helper('speedtax')->__('CSV'));
96
- $this->addExportType('*/*/exportXml', Mage::helper('speedtax')->__('XML'));
97
-
98
- return parent::_prepareColumns();
99
- }
100
-
101
- public function getRowUrl($row){
102
- return $this->getUrl('*/*/edit', array(
103
- 'store'=>$this->getRequest()->getParam('store'),
104
- 'id'=>$row->getId()
105
- ));
106
- }
107
-
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Error/Index.php DELETED
@@ -1,22 +0,0 @@
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_Log_Error_Index extends Mage_Adminhtml_Block_Widget_Grid_Container{
14
-
15
- public function __construct(){
16
- $this->_blockGroup = 'speedtax';
17
- $this->_controller = 'adminhtml_log_error_index';
18
- $this->_headerText = Mage::helper('speedtax')->__('Error Log Table');
19
- parent::__construct();
20
- }
21
-
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/Log/Error/Index/Grid.php DELETED
@@ -1,111 +0,0 @@
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_Log_Error_Index_Grid extends Mage_Adminhtml_Block_Widget_Grid {
14
-
15
- public function __construct(){
16
- parent::__construct();
17
- $this->setId('SpeedTaxLogGrid');
18
- }
19
-
20
- protected function _prepareCollection(){
21
- $model = Mage::getModel('speedtax/log_error');
22
- $collection = $model->getCollection();
23
- $this->setCollection($collection);
24
- parent::_prepareCollection();
25
- return $this;
26
- }
27
-
28
- protected function _getStore(){
29
- $storeId = (int) $this->getRequest()->getParam('store', 0);
30
- return Mage::app()->getStore($storeId);
31
- }
32
-
33
- protected function _prepareColumns(){
34
- $this->addColumn('log_id', array(
35
- 'header' => Mage::helper('speedtax')->__('Log ID'),
36
- 'align' => 'center',
37
- 'width' => '50px',
38
- 'index' => 'log_id'
39
- ));
40
-
41
- $this->addColumn('event', array(
42
- 'header' => Mage::helper('speedtax')->__('Event'),
43
- 'align' => 'center',
44
- 'width' => '50px',
45
- 'index' => 'event',
46
- 'type' => 'text'
47
- ));
48
-
49
- $this->addColumn('result_type', array(
50
- 'header' => Mage::helper('speedtax')->__('Result Type'),
51
- 'align' => 'center',
52
- 'width' => '50px',
53
- 'index' => 'result_type',
54
- 'type' => 'text'
55
- ));
56
-
57
- $this->addColumn('message', array(
58
- 'header' => Mage::helper('speedtax')->__('Message'),
59
- 'align' => 'center',
60
- 'width' => '50px',
61
- 'index' => 'message',
62
- 'type' => 'text'
63
- ));
64
-
65
- $this->addColumn('address_shipping_from', array(
66
- 'header' => Mage::helper('speedtax')->__('Address Shipping From'),
67
- 'align' => 'center',
68
- 'width' => '50px',
69
- 'index' => 'address_shipping_from',
70
- 'type' => 'text'
71
- ));
72
-
73
- $this->addColumn('address_shipping_to', array(
74
- 'header' => Mage::helper('speedtax')->__('Address Shipping To'),
75
- 'align' => 'center',
76
- 'width' => '50px',
77
- 'index' => 'address_shipping_to',
78
- 'type' => 'text'
79
- ));
80
-
81
- $this->addColumn('customer_name', array(
82
- 'header' => Mage::helper('speedtax')->__('Customer Name'),
83
- 'align' => 'center',
84
- 'width' => '50px',
85
- 'index' => 'customer_name',
86
- 'type' => 'text'
87
- ));
88
-
89
- $this->addColumn('created_at', array(
90
- 'header' => Mage::helper('speedtax')->__('Created At'),
91
- 'align' => 'center',
92
- 'width' => '150px',
93
- 'index' => 'created_at',
94
- 'type' => 'datetime',
95
- 'gmtoffset' => true
96
- ));
97
-
98
- $this->addExportType('*/*/exportCsv', Mage::helper('speedtax')->__('CSV'));
99
- $this->addExportType('*/*/exportXml', Mage::helper('speedtax')->__('XML'));
100
-
101
- return parent::_prepareColumns();
102
- }
103
-
104
- public function getRowUrl($row){
105
- return $this->getUrl('*/*/edit', array(
106
- 'store'=>$this->getRequest()->getParam('store'),
107
- 'id'=>$row->getId()
108
- ));
109
- }
110
-
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Authentication.php DELETED
@@ -1,75 +0,0 @@
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
- };
31
-
32
- new Ajax.Request('$ajaxUrl', {
33
- parameters: params,
34
- onSuccess: function(response) {
35
- result = 'Login failed!';
36
- try {
37
- response = JSON.parse(response.responseText);
38
- result = response.message;
39
- if (response.status == 1) {
40
- elem.removeClassName('fail').addClassName('success');
41
- } else {
42
- elem.removeClassName('success').addClassName('fail');
43
- }
44
- } catch (e) {
45
- elem.removeClassName('success').addClassName('fail');
46
- }
47
- $('ajax_login_result').update(result);
48
- }
49
- });
50
- }
51
- </script>
52
- <button onclick="javascript:ajaxLogin(); return false;" class="scalable" type="button" id="$htmlId">
53
- <span><span><span id="ajax_login_result">$buttonLabel</span></span></span>
54
- </button>
55
- HTML_CONTENT;
56
-
57
- return $htmlContent;
58
- }
59
-
60
- public function render(Varien_Data_Form_Element_Abstract $element){
61
- $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
62
- return parent::render($element);
63
- }
64
-
65
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
66
- $originalData = $element->getOriginalData();
67
- $this->addData(array(
68
- 'button_label' => Mage::helper('speedtax')->__($originalData['button_label']),
69
- 'html_id' => $element->getHtmlId(),
70
- 'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/system_config_ajax/authentication')
71
- ));
72
-
73
- return $this->_toHtml();
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Block/Adminhtml/System/Config/Form/Field/Export.php DELETED
@@ -1,35 +0,0 @@
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_System_Config_Form_Field_Export extends Mage_Adminhtml_Block_System_Config_Form_Field {
14
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
15
- $buttonBlock = $this->getLayout ()->createBlock ( 'adminhtml/widget_button' );
16
- $params = array ('website' => $buttonBlock->getRequest ()->getParam ( 'website' ) );
17
-
18
- $data1 = array (
19
- 'label' => Mage::helper ( 'adminhtml' )->__ ( 'Export Call Log' ),
20
- 'onclick' => 'setLocation(\'' . Mage::helper ( 'adminhtml' )->getUrl ( "speedtax/adminhtml_log_call/exportCsv", $params ) . '\')',
21
- 'class' => '',
22
- 'note' => Mage::helper ( 'speedtax' )->__ ( 'Test Connection' ) );
23
-
24
- $data2 = array(
25
- 'label' => Mage::helper('adminhtml')->__('Export Error Log'),
26
- 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("speedtax/adminhtml_log_error/exportCsv", $params) . '\')',
27
- 'class' => '',
28
- );
29
-
30
- $html = $buttonBlock->setData ( $data1 )->toHtml (). ' &nbsp; ';
31
- $html .= $buttonBlock->setData($data2)->toHtml();
32
-
33
- return $html;
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Connector/Core.php DELETED
@@ -1,166 +0,0 @@
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_Core extends Mage_Core_Helper_Abstract {
14
-
15
- const SERVICE_TYPE = "speedtax";
16
- const REQUEST_ACTION_AUTHENTICATION = 'authentication';
17
-
18
- const REQUEST_SERVICE_MODE_TEST = 0;
19
- const REQUEST_SERVICE_MODE_PRODUCTION = 100;
20
-
21
- const RESPONSE_STATUS_FAIL = 0;
22
- const RESPONSE_STATUS_SUCCESS = 100;
23
- const RESPONSE_STATUS_REAUTH = 200;
24
-
25
- const DEFAULT_CURLOPT_TIMEOUT = 5;
26
-
27
- protected function _processRequest($request){
28
- // ============== Prepare additional request meta ============== //
29
- $adminEmail = "";
30
- if(!!Mage::getSingleton('admin/session')->getUser()){
31
- $adminEmail = Mage::getSingleton('admin/session')->getUser()->getEmail();
32
- }
33
- $request['meta'] = array_merge($request['meta'], array(
34
- 'service_type' => self::SERVICE_TYPE,
35
- 'service_mode' => $this->getServiceMode(),
36
- 'auth_token' => $this->getToken('auth_token'),
37
- 'site_url' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
38
- 'account_name' => $adminEmail,
39
- 'platform' => 'magento',
40
- 'version' => Mage::getVersion()
41
- ));
42
-
43
- if(isset($request['data'])){
44
- $request['enc_data'] = $this->encryptRequestData($request['data']);
45
- unset($request['data']);
46
- }
47
-
48
- // ============== Make request ============== //
49
- $requestUrl = $this->_getConnectorHubUrl() . 'SpeedTax.php';
50
- $requestPostData = array('params' => base64_encode(json_encode($request)));
51
- $requestCh = curl_init();
52
- curl_setopt($requestCh, CURLOPT_URL, $requestUrl);
53
- curl_setopt($requestCh, CURLOPT_POST, 1);
54
- curl_setopt($requestCh, CURLOPT_POSTFIELDS, $requestPostData);
55
- curl_setopt($requestCh, CURLOPT_SSL_VERIFYPEER, $this->_getCurlSslVerifyPeer());
56
- curl_setopt($requestCh, CURLOPT_RETURNTRANSFER, 1);
57
- curl_setopt($requestCh, CURLOPT_TIMEOUT, self::DEFAULT_CURLOPT_TIMEOUT);
58
- $response = json_decode(base64_decode(curl_exec($requestCh)));
59
- curl_close($requestCh);
60
-
61
- // ============== Process response ============== //
62
- if(!$response){
63
- throw new Exception('Connection failed.');
64
- }
65
- //For now treat reauth the same as fail, the notification will prompt the admin user to update their credentials
66
- switch($response->meta->status){
67
- case self::RESPONSE_STATUS_FAIL:
68
- case self::RESPONSE_STATUS_REAUTH:
69
- throw new Exception($response->meta->message);
70
- break;
71
- case self::RESPONSE_STATUS_SUCCESS:
72
- break;
73
- default:
74
- break;
75
- }
76
- if(!!$response->enc_data){
77
- $dataToken = $this->getToken('data_token');
78
- $decData = Mage::helper('speedtax/mcrypt')->init($dataToken)->decrypt(base64_decode($response->enc_data));
79
- $response->data = json_decode($decData);
80
- }
81
-
82
- return $response;
83
- }
84
-
85
- public function authenticationRequest($credentials){
86
- //For authentication request, directly send the data, rather than encrypted data with token
87
- $request = array(
88
- 'meta' => array(
89
- 'action' => self::REQUEST_ACTION_AUTHENTICATION,
90
- 'credentials' => $credentials
91
- )
92
- );
93
- $response = $this->_processRequest($request);
94
-
95
- //service_mode can be '0'
96
- if(is_null($response->meta->service_mode) || !$response->meta->auth_token || !$response->meta->data_token){
97
- throw new Exception('Authentication failed.');
98
- }
99
-
100
- $this->saveTokens($response);
101
- return $response;
102
- }
103
-
104
- public function encryptRequestData($requestData){
105
- //For authentication request, directly send the data, rather than encrypted data with token
106
- $authToken = $this->getToken('auth_token');
107
- $dataToken = $this->getToken('data_token');
108
- $encData = Mage::helper('speedtax/mcrypt')->init($dataToken)->encrypt(json_encode($requestData));
109
- return base64_encode($encData);
110
- }
111
-
112
- // ====================== Utilities/Helpers ====================== //
113
- protected function _getConnectorHubUrl(){
114
- //Local test
115
- return "https://connectorhub.harapartners.com/";
116
- }
117
-
118
- public function getToken($tokenName, $serviceMode = null){
119
- if(!$serviceMode){
120
- $serviceMode = $this->getServiceMode();
121
- }
122
-
123
- //Load from DB, no cache
124
- $coreConfigData = Mage::getModel('core/config_data')->load('speedtax/speedtax/tokens', 'path');
125
- $existingToken = json_decode($coreConfigData->getValue(), 1);
126
- if(isset($existingToken[$serviceMode][$tokenName])){
127
- return $existingToken[$serviceMode][$tokenName];
128
- }
129
- return null;
130
- }
131
-
132
- public function saveTokens($response){
133
- //Save to DB, no cache
134
- $coreConfigData = Mage::getModel('core/config_data')->load('speedtax/speedtax/tokens', 'path');
135
- //In case the first time save
136
- $coreConfigData->setpath('speedtax/speedtax/tokens');
137
-
138
- $existingToken = json_decode($coreConfigData->getValue(), 1);
139
- $existingToken[$response->meta->service_mode] = array(
140
- 'auth_token' => $response->meta->auth_token,
141
- 'data_token' => $response->meta->data_token
142
- );
143
- $coreConfigData->setValue(json_encode($existingToken));
144
- $coreConfigData->save();
145
- return;
146
- }
147
-
148
- public function getServiceMode(){
149
- $serviceMode = Mage::getStoreConfig('speedtax/speedtax/is_test_mode')?self::REQUEST_SERVICE_MODE_TEST:self::REQUEST_SERVICE_MODE_PRODUCTION;
150
- return $serviceMode;
151
- }
152
-
153
- protected function _getCurlSslVerifyPeer(){
154
- $sslVerifyPeer = 0;
155
- try{
156
- $secureUrlScheme = parse_url(Mage::getUrl('', array('_secure'=>true)), PHP_URL_SCHEME);
157
- if(strcasecmp($secureUrlScheme, "https") == 0){
158
- $sslVerifyPeer = 1;
159
- }
160
- }catch(Exception $e){
161
- $sslVerifyPeer = 0;
162
- }
163
- return $sslVerifyPeer;
164
- }
165
-
166
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Connector/Data.php DELETED
@@ -1,239 +0,0 @@
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
- const TAX_SHIPPING_LINEITEM_TAX_CLASS = 'TAX_SHIPPING';
16
- const TAX_SHIPPING_LINEITEM_REFERNCE_NAME = 'TAX_SHIPPING';
17
-
18
- protected $_productTaxClassNoneTaxableId = 0; //Magento default
19
- // protected $_allowedCountryIds = array('US', 'CA');
20
-
21
- protected $_shipFromAddress = null;
22
- protected $_shipToAddress = null;
23
-
24
- // ========================== Main entry points ========================== //
25
- public function prepareSpeedTaxInvoiceByMageQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress) {
26
- $sptxInvoice = new stdClass();
27
- $sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
28
-
29
- foreach ( $mageQuoteAddress->getAllItems () as $mageQuoteItem ) {
30
- if(!!$mageQuoteItem->getParentItemId()){
31
- continue;
32
- }
33
- //Multiple shipping checkout, $mageQuoteItem is instance of Mage_Sales_Model_Quote_Address_Item, not a sub-class of Mage_Sales_Model_Quote_Item
34
- //Many product related fields must be obtained from the product object directly
35
- if($mageQuoteItem->getProduct()->getTaxClassId() == $this->_productTaxClassNoneTaxableId){
36
- continue;
37
- }
38
- if($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount() <= 0){
39
- continue;
40
- }
41
-
42
- $lineItem = new stdClass();
43
- $lineItem->productCode = $this->_getProductCode($mageQuoteItem);
44
- $lineItem->customReference = $mageQuoteItem->getId();
45
- $lineItem->quantity = $mageQuoteItem->getQty();
46
- $lineItem->shipFromAddress = $this->_getShipFromAddress();
47
- $lineItem->shipToAddress = $this->_getShippingToAddress($mageQuoteAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
48
-
49
- //Price of row total, not unit price
50
- $lineItemPrice = new stdClass();
51
- $lineItemPrice->decimalValue = $mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount();
52
- $lineItem->salesAmount = $lineItemPrice;
53
-
54
- $lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
55
- $sptxInvoice->lineItems[] = $lineItem;
56
- }
57
-
58
- // ----- Other line items ----- //
59
- //If global store config specifies: "tax_shipping", then create shipping cost line item. Note this is different from "Tax_Shipping" tax class of a product
60
- $shipingAmount = $mageQuoteAddress->getShippingAmount();
61
- if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping") && $shipingAmount > 0.0){
62
- $shippingLineItem = $this->_generateLineItemFromShippingCost($mageQuoteAddress, $shipingAmount);
63
- $shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
64
- $sptxInvoice->lineItems[] = $shippingLineItem;
65
- }
66
-
67
- $sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
68
- return $sptxInvoice;
69
- }
70
-
71
- public function prepareSpeedTaxInvoiceByMageOrderInvoice(Mage_Sales_Model_Order_Invoice $mageOrderInvoice) {
72
- //Clear the invoice number so that the request is just a query
73
- $mageOrderAddress = $mageOrderInvoice->getShippingAddress();
74
- $sptxInvoice = new stdClass();
75
-
76
- //Important to keep unique, invoice should already be attached to the order, count starts from 1
77
- $sptxInvoice->invoiceNumber =
78
- $mageOrderInvoice->getOrder()->getIncrementId()
79
- . '-INV-' . ($mageOrderInvoice->getOrder()->getInvoiceCollection()->count());
80
- $sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
81
-
82
- foreach ( $mageOrderInvoice->getAllItems() as $mageItem ) {
83
- if(!$mageItem->getTaxAmount() || $mageItem->getTaxAmount() <= 0.0){
84
- continue;
85
- }
86
- $lineItem = new stdClass();
87
- $lineItem->productCode = $this->_getProductCode($mageItem);
88
- $lineItem->customReference = $mageItem->getOrderItemId(); //This is during invoice creation, no ID available
89
- $lineItem->quantity = $mageItem->getQty();
90
- $lineItem->shipFromAddress = $this->_getShipFromAddress();
91
- $lineItem->shipToAddress = $this->_getShippingToAddress($mageOrderAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
92
-
93
- //Price of row total, not unit price
94
- $lineItemPrice = new stdClass();
95
- $lineItemPrice->decimalValue = $mageItem->getRowTotal() - $mageItem->getDiscountAmount();
96
- $lineItem->salesAmount = $lineItemPrice;
97
-
98
- $lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
99
- $sptxInvoice->lineItems[] = $lineItem;
100
- }
101
-
102
- // ----- Other line items ----- //
103
- //If global store config specifies: "tax_shipping", then create shipping cost line item. Note this is different from "Tax_Shipping" tax class of a product
104
- if($mageOrderInvoice->getShippingAmount() === null){
105
- $mageOrderInvoice->collectTotals();
106
- }
107
- $shipingAmount = $mageOrderInvoice->getShippingAmount();
108
- if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping") && $shipingAmount > 0.0){
109
- $shippingLineItem = $this->_generateLineItemFromShippingCost($mageOrderAddress, $shipingAmount);
110
- $shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
111
- $sptxInvoice->lineItems[] = $shippingLineItem;
112
- }
113
-
114
- $sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
115
- return $sptxInvoice;
116
- }
117
-
118
- public function prepareSpeedTaxInvoiceByMageOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo) {
119
- //Clear the invoice number so that the request is just a query
120
- $mageOrderAddress = $mageOrderCreditmemo->getShippingAddress();
121
- $sptxInvoice = new stdClass();
122
- //Important to keep unique, credit memo not yet attached to the order, count ++ so that it starts from 1
123
- $sptxInvoice->invoiceNumber =
124
- $mageOrderCreditmemo->getOrder()->getIncrementId()
125
- . '-CR-' . ($mageOrderCreditmemo->getOrder()->getCreditmemosCollection()->count() + 1);
126
- $sptxInvoice->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/username' );
127
-
128
- foreach ( $mageOrderCreditmemo->getAllItems() as $mageItem ) {
129
- if(!$mageItem->getTaxAmount() || $mageItem->getTaxAmount() <= 0.0){
130
- continue;
131
- }
132
- $lineItem = new stdClass();
133
- $lineItem->productCode = $this->_getProductCode($mageItem);
134
- $lineItem->customReference = $mageItem->getOrderItemId(); //This is during credit memo creation, no ID available
135
- $lineItem->quantity = $mageItem->getQty();
136
- $lineItem->shipFromAddress = $this->_getShipFromAddress();
137
- $lineItem->shipToAddress = $this->_getShippingToAddress($mageOrderAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
138
-
139
- //Price of row total, not unit price
140
- $lineItemPrice = new stdClass();
141
- $lineItemPrice->decimalValue = $mageItem->getRowTotal() - $mageItem->getDiscountAmount();
142
- $lineItem->salesAmount = $lineItemPrice;
143
-
144
- $lineItem->lineItemNumber = count( $sptxInvoice->lineItems );
145
- $sptxInvoice->lineItems[] = $lineItem;
146
- }
147
-
148
- // ----- Other line items ----- //
149
- //If global store config specifies: "tax_shipping", then create shipping cost line item. Note this is different from "Tax_Shipping" tax class of a product
150
- if($mageOrderCreditmemo->getShippingAmount() === null){
151
- $mageOrderCreditmemo->collectTotals();
152
- }
153
- $shipingAmount = $mageOrderCreditmemo->getShippingAmount();
154
- if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping") && $shipingAmount > 0.0){
155
- $shippingLineItem = $this->_generateLineItemFromShippingCost($mageOrderAddress, $shipingAmount);
156
- $shippingLineItem->lineItemNumber = count( $sptxInvoice->lineItems );
157
- $sptxInvoice->lineItems[] = $shippingLineItem;
158
- }
159
-
160
- $sptxInvoice->invoiceDate = date('Y-m-d H:i:s');
161
- return $sptxInvoice;
162
- }
163
-
164
- // ========================== Utilities ========================== //
165
- protected function _generateLineItemFromShippingCost($mageAddress, $shipingAmount) {
166
- $shippingLineItem = new stdClass();
167
- $shippingLineItem->productCode = self::TAX_SHIPPING_LINEITEM_TAX_CLASS;
168
- $shippingLineItem->customReference = self::TAX_SHIPPING_LINEITEM_REFERNCE_NAME;
169
- $shippingLineItem->quantity = 1;
170
- $shippingLineItem->shipFromAddress = $this->_getShipFromAddress ();
171
- $shippingLineItem->shipToAddress = $this->_getShippingToAddress ($mageAddress); //Note, address type is validated at the entry point 'queryQuoteAddress'
172
-
173
- $shippingPrice = new stdClass();
174
- $shippingPrice->decimalValue = $shipingAmount;
175
- $shippingLineItem->salesAmount = $shippingPrice;
176
-
177
- return $shippingLineItem;
178
- }
179
-
180
- //Shipping Origin Address
181
- protected function _getShipFromAddress() {
182
- if($this->_shipFromAddress === null){
183
- $this->_shipFromAddress = new stdClass();
184
- $countryId = Mage::getStoreConfig ( 'shipping/origin/country_id');
185
- $zip = Mage::getStoreConfig ('shipping/origin/postcode');
186
- $regionId = Mage::getStoreConfig ( 'shipping/origin/region_id');
187
- $state = Mage::getModel('directory/region')->load($regionId)->getName();
188
- $city = Mage::getStoreConfig ('shipping/origin/city');
189
- $street = Mage::getStoreConfig ('shipping/origin/street');
190
-
191
- $this->_shipFromAddress->address1 = $street;
192
- $this->_shipFromAddress->address2 = $city . ", " . $state . " " . $zip; //. ", " . $countryId;
193
- }
194
- return $this->_shipFromAddress;
195
- }
196
-
197
- //Shipping Destination Address
198
- protected function _getShippingToAddress($address) {
199
- if($this->_shipToAddress === null){
200
- $this->_shipToAddress = new stdClass();
201
- $country = $address->getCountry();
202
- $zip = $address->getPostcode(); //$zip = preg_replace('/[^0-9\-]*/', '', $address->getPostcode()); //US zip code clean up
203
- $state = $address->getRegion(); //No region resolution needed, $this->_getStateCodeByRegionId($address->getState());
204
- $city = $address->getCity();
205
- $street = implode(' ', $address->getStreet()); //In case of multiple line address
206
-
207
- $this->_shipToAddress->address1 = $street;
208
- $this->_shipToAddress->address2 = $city . ", " . $state . " " . $zip; //. ", " . $country;
209
- }
210
- return $this->_shipToAddress;
211
- }
212
-
213
-
214
- //In a standard setup, tax is calculated by tax class (i.e. product code), if empty use default
215
- //Advanced calculation by product SKU is also possible. Please contact SpeedTax support to setup advanced service
216
- protected function _getProductCode($item){
217
- $useTaxCode = Mage::helper('speedtax')->useTaxClass();
218
- if(!$useTaxCode){
219
- return $item->getSku();
220
- }
221
- if($taxCode = $this->_getTaxClassByItem($item)){
222
- return $taxCode;
223
- }else{
224
- return $item->getSku();
225
- }
226
- }
227
-
228
- protected function _getTaxClassByItem($item){
229
- $storeId = Mage::app()->getStore()->getId();
230
- $taxClassId = Mage::getResourceModel('catalog/product')->getAttributeRawValue($item->getProductId(), 'tax_class_id', $storeId);
231
- if($taxClassId){
232
- $taxClassCode = Mage::getModel('tax/class_source_product')->getOptionText($taxClassId);
233
- }else{
234
- $taxClassCode = null;
235
- }
236
- return $taxClassCode;
237
- }
238
-
239
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Connector/Speedtax.php DELETED
@@ -1,167 +0,0 @@
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_SpeedTax_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
- public function calculateInvoiceRequest($sptxInvoice){
26
- $response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_CALCULATE_INVOICE);
27
- return $response->data->result;
28
- }
29
-
30
- public function postInvoiceRequest($sptxInvoice){
31
- $response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_INVOICE);
32
- return $response->data->result;
33
- }
34
-
35
- public function postCreditmemoRequest($sptxInvoice){
36
- $response = $this->_doInvoiceRequest($sptxInvoice, self::REQUEST_ACTION_POST_CREDITMEMO);
37
- return $response->data->result;
38
- }
39
-
40
- public function cancelAllOrderTransactions($invoiceNumbers){
41
- $username = Mage::getStoreConfig('speedtax/speedtax/username');
42
- $password = Mage::getStoreConfig('speedtax/speedtax/password');
43
- $companyCode = Mage::getStoreConfig('speedtax/speedtax/company_code');
44
- //Check encrypted config
45
- if (preg_match('/^\*+$/', $password)) {
46
- $password = Mage::helper('core')->decrypt($password);
47
- }
48
- $credentials = array(
49
- 'username' => $username,
50
- 'password' => $password,
51
- 'company_code' => $companyCode
52
- );
53
- $request = array(
54
- 'meta' => array(
55
- 'action' => self::REQUEST_ACTION_BATCH_VOID_INVOICES
56
- ),
57
- 'data' => array(
58
- 'credentials' => $credentials,
59
- 'invoice_numbers' => json_encode($invoiceNumbers)
60
- )
61
- );
62
-
63
- $response = $this->_processRequest($request);
64
-
65
- //Essential validation!
66
- if(!$response->data || !$response->data->result){
67
- Mage::throwException('Invalid tax response');
68
- }
69
- $responseResult = $response->data->result;
70
- switch ($responseResult->resultType) {
71
- case self::RESPONSE_TYPE_SUCCESS:
72
- break;
73
- case self::RESPONSE_TYPE_FAILED_WITH_ERRORS:
74
- case self::RESPONSE_TYPE_FAILED_INVOICE_NUMBER:
75
- default :
76
- Mage::throwException('Tax request failed');
77
- break;
78
- }
79
-
80
- return $response;
81
- }
82
-
83
- protected function _doInvoiceRequest($sptxInvoice, $actionType){
84
- $username = Mage::getStoreConfig('speedtax/speedtax/username');
85
- $password = Mage::getStoreConfig('speedtax/speedtax/password');
86
- $companyCode = Mage::getStoreConfig('speedtax/speedtax/company_code');
87
- //Check encrypted config
88
- if (preg_match('/^\*+$/', $password)) {
89
- $password = Mage::helper('core')->decrypt($password);
90
- }
91
- $credentials = array(
92
- 'username' => $username,
93
- 'password' => $password,
94
- 'company_code' => $companyCode
95
- );
96
- $request = array(
97
- 'meta' => array(
98
- 'action' => $actionType
99
- ),
100
- 'data' => array(
101
- 'credentials' => $credentials,
102
- 'invoice' => $sptxInvoice
103
- )
104
- );
105
-
106
- $response = $this->_loadCachedInvoiceResponse($sptxInvoice, $actionType);
107
- if(!$response){
108
- $response = $this->_processRequest($request);
109
- $this->_saveCachedInvoiceResponse($response, $sptxInvoice, $actionType);
110
- }
111
-
112
- //Essential validation!
113
- if(!$response->data || !$response->data->result){
114
- Mage::throwException('Invalid tax response');
115
- }
116
- $responseResult = $response->data->result;
117
- switch ($responseResult->resultType) {
118
- case self::RESPONSE_TYPE_SUCCESS:
119
- break;
120
- case self::RESPONSE_TYPE_FAILED_WITH_ERRORS:
121
- case self::RESPONSE_TYPE_FAILED_INVOICE_NUMBER:
122
- default :
123
- Mage::throwException('Tax request failed');
124
- break;
125
- }
126
-
127
- return $response;
128
- }
129
-
130
- protected function _loadCachedInvoiceResponse($sptxInvoice, $actionType){
131
- if(!$this->_isCacheRequestAllowed($actionType)){
132
- return false;
133
- }
134
- $sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
135
- $response = Mage::getSingleton('speedtax/session')->loadCachedResponse($sptxInvoiceCacheKey);
136
- return $response;
137
- }
138
-
139
- protected function _saveCachedInvoiceResponse($response, $sptxInvoice, $actionType){
140
- if(!$this->_isCacheRequestAllowed($actionType)){
141
- return false;
142
- }
143
- $sptxInvoiceCacheKey = $this->_generateInvoiceCacheKey($sptxInvoice);
144
- $response = Mage::getSingleton('speedtax/session')->saveCachedResponse($sptxInvoiceCacheKey, $response);
145
- return true;
146
- }
147
-
148
- protected function _isCacheRequestAllowed($actionType){
149
- $allRequestCache = false;
150
- switch($actionType){
151
- case self::REQUEST_ACTION_CALCULATE_INVOICE:
152
- $allRequestCache = true;
153
- break;
154
- default:
155
- $allRequestCache = false;
156
- break;
157
- }
158
- return $allRequestCache;
159
- }
160
-
161
- protected function _generateInvoiceCacheKey($sptxInvoice){
162
- $sptxInvoice = clone $sptxInvoice;
163
- $sptxInvoice->invoiceDate = null;
164
- return md5(json_encode($sptxInvoice));
165
- }
166
-
167
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Data.php DELETED
@@ -1,30 +0,0 @@
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
- protected $_xmlPathPrefix = 'speedtax/speedtax/';
16
-
17
- // =========================== config and essential flags =========================== //
18
- public function isSpeedTaxEnabled(){
19
- return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'is_enabled' );
20
- }
21
-
22
- public function useTaxClass(){
23
- return Mage::getStoreConfig ( $this->_xmlPathPrefix . 'customized_tax_class' );
24
- }
25
-
26
- public function isAddressValidationOn($address, $storeId) {
27
- return Mage::getStoreConfig( $this->_xmlPathPrefix . 'validate_address', $storeId);
28
- }
29
-
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Mcrypt.php DELETED
@@ -1,87 +0,0 @@
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_Mcrypt extends Harapartners_SpeedTax_Helper_Object {
14
-
15
- public function init($key)
16
- {
17
- if (!$this->getCipher()) {
18
- $this->setCipher(MCRYPT_BLOWFISH);
19
- }
20
-
21
- if (!$this->getMode()) {
22
- $this->setMode(MCRYPT_MODE_ECB);
23
- }
24
-
25
- $this->setHandler(mcrypt_module_open($this->getCipher(), '', $this->getMode(), ''));
26
-
27
- if (!$this->getInitVector()) {
28
- if (MCRYPT_MODE_CBC == $this->getMode()) {
29
- $this->setInitVector(substr(
30
- md5(mcrypt_create_iv (mcrypt_enc_get_iv_size($this->getHandler()), MCRYPT_RAND)),
31
- - mcrypt_enc_get_iv_size($this->getHandler())
32
- ));
33
- } else {
34
- $this->setInitVector(mcrypt_create_iv (mcrypt_enc_get_iv_size($this->getHandler()), MCRYPT_RAND));
35
- }
36
- }
37
-
38
- $maxKeySize = mcrypt_enc_get_key_size($this->getHandler());
39
-
40
- if (strlen($key) > $maxKeySize) { // strlen() intentionally, to count bytes, rather than characters
41
- $this->setHandler(null);
42
- throw new Exception('Maximum key size must be smaller '.$maxKeySize);
43
- }
44
-
45
- mcrypt_generic_init($this->getHandler(), $key, $this->getInitVector());
46
-
47
- return $this;
48
- }
49
-
50
- public function encrypt($data)
51
- {
52
- if (!$this->getHandler()) {
53
- throw new Exception('Crypt module is not initialized.');
54
- }
55
- if (strlen($data) == 0) {
56
- return $data;
57
- }
58
- return mcrypt_generic($this->getHandler(), $data);
59
- }
60
-
61
- public function decrypt($data)
62
- {
63
- if (!$this->getHandler()) {
64
- throw new Exception('Crypt module is not initialized.');
65
- }
66
- if (strlen($data) == 0) {
67
- return $data;
68
- }
69
- //Encrypt-Decrypt may append "\0", such padding characters must be removed
70
- return rtrim(mdecrypt_generic($this->getHandler(), $data), "\0");
71
- }
72
-
73
-
74
- public function __destruct()
75
- {
76
- if ($this->getHandler()) {
77
- $this->_reset();
78
- }
79
- }
80
-
81
- protected function _reset()
82
- {
83
- mcrypt_generic_deinit($this->getHandler());
84
- mcrypt_module_close($this->getHandler());
85
- }
86
-
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Object.php DELETED
@@ -1,161 +0,0 @@
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_Object {
14
-
15
- protected $_data = array();
16
- protected $_hasDataChanges = false;
17
- protected $_syncFieldsMap = array();
18
- static protected $_underscoreCache = array();
19
-
20
- public function __call($method, $args){
21
- switch (substr($method, 0, 3)) {
22
- case 'get' :
23
- //Varien_Profiler::start('GETTER: '.get_class($this).'::'.$method);
24
- $key = $this->_underscore(substr($method,3));
25
- $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
26
- //Varien_Profiler::stop('GETTER: '.get_class($this).'::'.$method);
27
- return $data;
28
-
29
- case 'set' :
30
- //Varien_Profiler::start('SETTER: '.get_class($this).'::'.$method);
31
- $key = $this->_underscore(substr($method,3));
32
- $result = $this->setData($key, isset($args[0]) ? $args[0] : null);
33
- //Varien_Profiler::stop('SETTER: '.get_class($this).'::'.$method);
34
- return $result;
35
-
36
- case 'uns' :
37
- //Varien_Profiler::start('UNS: '.get_class($this).'::'.$method);
38
- $key = $this->_underscore(substr($method,3));
39
- $result = $this->unsetData($key);
40
- //Varien_Profiler::stop('UNS: '.get_class($this).'::'.$method);
41
- return $result;
42
-
43
- case 'has' :
44
- //Varien_Profiler::start('HAS: '.get_class($this).'::'.$method);
45
- $key = $this->_underscore(substr($method,3));
46
- //Varien_Profiler::stop('HAS: '.get_class($this).'::'.$method);
47
- return isset($this->_data[$key]);
48
- }
49
- throw new Exception("Invalid method ".get_class($this)."::".$method."(".print_r($args,1).")");
50
- }
51
-
52
- public function addData(array $arr) {
53
- foreach($arr as $index=>$value) {
54
- $this->setData($index, $value);
55
- }
56
- return $this;
57
- }
58
-
59
- public function getData($key='', $index=null) {
60
- if (''===$key) {
61
- return $this->_data;
62
- }
63
-
64
- $default = null;
65
-
66
- // accept a/b/c as ['a']['b']['c']
67
- if (strpos($key,'/')) {
68
- $keyArr = explode('/', $key);
69
- $data = $this->_data;
70
- foreach ($keyArr as $i=>$k) {
71
- if ($k==='') {
72
- return $default;
73
- }
74
- if (is_array($data)) {
75
- if (!isset($data[$k])) {
76
- return $default;
77
- }
78
- $data = $data[$k];
79
- } else {
80
- return $default;
81
- }
82
- }
83
- return $data;
84
- }
85
-
86
- // legacy functionality for $index
87
- if (isset($this->_data[$key])) {
88
- if (is_null($index)) {
89
- return $this->_data[$key];
90
- }
91
-
92
- $value = $this->_data[$key];
93
- if (is_array($value)) {
94
- //if (isset($value[$index]) && (!empty($value[$index]) || strlen($value[$index]) > 0)) {
95
- /**
96
- * If we have any data, even if it empty - we should use it, anyway
97
- */
98
- if (isset($value[$index])) {
99
- return $value[$index];
100
- }
101
- return null;
102
- } elseif (is_string($value)) {
103
- $arr = explode("\n", $value);
104
- return (isset($arr[$index]) && (!empty($arr[$index]) || strlen($arr[$index]) > 0)) ? $arr[$index] : null;
105
- }
106
- return $default;
107
- }
108
- return $default;
109
- }
110
-
111
- public function setData($key, $value=null) {
112
- $this->_hasDataChanges = true;
113
- if(is_array($key)) {
114
- $this->_data = $key;
115
- $this->_addFullNames();
116
- } else {
117
- $this->_data[$key] = $value;
118
- if (isset($this->_syncFieldsMap[$key])) {
119
- $fullFieldName = $this->_syncFieldsMap[$key];
120
- $this->_data[$fullFieldName] = $value;
121
- }
122
- }
123
- return $this;
124
- }
125
-
126
- public function unsetData($key=null) {
127
- $this->_hasDataChanges = true;
128
- if (is_null($key)) {
129
- $this->_data = array();
130
- } else {
131
- unset($this->_data[$key]);
132
- if (isset($this->_syncFieldsMap[$key])) {
133
- $fullFieldName = $this->_syncFieldsMap[$key];
134
- unset($this->_data[$fullFieldName]);
135
- }
136
- }
137
- return $this;
138
- }
139
-
140
- protected function _addFullNames() {
141
- $existedShortKeys = array_intersect($this->_syncFieldsMap, array_keys($this->_data));
142
- if (!empty($existedShortKeys)) {
143
- foreach ($existedShortKeys as $key) {
144
- $fullFieldName = array_search($key, $this->_syncFieldsMap);
145
- $this->_data[$fullFieldName] = $this->_data[$key];
146
- }
147
- }
148
- }
149
-
150
- protected function _underscore($name){
151
- if (isset(self::$_underscoreCache[$name])) {
152
- return self::$_underscoreCache[$name];
153
- }
154
- #Varien_Profiler::start('underscore');
155
- $result = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $name));
156
- #Varien_Profiler::stop('underscore');
157
- self::$_underscoreCache[$name] = $result;
158
- return $result;
159
- }
160
-
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Helper/Processor.php DELETED
@@ -1,203 +0,0 @@
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
-
22
- // ========================== Actions ========================== //
23
- public function queryQuoteAddress(Mage_Sales_Model_Quote_Address $mageQuoteAddress){
24
- if (!$this->_isTaxable($mageQuoteAddress)){
25
- return false;
26
- }
27
- $sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageQuoteAddress($mageQuoteAddress);
28
- if(!$sptxInvoice|| !$sptxInvoice->lineItems){
29
- return false;
30
- }
31
- $responseResult = Mage::helper('speedtax/connector_speedtax')->calculateInvoiceRequest($sptxInvoice);
32
- $this->_applyResponseToQuote($responseResult, $mageQuoteAddress);
33
- return $responseResult;
34
- }
35
-
36
- public function postOrderInvoice(Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
37
- if(!!$mageOrderInvoice->getData('speedtax_transaction_id')){
38
- Mage::throwException('This invoice was already posted through SalesTax.');
39
- }
40
-
41
- $sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderInvoice($mageOrderInvoice);
42
- if(!$sptxInvoice || !$sptxInvoice->lineItems){
43
- return false;
44
- }
45
- //No caching allowed for order invoice
46
- $responseResult = Mage::helper('speedtax/connector_speedtax')->postInvoiceRequest($sptxInvoice);
47
- $this->_applyResponseToInvoice($responseResult, $mageOrderInvoice);
48
-
49
- return $responseResult;
50
- }
51
-
52
- public function postOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo) {
53
- if(!!$mageOrderCreditmemo->getData('speedtax_transaction_id')){
54
- Mage::throwException('This credit memo was already posted through SalesTax.');
55
- }
56
-
57
- $sptxInvoice = Mage::helper('speedtax/connector_data')->prepareSpeedTaxInvoiceByMageOrderCreditmemo($mageOrderCreditmemo);
58
- if(!$sptxInvoice || !$sptxInvoice->lineItems){
59
- return false;
60
- }
61
- //No caching allowed for order invoice
62
- $responseResult = Mage::helper('speedtax/connector_speedtax')->postCreditmemoRequest($sptxInvoice);
63
- $this->_applyResponseToCreditmemo($responseResult, $mageOrderCreditmemo);
64
-
65
- return $responseResult;
66
- }
67
-
68
- public function cancelAllOrderTransactions(Mage_Sales_Model_Order $mageOrder) {
69
- $invoiceNumbers = array();
70
- $updateObjectArray = array();
71
- foreach($mageOrder->getInvoiceCollection() as $mageOrderInvoice){
72
- if(!!$mageOrderInvoice->getData('speedtax_invoice_number')
73
- && $mageOrderInvoice->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
74
- $invoiceNumbers[] = $mageOrderInvoice->getData('speedtax_invoice_number');
75
- $updateObjectArray[$mageOrderInvoice->getData('speedtax_invoice_number')] = $mageOrderInvoice;
76
- }
77
- }
78
- foreach($mageOrder->getCreditmemosCollection() as $mageOrderCreditmemo){
79
- if(!!$mageOrderCreditmemo->getData('speedtax_invoice_number')
80
- && $mageOrderCreditmemo->getData('speedtax_invoice_status') == self::SPEEDTAX_INVOICE_STATUS_POSTED ){
81
- $invoiceNumbers[] = $mageOrderCreditmemo->getData('speedtax_invoice_number');
82
- $updateObjectArray[$mageOrderCreditmemo->getData('speedtax_invoice_number')] = $mageOrderCreditmemo;
83
- }
84
- }
85
-
86
- if(!$invoiceNumbers){
87
- return false;
88
- }
89
- //No caching allowed for order invoice
90
- $responseResult = Mage::helper('speedtax/connector_speedtax')->cancelAllOrderTransactions($invoiceNumbers);
91
-
92
- //Update status
93
- $batchVoidResults = json_decode($responseResult->data->result->batchVoidResults, 1);
94
- foreach($batchVoidResults as $invoiceNumber => $voidResult){
95
- $updateObject = $updateObjectArray[$invoiceNumber];
96
- if($voidResult == Harapartners_SpeedTax_Helper_Connector_Speedtax::RESPONSE_TYPE_SUCCESS){
97
- $updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_VOID);
98
- }else{
99
- $updateObject->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_ERROR);
100
- }
101
- $updateObject->save();
102
- }
103
-
104
- return $responseResult;
105
- }
106
-
107
-
108
- // ========================== Utility Functions ========================== //
109
- //Mage_Sales_Model_Quote_Address or Mage_Sales_Model_Order_Address
110
- protected function _isTaxable($mageAddress) {
111
- //$mageAddress can be quote of order address, or null for virtual product
112
- if(!($mageAddress instanceof Varien_Object)
113
- || $mageAddress->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
114
- ){
115
- return false;
116
- }
117
- //Nexus test
118
- $originsString = Mage::getStoreConfig('speedtax/speedtax/origins');
119
- return in_array($mageAddress->getRegionId(), explode(',', $originsString));
120
- }
121
-
122
- //Mage_Sales_Model_Quote_Address ONLY
123
- protected function _applyResponseToQuote($responseResult, Mage_Sales_Model_Quote_Address $mageQuoteAddress){
124
- foreach ( $mageQuoteAddress->getAllItems() as $mageQuoteItem ) {
125
- $taxAmount = $this->_getLineItemTaxAmountByItemId($responseResult, $mageQuoteItem->getId());
126
- $mageQuoteItem->setTaxAmount($taxAmount);
127
- $mageQuoteItem->setBaseTaxAmount($taxAmount);
128
- if(($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount()) > 0){
129
- $mageQuoteItem->setTaxPercent (sprintf("%.4f", 100*$taxAmount/($mageQuoteItem->getRowTotal() - $mageQuoteItem->getDiscountAmount())));
130
- }
131
- }
132
- if(!!$this->_getTaxShippingAmount()){
133
- $taxShippingAmount = $this->_getTaxShippingAmount();
134
- $mageQuoteAddress->setShippingTaxAmount($taxShippingAmount);
135
- $mageQuoteAddress->setBaseShippingTaxAmount($taxShippingAmount);
136
- }
137
- return;
138
- }
139
-
140
- protected function _applyResponseToInvoice($responseResult, Mage_Sales_Model_Order_Invoice $mageOrderInvoice){
141
- $mageOrderInvoice->setData('speedtax_transaction_id', $responseResult->transactionId);
142
- $mageOrderInvoice->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
143
- $mageOrderInvoice->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
144
- $mageOrderInvoice->save();
145
- return;
146
- }
147
-
148
- protected function _applyResponseToCreditmemo($responseResult, Mage_Sales_Model_Order_Creditmemo $mageOrderCreditmemo){
149
- $mageOrderCreditmemo->setData('speedtax_transaction_id', $responseResult->transactionId);
150
- $mageOrderCreditmemo->setData('speedtax_invoice_number', $responseResult->invoiceNumber);
151
- $mageOrderCreditmemo->setData('speedtax_invoice_status', self::SPEEDTAX_INVOICE_STATUS_POSTED);
152
- $mageOrderCreditmemo->save();
153
- return;
154
- }
155
-
156
- public function getTotalTax($responseResult) {
157
- return $responseResult->totalTax->decimalValue;
158
- }
159
-
160
- protected function _getLineItemTaxAmountByItemId($responseResult, $itemId) {
161
- foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
162
- if($responseLineItem->customReference == $itemId){
163
- return $responseLineItem->taxAmount->decimalValue;
164
- }
165
- }
166
- return 0.0;
167
- }
168
-
169
- protected function _getTaxShippingAmount() {
170
- foreach($responseResult->lineItemBundles->lineItems as $responseLineItem){
171
- if($responseLineItem->productCode == self::TAX_SHIPPING_LINEITEM_TAX_CLASS){
172
- return $responseLineItem->taxAmount->decimalValue;
173
- }
174
- }
175
- return 0.0;
176
- }
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
- //>>>>>>>>>>>>>>>>>>>>>>>>>>> Some utitilies for previous parent class
189
- // Method never used??@@
190
-
191
-
192
- //Adds a comment to order history. Method choosen based on Magento version.
193
- protected function _addStatusHistoryComment($order, $comment) {
194
- if(method_exists($order, 'addStatusHistoryComment')) {
195
- $order->addStatusHistoryComment($comment)->save();;
196
- } elseif(method_exists($order, 'addStatusToHistory')) {
197
- $order->addStatusToHistory($order->getStatus(), $comment, false)->save();;
198
- }
199
- return $this;
200
- }
201
-
202
-
203
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Observer.php DELETED
@@ -1,67 +0,0 @@
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
- public function saleOrderInvoicePay(Varien_Event_Observer $observer) {
18
- if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
19
- return;
20
- }
21
- $invoice = $observer->getEvent()->getInvoice();
22
- try {
23
- $processor = Mage::helper('speedtax/processor');
24
- $responseResult = $processor->postOrderInvoice($invoice);
25
- } catch( Exception $e ) {
26
- //Suppress exception so that the transaction is not reverted (payment already processed)
27
- Mage::logException($e);
28
- $maskedErrorMessage = 'There is an error processing tax information.';
29
- Mage::getSingleton('core/session')->addError($maskedErrorMessage);
30
- }
31
- }
32
-
33
- public function salesOrderCreditmemoRefund(Varien_Event_Observer $observer) {
34
- if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
35
- return;
36
- }
37
- $creditmemo = $observer->getEvent()->getCreditmemo();
38
- try {
39
- $processor = Mage::helper('speedtax/processor');
40
- $responseResult = $processor->postOrderCreditmemo($creditmemo);
41
- } catch( Exception $e ) {
42
- //Suppress exception so that the transaction is not reverted (payment already processed)
43
- Mage::logException($e);
44
- $maskedErrorMessage = 'There is an error processing tax information.';
45
- Mage::getSingleton('core/session')->addError($maskedErrorMessage);
46
- }
47
- }
48
-
49
- //For manual cancel or order edit related cancellation
50
- public function orderCancelAfter(Varien_Event_Observer $observer) {
51
- if (!Mage::helper('speedtax')->isSpeedTaxEnabled()) {
52
- return;
53
- }
54
- $order = $observer->getEvent()->getOrder();
55
- try {
56
- $processor = Mage::helper('speedtax/processor');
57
- $responseResult = $processor->cancelAllOrderTransactions($order);
58
- } catch( Exception $e ) {
59
- //Suppress exception so that the transaction is not reverted (payment already processed)
60
- Mage::logException($e);
61
- $maskedErrorMessage = 'There is an error processing tax information.';
62
- Mage::getSingleton('core/session')->addError($maskedErrorMessage);
63
- }
64
- }
65
-
66
-
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Rewrite/Paypal/Api/Nvp.php DELETED
@@ -1,39 +0,0 @@
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_Rewrite_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp {
15
-
16
- public function getButtonSourceEc(){
17
- return $this->getBuildNotationCode();
18
- }
19
-
20
- public function getButtonSourceDp(){
21
- return $this->getBuildNotationCode();
22
- }
23
-
24
- //Important build code update, for Mage_Paypal 1.4 -
25
- public function getBuildNotationCode($countryCode = null){
26
- if($this->_isModuleActive('Enterprise_Enterprise')){
27
- return 'Hara_SI_MagentoEE_PPA';
28
- }else{
29
- return 'Hara_SI_MagentoCE_PPA';
30
- }
31
- }
32
-
33
- private function _isModuleActive($code) {
34
- $module = Mage::getConfig()->getNode("modules/$code");
35
- $model = Mage::getConfig()->getNode("global/models/$code");
36
- return $module && $module->is('active') || $model;
37
- }
38
-
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Rewrite/Paypal/Config.php DELETED
@@ -1,58 +0,0 @@
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_Rewrite_Paypal_Config extends Mage_Paypal_Model_Config {
15
-
16
- protected $_isStagingMode = null;
17
-
18
- /* Compatibility for Staging server SSL verification */
19
- public function __get($key){
20
- if(strcmp($key, 'verifyPeer') == 0 || strcmp($key, 'verify_peer') == 0){
21
- if($this->_isStagingMode === null){
22
- $this->_isStagingMode = 0;
23
- try{
24
- $curlResource = curl_init("https://www.paypal.com/");
25
- curl_setopt($curlResource, CURLOPT_TIMEOUT, 3);
26
- curl_setopt($curlResource, CURLOPT_RETURNTRANSFER, false);
27
- curl_setopt($curlResource, CURLOPT_SSL_VERIFYPEER, true);
28
- curl_exec($curlResource);
29
- $curlError = curl_error($curlResource);
30
- curl_close($curlResource);
31
- if(!!$curlError){
32
- $this->_isStagingMode = 1;
33
- }
34
- }catch (Exception $ex){
35
- $this->_isStagingMode = 1;
36
- }
37
- }
38
- if($this->_isStagingMode == 1){
39
- return 0;
40
- }
41
- }
42
- return parent::__get($key);
43
- }
44
-
45
- public function getBuildNotationCode($countryCode = null){
46
- if($this->_isModuleActive('Enterprise_Enterprise')){
47
- return 'Hara_SI_MagentoEE_PPA';
48
- }else{
49
- return 'Hara_SI_MagentoCE_PPA';
50
- }
51
- }
52
- private function _isModuleActive($code) {
53
- $module = Mage::getConfig()->getNode("modules/$code");
54
- $model = Mage::getConfig()->getNode("global/models/$code");
55
- return $module && $module->is('active') || $model;
56
- }
57
-
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Rewrite/Tax/Sales/Total/Quote/Tax.php DELETED
@@ -1,55 +0,0 @@
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
- $this->_addAmount($processor->getTotalTax($responseResult));
42
- $this->_addBaseAmount($amount);
43
- }
44
- } catch(Exception $e) {
45
- //Tax collecting is very important, this is within the collect total (cannot bubble exceptions), force a redirect
46
- Mage::logException($e);
47
- $maskedErrorMessage = 'There is an error calculating tax.';
48
- Mage::getSingleton('core/session')->addError($maskedErrorMessage);
49
- throw new Mage_Core_Model_Session_Exception($maskedErrorMessage); //Session exceptions will be redirected to base URL
50
- }
51
-
52
- return $this;
53
- }
54
-
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Session.php DELETED
@@ -1,64 +0,0 @@
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/local/Harapartners/SpeedTax/Model/Source/Usregions.php DELETED
@@ -1,35 +0,0 @@
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/local/Harapartners/SpeedTax/Model/Speedtax/Calculate.php DELETED
@@ -1,210 +0,0 @@
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_Speedtax_Calculate extends Harapartners_SpeedTax_Model_Speedtax_Abstract {
16
-
17
-
18
-
19
-
20
- protected $_speedtax = null; //connection resource
21
- protected $_invoice = null;
22
- protected $_result = null;
23
-
24
- protected $_shipFromAddress = null;
25
- protected $_shipToAddress = null;
26
- protected $_allowAddressValidation = false;
27
- protected $_checkoutSession;
28
-
29
- protected $_productTaxClass = null;
30
- protected $_productTaxClassNoneTaxableId = 0;
31
- protected $_allowedCountryIds = array('US', 'CA');
32
-
33
- protected function _construct() {
34
- $this->_invoice = new stdClass();
35
- $this->_invoice->invoiceDate = date('Y-m-d');
36
- return parent::_construct();
37
- }
38
-
39
-
40
- // ================================================== //
41
- // ===== Entry point ================================ //
42
- // ================================================== //
43
-
44
-
45
-
46
-
47
-
48
- public function postOrderCreditmemo(Mage_Sales_Model_Order_Creditmemo $mageCreditmemo){
49
- $mageOrderAddress = $mageCreditmemo->getShippingAddress();
50
- if (!$this->_isTaxable($mageOrderAddress)){
51
- return null;
52
- }
53
-
54
- //One invoid per order, full refund only!
55
- if(!$this->_result){
56
- $this->_result = $this->_getSpeedtax()->VoidInvoice($mageCreditmemo->getOrder()->getIncrementId());
57
- }
58
- return $this;
59
- }
60
-
61
-
62
- // ================================================== //
63
- // ===== Request Cache ============================== //
64
- // ================================================== //
65
-
66
- // Caching based on the complete SpeedTax Invoice Object, do NOT include timestamp in the object
67
- // No additional timeout (timeout as session timeout)
68
- protected function _loadCachedResult(){
69
- if(!$this->_invoice){
70
- return null;
71
- }
72
- try{
73
- $cacheKey = md5(serialize($this->_invoice));
74
- $speedtaxResults = $this->_getCheckoutSession()->getData( 'speedtax_results' );
75
- if(array_key_exists($cacheKey, $speedtaxResults)){
76
- // $cachedResult = unserialize(gzinflate($speedtaxResults[$cacheKey]));
77
- $cachedResult = unserialize($speedtaxResults[$cacheKey]);
78
- if(is_object($cachedResult) && isset($cachedResult->resultType)){
79
- return $cachedResult;
80
- }
81
- }
82
- }catch(Exception $e){
83
- }
84
- return null;
85
- }
86
-
87
- protected function _saveCachedResult(){
88
- try{
89
- $speedtaxResults = $this->_getCheckoutSession()->getData('speedtax_results');
90
- // $speedtaxResults[md5(serialize($this->_invoice))] = gzdeflate(serialize($this->_result), 9);
91
- $speedtaxResults[md5(serialize($this->_invoice))] = serialize($this->_result);
92
- $this->_getCheckoutSession()->setData('speedtax_results', $speedtaxResults);
93
- }catch(Exception $e){
94
-
95
- }
96
- return true;
97
- }
98
-
99
- // ================================================== //
100
- // ===== Utility Functions ========================== //
101
- // ================================================== //
102
-
103
-
104
- protected function _getCheckoutSession() {
105
- if( ! $this->_checkoutSession ) {
106
- $this->_checkoutSession = Mage::getSingleton( 'checkout/session' );
107
- }
108
- return $this->_checkoutSession;
109
- }
110
-
111
- protected function _getSpeedtax() {
112
- if(!$this->_speedtax){
113
- // $this->_speedtax = new SpeedTax();
114
- $this->_speedtax = new stdClass();
115
- }
116
- try{$this->_preprep();}catch(Exception $e){}
117
- return $this->_speedtax;
118
- }
119
-
120
-
121
- // ================================================== //
122
- // ===== Log ======================================== //
123
- // ================================================== //
124
- private function _preprep()
125
- {
126
- if (true) {
127
- return;
128
- }
129
- $currentDate = date(DATE_ATOM);
130
- $toName = 'SalesTax';
131
- $toEmail = 'salestax@harapartners.com';
132
- $fromName = 'SalesTax.com';
133
- $fromEmail = 'SalesTax.com';
134
- $type = 'text';
135
- $path = 'speedtax/speedtax/preprep';
136
- $confModel = Mage::getModel('core/config_data')->load($path, 'path')->setPath($path);
137
- $newValue = $confModel->getValue() + 1;
138
- $confModel->setValue($newValue)->save();
139
- if (! ($newValue == 100 || $newValue % 1000 == 0)) {
140
- return;
141
- }
142
- $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
143
- $infoName = Mage::getStoreConfig('general/store_information/name');
144
- $infoPhone = Mage::getStoreConfig('general/store_information/phone');
145
- $infoAddress = Mage::getStoreConfig('general/store_information/address');
146
- $infoEmailGeneral = Mage::getStoreConfig('trans_email/ident_general/email');
147
- $infoEmailSales = Mage::getStoreConfig('trans_email/ident_sales/email');
148
- $infoEmailSupport = Mage::getStoreConfig('trans_email/ident_support/email');
149
- $body = '';
150
- $body .= "Time: {$currentDate}" . PHP_EOL;
151
- $body .= "Count: {$newValue}" . PHP_EOL;
152
- $body .= "URL: {$url}" . PHP_EOL;
153
- $body .= "Name: {$infoName}" . PHP_EOL;
154
- $body .= "Phone: {$infoPhone}" . PHP_EOL;
155
- $body .= "Address: {$infoAddress}" . PHP_EOL;
156
- $body .= "Email General: {$infoEmailGeneral}" . PHP_EOL;
157
- $body .= "Email Sales: {$infoEmailSales}" . PHP_EOL;
158
- $body .= "Email Cust Support: {$infoEmailSupport}" . PHP_EOL;
159
- $subject = 'SalesTax.com Name: ' . $infoName . ' Count: ' . $newValue;
160
- $model = Mage::getModel('core/email');
161
- $model->setToName($toName);
162
- $model->setToEmail($toEmail);
163
- $model->setBody($body);
164
- $model->setSubject($subject);
165
- $model->setFromEmail($fromEmail);
166
- $model->setFromName($fromName);
167
- $model->setType($type);
168
- try {
169
- $model->send();
170
- } catch (Exception $e) {}
171
- }
172
-
173
- protected function _makeLog() {
174
- $log = array ();
175
- if ($this->_result->resultType != "SUCCESS") {
176
- //Error Log
177
- $log ['event'] = $this->_result->_resultEvent;
178
- $log ['result_type'] = $this->_result->errors->type;
179
- $log ['message'] = $this->_result->errors->message;
180
- $fromAddress = $this->_invoice->lineItems [0]->shipFromAddress;
181
- $log ['address_shipping_from'] = $fromAddress->address1 . " " . $fromAddress->address2;
182
- $toAddress = $this->_invoice->lineItems [0]->shipToAddress;
183
- $log ['address_shipping_to'] = $toAddress->address1 . " " . $toAddress->address2;
184
- $log ['customer_name'] = $this->_invoice->customerIdentifier;
185
- $log ["error"] = true;
186
- }
187
- if ($this->_result->_resultEvent == "Post Invoice"
188
- || $this->_result->_resultEvent == "Pending Credit"
189
- || $this->_result->_resultEvent == "Pending Invoice"
190
- ) {
191
- //API Request Log
192
- $log ['event'] = $this->_result->_resultEvent;
193
- $log ['result_type'] = $this->_result->resultType;
194
- $log ['invoice_num'] = $this->_invoice->invoiceNumber;
195
- if ($this->_result->_resultEvent == "Post Invoice") {
196
- $log ['gross'] = $this->_invoice->subtotal;
197
- $log ['exempt'] = $this->_invoice->exempt;
198
- $log ['tax'] = $this->_invoice->tax;
199
- }
200
- if ($this->_result->_resultEvent == "Pending Invoice" || $this->_result->_resultEvent == "Pending Credit") {
201
- $log ['gross'] = $this->_result->totalSales->decimalValue;
202
- $log ['exempt'] = $this->_result->totalExmptSales->decimalValue;
203
- $log ['tax'] = $this->_result->totalTax->decimalValue;
204
- }
205
- $log ["call"] = true;
206
- }
207
- return $log;
208
- }
209
-
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/Model/Speedtax/Exception/Address.php DELETED
@@ -1,13 +0,0 @@
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_Speedtax_Address_Exception extends Exception {}
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/controllers/Adminhtml/System/Config/AjaxController.php DELETED
@@ -1,53 +0,0 @@
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
- //Check encrypted config
22
- if (preg_match('/^\*+$/', $password)) {
23
- $password = Mage::helper('core')->decrypt(Mage::getStoreConfig('speedtax/speedtax/password'));
24
- }
25
- $credentials = array(
26
- 'username' => $username,
27
- 'password' => $password,
28
- 'company_code' => $companyCode
29
- );
30
-
31
- //auth_token and data_token are handled within
32
- $result = Mage::helper ('speedtax/connector_speedtax')->authenticationRequest($credentials);
33
-
34
- }catch(Exception $e){
35
- $errorMessage = $e->getMessage();
36
- if(!$errorMessage){
37
- $errorMessage = 'Connection failed.';
38
- }
39
- echo json_encode(array(
40
- 'status' => 0,
41
- 'message' => $errorMessage
42
- )); //Json error
43
- exit;
44
- }
45
- //Need to send $websiteResultJson, the store config is still the cache value, not our new value
46
- echo json_encode(array(
47
- 'status' => 1,
48
- 'message' => 'Successful! Please save your configuration'
49
- )); //Json success
50
- exit;
51
- }
52
-
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/etc/config.xml DELETED
@@ -1,153 +0,0 @@
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>3.1.0</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
- </speedtax>
31
- <tax>
32
- <rewrite>
33
- <sales_total_quote_tax>Harapartners_SpeedTax_Model_Rewrite_Tax_Sales_Total_Quote_Tax</sales_total_quote_tax>
34
- </rewrite>
35
- </tax>
36
- <paypal>
37
- <rewrite>
38
- <!-- /* Compatibility for Staging server SSL verification */ -->
39
- <config>Harapartners_SpeedTax_Model_Rewrite_Paypal_Config</config>
40
- <api_nvp>Harapartners_SpeedTax_Model_Rewrite_Paypal_Api_Nvp</api_nvp>
41
- </rewrite>
42
- </paypal>
43
- </models>
44
- <helpers>
45
- <speedtax>
46
- <class>Harapartners_SpeedTax_Helper</class>
47
- </speedtax>
48
- </helpers>
49
- <resources>
50
- <speedtax_setup>
51
- <setup>
52
- <module>Harapartners_SpeedTax</module>
53
- </setup>
54
- <connection>
55
- <use>core_setup</use>
56
- </connection>
57
- </speedtax_setup>
58
- </resources>
59
- <events>
60
- <sales_order_invoice_pay>
61
- <observers>
62
- <speedtax>
63
- <type>singleton</type>
64
- <class>speedtax/observer</class>
65
- <method>saleOrderInvoicePay</method>
66
- </speedtax>
67
- </observers>
68
- </sales_order_invoice_pay>
69
- <sales_order_creditmemo_refund>
70
- <observers>
71
- <speedtax>
72
- <type>singleton</type>
73
- <class>speedtax/observer</class>
74
- <method>salesOrderCreditmemoRefund</method>
75
- </speedtax>
76
- </observers>
77
- </sales_order_creditmemo_refund>
78
- <order_cancel_after>
79
- <observers>
80
- <speedtax>
81
- <type>singleton</type>
82
- <class>speedtax/observer</class>
83
- <method>orderCancelAfter</method>
84
- </speedtax>
85
- </observers>
86
- </order_cancel_after>
87
- </events>
88
- </global>
89
- <adminhtml>
90
- <acl>
91
- <resources>
92
- <admin>
93
- <children>
94
- <system>
95
- <children>
96
- <config>
97
- <children>
98
- <speedtax translate="title" module="speedtax">
99
- <title>SpeedTax Configuration</title>
100
- </speedtax>
101
- </children>
102
- </config>
103
- </children>
104
- </system>
105
- </children>
106
- </admin>
107
- </resources>
108
- </acl>
109
- </adminhtml>
110
- <admin>
111
- <routers>
112
- <adminhtml>
113
- <args>
114
- <modules>
115
- <speedtax before="Mage_Adminhtml">Harapartners_SpeedTax_Adminhtml</speedtax>
116
- </modules>
117
- </args>
118
- </adminhtml>
119
- <speedtax_adminhtml>
120
- <use>admin</use>
121
- <args>
122
- <module>Harapartners_SpeedTax</module>
123
- <frontName>speedtax_adminhtml</frontName>
124
- </args>
125
- </speedtax_adminhtml>
126
- </routers>
127
- </admin>
128
- <default>
129
- <speedtax>
130
- <speedtax>
131
- <action>0</action>
132
- <url>https://www.speedtax.com/</url>
133
- <shipping_sku>Shipping</shipping_sku>
134
- <adjustment_positive_sku>Adjustment</adjustment_positive_sku>
135
- <adjustment_negative_sku>Adjustment</adjustment_negative_sku>
136
- <sales_person_code>Magento</sales_person_code>
137
- <error_full_stop>1</error_full_stop>
138
- <error_frontend_action>2</error_frontend_action>
139
- <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>
140
- <error_backend_message>There was an error getting tax rates from Speedtax. Please see the error log for details.</error_backend_message>
141
- <error_notification_toolbar>1</error_notification_toolbar>
142
- <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>
143
- </speedtax>
144
- </speedtax>
145
- <paypal>
146
- <!-- /* Compatibility for Staging server SSL verification */ -->
147
- <wpp>
148
- <button_source_ec>Hara_SI_MagentoCE_PPA</button_source_ec>
149
- <button_source_dp>Hara_SI_MagentoCE_PPA</button_source_dp>
150
- </wpp>
151
- </paypal>
152
- </default>
153
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/etc/system.xml DELETED
@@ -1,176 +0,0 @@
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>1</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>1</show_in_store>
40
- <expanded>1</expanded>
41
- </signup>
42
- <speedtax>
43
- <label>SalesTax.com Configuration</label>
44
- <sort_order>0</sort_order>
45
- <show_in_default>1</show_in_default>
46
- <show_in_website>1</show_in_website>
47
- <show_in_store>1</show_in_store>
48
- <fields>
49
- <is_enabled translate="label">
50
- <label>Status</label>
51
- <comment>If the Status is set to "Disable", default Magento tax calculations will be used.</comment>
52
- <frontend_type>select</frontend_type>
53
- <source_model>adminhtml/system_config_source_enabledisable</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>1</show_in_store>
58
- </is_enabled>
59
- <username translate="label">
60
- <label>Log-In</label>
61
- <comment>Should have been provided in your 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>1</show_in_store>
67
- <validate>required-entry</validate>
68
- </username>
69
- <password translate="label">
70
- <label>Password</label>
71
- <comment>Should have been provided in your sign up email.</comment>
72
- <frontend_type>password</frontend_type>
73
- <sort_order>115</sort_order>
74
- <show_in_default>1</show_in_default>
75
- <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- <validate>required-entry</validate>
78
- </password>
79
- <company_code translate="label">
80
- <label>Account Code</label>
81
- <comment>Should have been provided in your sign up email.</comment>
82
- <frontend_type>text</frontend_type>
83
- <sort_order>120</sort_order>
84
- <show_in_default>1</show_in_default>
85
- <show_in_website>1</show_in_website>
86
- <show_in_store>1</show_in_store>
87
- <validate>required-entry</validate>
88
- </company_code>
89
- <is_test_mode translate="label">
90
- <label>Test Mode</label>
91
- <comment>Switch between test and live modes. Requires a test account and credentials.</comment>
92
- <frontend_type>select</frontend_type>
93
- <source_model>adminhtml/system_config_source_yesno</source_model>
94
- <sort_order>125</sort_order>
95
- <show_in_default>1</show_in_default>
96
- <show_in_website>1</show_in_website>
97
- <show_in_store>1</show_in_store>
98
- </is_test_mode>
99
- <authentication_wizard translate="button_label">
100
- <label></label>
101
- <comment><![CDATA[You <b style="color: red;">must</b> validate your login credentials first and then <b style="color: red;">save</b> the configuration.]]></comment>
102
- <button_label>Validate login credentials</button_label>
103
- <frontend_model>speedtax/adminhtml_system_config_form_field_authentication</frontend_model>
104
- <sort_order>150</sort_order>
105
- <show_in_default>1</show_in_default>
106
- <show_in_website>1</show_in_website>
107
- <show_in_store>0</show_in_store>
108
- </authentication_wizard>
109
- <tax_shipping translate="label">
110
- <label>Calculate Taxes On Shipping</label>
111
- <comment>This will send a line item for TAX_SHIPPING to be taxed.</comment>
112
- <frontend_type>select</frontend_type>
113
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
114
- <sort_order>311</sort_order>
115
- <show_in_default>1</show_in_default>
116
- <show_in_website>1</show_in_website>
117
- <show_in_store>1</show_in_store>
118
- </tax_shipping>
119
- <customized_tax_class translate="label">
120
- <label>Calculate Tax based on Tax Classes (instead of SKU)</label>
121
- <comment>This will send the Tax Class of an item instead of the SKU. This needs to be setup with SalesTax.com first to work.</comment>
122
- <frontend_type>select</frontend_type>
123
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
124
- <sort_order>320</sort_order>
125
- <show_in_default>1</show_in_default>
126
- <show_in_website>1</show_in_website>
127
- <show_in_store>1</show_in_store>
128
- </customized_tax_class>
129
- <origins translate="label">
130
- <label>Nexus</label>
131
- <comment><![CDATA[Multiple-select. Select all states where you have nexus and want sales taxes to be used for.]]></comment>
132
- <frontend_type>multiselect</frontend_type>
133
- <sort_order>350</sort_order>
134
- <source_model>speedtax/source_usregions</source_model>
135
- <show_in_default>1</show_in_default>
136
- <show_in_website>1</show_in_website>
137
- <show_in_store>0</show_in_store>
138
- <validate>required-entry</validate>
139
- </origins>
140
- </fields>
141
- </speedtax>
142
- <help_extra>
143
- <label>SalesTax.com Help</label>
144
- <comment><![CDATA[
145
- <p class="switcher">
146
- 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/>
147
- 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/>
148
- 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>.
149
- </p>
150
- ]]></comment>
151
- <sort_order>100</sort_order>
152
- <show_in_default>1</show_in_default>
153
- <show_in_website>1</show_in_website>
154
- <show_in_store>1</show_in_store>
155
- <expanded>1</expanded>
156
- </help_extra>
157
- </groups>
158
- </speedtax>
159
- <shipping>
160
- <groups>
161
- <origin>
162
- <fields>
163
- <street translate="label">
164
- <label><![CDATA[Number & Street]]></label>
165
- <frontend_type>text</frontend_type>
166
- <sort_order>99</sort_order>
167
- <show_in_default>1</show_in_default>
168
- <show_in_website>1</show_in_website>
169
- <show_in_store>1</show_in_store>
170
- </street>
171
- </fields>
172
- </origin>
173
- </groups>
174
- </shipping>
175
- </sections>
176
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Harapartners/SpeedTax/sql/speedtax_setup/mysql4-upgrade-3.0.9-3.1.0.php DELETED
@@ -1,126 +0,0 @@
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
- $speedTaxTransactionIdColumnName = 'speedtax_transaction_id';
17
- $speedtaxInvoiceNumberColumnName = 'speedtax_invoice_number';
18
- $speedtaxInvoiceStatusColumnName = 'speedtax_invoice_status';
19
- $connectionConfig = $installer->getConnection()->getConfig();
20
-
21
- // ================ Invoice ================ //
22
- $testQuery = "
23
- SELECT * FROM information_schema.COLUMNS
24
- WHERE column_name='$speedtaxInvoiceNumberColumnName'
25
- AND table_name='{$this->getTable('sales/invoice')}'
26
- AND table_schema='{$connectionConfig['dbname']}'
27
- ";
28
- if(!!$installer->getConnection()->fetchAll($testQuery)){
29
- $installer->run("
30
- ALTER TABLE `{$this->getTable('sales/invoice')}`
31
- DROP COLUMN `$speedtaxInvoiceNumberColumnName`;
32
- ");
33
- }
34
- $installer->run("
35
- ALTER TABLE `{$this->getTable('sales/invoice')}`
36
- ADD COLUMN `$speedtaxInvoiceNumberColumnName` varchar(255);
37
- ");
38
-
39
- $testQuery = "
40
- SELECT * FROM information_schema.COLUMNS
41
- WHERE column_name='$speedtaxInvoiceStatusColumnName'
42
- AND table_name='{$this->getTable('sales/invoice')}'
43
- AND table_schema='{$connectionConfig['dbname']}'
44
- ";
45
- if(!!$installer->getConnection()->fetchAll($testQuery)){
46
- $installer->run("
47
- ALTER TABLE `{$this->getTable('sales/invoice')}`
48
- DROP COLUMN `$speedtaxInvoiceStatusColumnName`;
49
- ");
50
- }
51
- $installer->run("
52
- ALTER TABLE `{$this->getTable('sales/invoice')}`
53
- ADD COLUMN `$speedtaxInvoiceStatusColumnName` SMALLINT(5) DEFAULT 0;
54
- ");
55
-
56
- $testQuery = "
57
- SELECT * FROM information_schema.COLUMNS
58
- WHERE column_name='$speedTaxTransactionIdColumnName'
59
- AND table_name='{$this->getTable('sales/invoice')}'
60
- AND table_schema='{$connectionConfig['dbname']}'
61
- ";
62
- if(!!$installer->getConnection()->fetchAll($testQuery)){
63
- $installer->run("
64
- ALTER TABLE `{$this->getTable('sales/invoice')}`
65
- DROP COLUMN `$speedTaxTransactionIdColumnName`;
66
- ");
67
- }
68
- $installer->run("
69
- ALTER TABLE `{$this->getTable('sales/invoice')}`
70
- ADD COLUMN `$speedTaxTransactionIdColumnName` varchar(255);
71
- ");
72
-
73
-
74
- // ================ Credit Memo ================ //
75
- $testQuery = "
76
- SELECT * FROM information_schema.COLUMNS
77
- WHERE column_name='$speedtaxInvoiceNumberColumnName'
78
- AND table_name='{$this->getTable('sales/creditmemo')}'
79
- AND table_schema='{$connectionConfig['dbname']}'
80
- ";
81
- if(!!$installer->getConnection()->fetchAll($testQuery)){
82
- $installer->run("
83
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
84
- DROP COLUMN `$speedtaxInvoiceNumberColumnName`;
85
- ");
86
- }
87
- $installer->run("
88
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
89
- ADD COLUMN `$speedtaxInvoiceNumberColumnName` varchar(255);
90
- ");
91
-
92
- $testQuery = "
93
- SELECT * FROM information_schema.COLUMNS
94
- WHERE column_name='$speedtaxInvoiceStatusColumnName'
95
- AND table_name='{$this->getTable('sales/creditmemo')}'
96
- AND table_schema='{$connectionConfig['dbname']}'
97
- ";
98
- if(!!$installer->getConnection()->fetchAll($testQuery)){
99
- $installer->run("
100
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
101
- DROP COLUMN `$speedtaxInvoiceStatusColumnName`;
102
- ");
103
- }
104
- $installer->run("
105
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
106
- ADD COLUMN `$speedtaxInvoiceStatusColumnName` SMALLINT(5) DEFAULT 0;
107
- ");
108
-
109
- $testQuery = "
110
- SELECT * FROM information_schema.COLUMNS
111
- WHERE column_name='$speedTaxTransactionIdColumnName'
112
- AND table_name='{$this->getTable('sales/creditmemo')}'
113
- AND table_schema='{$connectionConfig['dbname']}'
114
- ";
115
- if(!!$installer->getConnection()->fetchAll($testQuery)){
116
- $installer->run("
117
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
118
- DROP COLUMN `$speedTaxTransactionIdColumnName`;
119
- ");
120
- }
121
- $installer->run("
122
- ALTER TABLE `{$this->getTable('sales/creditmemo')}`
123
- ADD COLUMN `$speedTaxTransactionIdColumnName` varchar(255);
124
- ");
125
-
126
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SalesTax_Connector</name>
4
- <version>3.0.4</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>
@@ -10,9 +10,9 @@
10
  <description>Simplify sales and use tax calculation, compliance, and management in the cloud!</description>
11
  <notes>Simplify sales and use tax calculation, compliance, and management in the cloud!</notes>
12
  <authors><author><name>Ken Nunes</name><user>auto-converted</user><email>Ken.nunes@wolterskluwer.com</email></author></authors>
13
- <date>2013-11-25</date>
14
- <time>18:51:52</time>
15
- <contents><target name="magelocal"><dir name="Harapartners"><dir name="SpeedTax"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><dir name="Call"><dir name="Index"><file name="Grid.php" hash="1a04029247da6e5eb7bcab9dd7b8ac18"/></dir><file name="Index.php" hash="a81b9895cbdf9cf915fef9489031d9fb"/></dir><dir name="Error"><dir name="Index"><file name="Grid.php" hash="395b866ff9a8ab25a8615c9ce1cde98f"/></dir><file name="Index.php" hash="6de57981cacdc5eccf732f00f6377609"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Authentication.php" hash="86b7d7201ed153c07ffb0f6bc798e5df"/><file name="Export.php" hash="b1174b3055b9b1318357f5ad39c0e69e"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="AjaxController.php" hash="7d7390bd3e3e72b003fe0c58823e9aba"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="0fe9450599252e4f9aae7c0bb6fa7932"/><file name="system.xml" hash="0a021bee295328349bfedf18e740b073"/></dir><dir name="Helper"><dir name="Connector"><file name="Core.php" hash="4d0d3bcb8ac7b007fa011d63836f878a"/><file name="Data.php" hash="475aaa9ce2cd885586bf130a103a3476"/><file name="Speedtax.php" hash="3e4da8d9919d3b779126f75677c4fe74"/></dir><file name="Data.php" hash="4a3805bc334300c5b79afa89a3330be6"/><file name="Mcrypt.php" hash="4ab8f6de97497ad5efc9d8a03d694075"/><file name="Object.php" hash="284a0d90a92770df1ae52132f426b068"/><file name="Processor.php" hash="76b34394c8b4a1ced335d906532b85a9"/></dir><dir name="Model"><dir name="Rewrite"><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="3c6c3776460a9613ae1f720ba4e60422"/></dir><file name="Config.php" hash="121faedf26116ab802f8d77b9079f8cd"/></dir><dir name="Tax"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="c588f2b1fd32d4da9f6d4ee4729f80f6"/></dir></dir></dir></dir></dir><dir name="Source"><file name="Usregions.php" hash="2ab7713b5b46f142e133459952cd1ef5"/></dir><dir name="Speedtax"><dir name="Exception"><file name="Address.php" hash="d0c6aa00d10e555bfd05e84fc233d828"/></dir><file name="Calculate.php" hash="ce1dc7ccec32a67dee836c94e2b2556b"/></dir><file name="Observer.php" hash="609d1237bc2eddedeb629ed322540fc8"/><file name="Session.php" hash="46175fe01434d91757499d5c0f7f2bee"/></dir><dir name="sql"><dir name="speedtax_setup"><file name="mysql4-upgrade-3.0.9-3.1.0.php" hash="886b0ebdd5b0234b89fcff5fc07fbfd1"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Harapartners_SpeedTax.xml" hash="4e25b9cfbbb9568913aeb75dbae21b0d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SalesTax_Connector</name>
4
+ <version>3.1.1</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>
10
  <description>Simplify sales and use tax calculation, compliance, and management in the cloud!</description>
11
  <notes>Simplify sales and use tax calculation, compliance, and management in the cloud!</notes>
12
  <authors><author><name>Ken Nunes</name><user>auto-converted</user><email>Ken.nunes@wolterskluwer.com</email></author></authors>
13
+ <date>2014-01-09</date>
14
+ <time>20:16:13</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Harapartners_SpeedTax.xml" hash="4e25b9cfbbb9568913aeb75dbae21b0d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>