Mage_Exactor_Tax - Version 2013.06.06

Version Notes

Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x

Download this release

Release Info

Developer Exactor, Inc.
Extension Mage_Exactor_Tax
Version 2013.06.06
Comparing to
See all releases


Code changes from version 2013.04.18 to 2013.06.06

app/code/local/Exactor/Tax/Helper/Mapping.php CHANGED
@@ -78,7 +78,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
78
  $exactorAddress->setFullName("Unknown Buyer");
79
  //
80
  $fullName = trim($address->getName());//trim($this->buildFullName($address->getFirstname(), $address->getLastname(), $address->getMiddlename()));
81
- if (strlen($fullName)> self::PRICE_TYPE_DYNAMIC)
82
  $exactorAddress->setFullName($fullName);
83
  if ($address->getStreetFull() != null)
84
  $exactorAddress->setStreet1($address->getStreetFull());
@@ -86,6 +86,11 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
86
  $exactorAddress->setStateOrProvince($address->getRegionCode());
87
  $exactorAddress->setCountry($address->getCountry());
88
  $exactorAddress->setPostalCode($address->getPostcode());
 
 
 
 
 
89
  if (!$exactorAddress->hasData()) return null;
90
  return $exactorAddress;
91
  }
@@ -421,16 +426,12 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
421
  // If this is just tax estimation for not logged in user
422
  // we just need to use shipping as billing
423
  if ($isEstimation){
424
- // It is possible that postal code or state will be missing on the tax estimation form
425
- // In this case we will try to determine region basing on the given Postal Code
426
- if (strlen(trim($shipToAddress->getStateOrProvince()))==0 && strlen(trim($shipToAddress->getPostalCode()))!=0){
427
- $shipToAddress->setStateOrProvince(RegionResolver::getInstance()->getStateOrProvinceByCode(trim($shipToAddress->getPostalCode())));
428
- }
429
  $billingAddress = $shipToAddress;
430
  }
431
  // If shipping info unavailable - fallback to billing information
432
  if ($shipToAddress == null || !$shipToAddress->hasData()) $shipToAddress=$billingAddress;
433
  if ($shipToAddress == null || !$shipToAddress->hasData()) $shipToAddress=null;
 
434
  // Composing invoice object
435
  $invoiceRequest = new InvoiceRequestType();
436
  $invoiceRequest->setSaleDate(new DateTime());
@@ -695,4 +696,25 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
695
  }
696
  return false;
697
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
  }
78
  $exactorAddress->setFullName("Unknown Buyer");
79
  //
80
  $fullName = trim($address->getName());//trim($this->buildFullName($address->getFirstname(), $address->getLastname(), $address->getMiddlename()));
81
+ if (strlen($fullName)>0)
82
  $exactorAddress->setFullName($fullName);
83
  if ($address->getStreetFull() != null)
84
  $exactorAddress->setStreet1($address->getStreetFull());
86
  $exactorAddress->setStateOrProvince($address->getRegionCode());
87
  $exactorAddress->setCountry($address->getCountry());
88
  $exactorAddress->setPostalCode($address->getPostcode());
89
+ // It is possible that postal code or state will be missing (e.g. the tax estimation form)
90
+ // In this case we will try to determine region basing on the given Postal Code
91
+ if (strlen(trim($exactorAddress->getStateOrProvince()))==0 && strlen(trim($exactorAddress->getPostalCode()))!=0){
92
+ $exactorAddress->setStateOrProvince(RegionResolver::getInstance()->getStateOrProvinceByCode(trim($exactorAddress->getPostalCode())));
93
+ }
94
  if (!$exactorAddress->hasData()) return null;
95
  return $exactorAddress;
96
  }
426
  // If this is just tax estimation for not logged in user
427
  // we just need to use shipping as billing
428
  if ($isEstimation){
 
 
 
 
 
429
  $billingAddress = $shipToAddress;
430
  }
431
  // If shipping info unavailable - fallback to billing information
432
  if ($shipToAddress == null || !$shipToAddress->hasData()) $shipToAddress=$billingAddress;
433
  if ($shipToAddress == null || !$shipToAddress->hasData()) $shipToAddress=null;
434
+ if ($shipToAddress == null) return null;
435
  // Composing invoice object
436
  $invoiceRequest = new InvoiceRequestType();
437
  $invoiceRequest->setSaleDate(new DateTime());
696
  }
697
  return false;
698
  }
699
+
700
+ private function isAddessFullyPopulated(AddressType $address) {
701
+ if ($address==null || !$address->hasData()) return false;
702
+ return strlen(trim($address->getStreet1())) > 0
703
+ && strlen(trim($address->getFullName())) > 0
704
+ && strlen(trim($address->getCity()));
705
+ }
706
+
707
+ /**
708
+ * Returns true only in case when billTo and shipTo contains address line and full name.
709
+ * Otherwise - returns false.
710
+ * This method can be used to determine if current request is just tax estimation
711
+ *
712
+ * @param InvoiceRequestType $invoice
713
+ * @return bool
714
+ */
715
+ public function isInvoiceAddressesFullyPopulated(InvoiceRequestType $invoice) {
716
+ if ($invoice == null) return false;
717
+ return $this->isAddessFullyPopulated($invoice->getShipTo())
718
+ && $this->isAddessFullyPopulated($invoice->getBillTo());
719
+ }
720
  }
app/code/local/Exactor/Tax/Model/Sales/Total/Quote/Tax.php CHANGED
@@ -140,6 +140,12 @@ class Exactor_Tax_Model_Sales_Total_Quote_Tax extends Mage_Sales_Model_Quote_Add
140
  }
141
  $this->logger->trace('Invoice ' . serialize($invoiceRequest),'collect');
142
  if ($invoiceRequest != null && $this->checkIfCalculationNeeded($invoiceRequest, $merchantSettings)){
 
 
 
 
 
 
143
  // Sending to Exactor Tax Calculation Request to Exactor
144
  $exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService($merchantSettings->getMerchantID(),
145
  $merchantSettings->getUserID());
140
  }
141
  $this->logger->trace('Invoice ' . serialize($invoiceRequest),'collect');
142
  if ($invoiceRequest != null && $this->checkIfCalculationNeeded($invoiceRequest, $merchantSettings)){
143
+ if ($config->getFeatureConfig()->isFeatureEnabled(EXACTOR_CONFIG_FEATURE_DISABLE_ESTIMATES)) {
144
+ if (!$this->exactorMappingHelper->isInvoiceAddressesFullyPopulated($invoiceRequest)) {
145
+ $this->logger->info('Skipping tax estimate due to the Exactor plug-in configuration', 'collect');
146
+ return $internalTaxCalculator->collect($address);
147
+ }
148
+ }
149
  // Sending to Exactor Tax Calculation Request to Exactor
150
  $exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService($merchantSettings->getMerchantID(),
151
  $merchantSettings->getUserID());
lib/ExactorCommons/ExactorCommons.php CHANGED
@@ -213,7 +213,7 @@ class FeatureConfigManager {
213
  * @param FeatureConfigHolder $config
214
  * @return string
215
  */
216
- public function encodeConfig(FeatureConfigHolder $config){
217
  $serialized = serialize($config);
218
  return base64_encode($serialized);
219
  }
@@ -517,7 +517,7 @@ class ExactorDigitalSignatureBuilder{
517
  */
518
  private function appendAddressFields($address){
519
  if ($address == null) return;
520
- $this->appendValue($address->getFullName());
521
  $this->appendValue($address->getStreet1());
522
  $this->appendValue($address->getStreet2());
523
  $this->appendValue($address->getCity());
@@ -609,10 +609,10 @@ class ExactorProcessingService{
609
  * @return void
610
  */
611
  public function applyAddressFallbackLogic(&$invoice) {
612
- if ($invoice->getBillTo() == null) {
613
- $invoice->setBillTo($invoice->getShipFrom());
614
  }
615
- if ($invoice->getShipTo() == null) {
616
  $invoice->setShipTo($invoice->getBillTo());
617
  }
618
  }
213
  * @param FeatureConfigHolder $config
214
  * @return string
215
  */
216
+ public function encodeConfig(FeatureConfigHolder $config) {
217
  $serialized = serialize($config);
218
  return base64_encode($serialized);
219
  }
517
  */
518
  private function appendAddressFields($address){
519
  if ($address == null) return;
520
+ //$this->appendValue($address->getFullName());
521
  $this->appendValue($address->getStreet1());
522
  $this->appendValue($address->getStreet2());
523
  $this->appendValue($address->getCity());
609
  * @return void
610
  */
611
  public function applyAddressFallbackLogic(&$invoice) {
612
+ if ($invoice->getBillTo() == null && $invoice->getShipTo() == null) {
613
+ return;
614
  }
615
+ if ($invoice->getShipTo() == null || !$invoice->getShipTo()->hasData()) {
616
  $invoice->setShipTo($invoice->getBillTo());
617
  }
618
  }
lib/ExactorCommons/config.php CHANGED
@@ -11,9 +11,11 @@ define('EXACTOR_CONFIG_FEATURE_EXEMPT_DISCOUNTS', 'discount-exemptions');
11
  define('EXACTOR_CONFIG_TRN_FILTER', 'trn-filter');
12
  define('EXACTOR_CONFIG_FEATURE_TRN_FILTER', 'trn-filter');
13
 
 
 
14
  /* Initializing factories */
15
- ExactorLoggingFactory::getInstance()->setup('MagentoLogger', IExactorLogger::TRACE);
16
- ExactorConnectionFactory::getInstance()->setup('Magento','v20130418');
17
  ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
18
 
19
  /* Initializing configuration object */
11
  define('EXACTOR_CONFIG_TRN_FILTER', 'trn-filter');
12
  define('EXACTOR_CONFIG_FEATURE_TRN_FILTER', 'trn-filter');
13
 
14
+ define('EXACTOR_CONFIG_FEATURE_DISABLE_ESTIMATES', 'disable-estimates');
15
+
16
  /* Initializing factories */
17
+ ExactorLoggingFactory::getInstance()->setup('MagentoLogger', IExactorLogger::DEBUG);
18
+ ExactorConnectionFactory::getInstance()->setup('Magento','v20130606');
19
  ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
20
 
21
  /* Initializing configuration object */
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Exactor_Tax</name>
4
- <version>2013.04.18</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -12,9 +12,9 @@ Once installed, neither the merchant, nor the customer, need to perform any addi
12
  For additional information, please refer to the Exactor Magento User Guide that is attached to the plug-in, or which you can download directly from the Exactor control panel (navigate to Account Management Integration Points &amp; PlugIns).</description>
13
  <notes>Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x</notes>
14
  <authors><author><name>Exactor, Inc.</name><user>exactor</user><email>support@exactor.com</email></author></authors>
15
- <date>2013-04-18</date>
16
- <time>16:00:22</time>
17
- <contents><target name="magelocal"><dir name="Exactor"><dir name="Core"><dir name="Helper"><file name="SessionCache.php" hash="72692a33574f8ba2f1858e2e93aa4edf"/></dir><dir name="Model"><file name="ExactorTransaction.php" hash="852aa20f6e3b7aa0001439d4bffe9724"/><file name="MerchantSettings.php" hash="71a7c2308f6f0eda102ae84dd90df751"/><dir name="Mysql4"><dir name="ExactorTransaction"><file name="Collection.php" hash="c7b890b4d3ab35e65a3856ae0e2fdf72"/></dir><file name="ExactorTransaction.php" hash="c91aebaae767613acf1c439a8b513c3b"/><dir name="MerchantSettings"><file name="Collection.php" hash="c1593f52e582e601409c4651c37495af"/><file name="Collection.php~" hash="d360e202eb30432ac41dc023ce13ffc0"/></dir><file name="MerchantSettings.php" hash="8f22b76bb64cdc7b1deb6f0e38889905"/></dir><dir name="Type"><file name="Onepage.php" hash="2441fb08bbeb579831cea4d3fbd31104"/></dir></dir><dir name="etc"><file name="config.xml" hash="98ecc82a5f7b74ac0bfc0f7ab512afdb"/></dir></dir><dir name="ExactorSettings"><dir name="Block"><file name="Form.php" hash="5ea1d72197306072fe5fad9b97d109e8"/></dir><dir name="Helper"><file name="Data.php" hash="a23bb9c251f0dbb77c107d01dde39e86"/><file name="VersionResolver.php" hash="14dce068dfe2a7d3364c4bd29e6f8431"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="c0985258b110e0314e6b6ea091ae8c19"/></dir><file name="AjaxController.php" hash="c07aeeca00e1408e52945fc027569793"/><file name="IndexController.php" hash="f47cbc274dd68c57c30b60bbee69259e"/></dir><dir name="etc"><file name="config.xml" hash="674c326bfc901d0becf7c94ddcdd1452"/></dir><dir name="sql"><dir name="ExactorSettings_setup"><file name="mysql4-install-14.04.2012.php" hash="f35af1e12921b57479cb4b5677937a0c"/><file name="upgrade-2012.06.14-2012.09.25.php" hash="174fda5224bc23cdf147fb059d079478"/></dir></dir></dir><dir name="Sales"><dir name="Model"><file name="Observer.php" hash="42de4489c7f93e2c1c9b6ea6e7309584"/></dir><dir name="etc"><file name="config.xml" hash="ba31618f5165dda20010c40e7ef8dad1"/></dir></dir><dir name="Tax"><dir name="Helper"><file name="Calculation.php" hash="29c5252bdd48b173c90588f449114024"/><file name="Mapping.php" hash="7c9af929b1ac28eb858e26d6876b950f"/></dir><dir name="Model"><dir name="Sales"><dir name="Total"><dir name="Quote"><dir name="Nominal"><file name="Tax.php" hash="156eff380df5b16db55449759f193490"/></dir><file name="Tax.php" hash="3c283d0960292d45fd95245c7ff11925"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="dac507a6a0437f511973c29646bd6a8d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="exactorsettings.xml" hash="3707eac08d2393c8796eebf1cf7a0bd9"/><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir><dir name="template"><dir name="ExactorSettings"><file name="settingsform.phtml" hash="3f6e14533076ab97dbb0c98ba770bf87"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exactor.xml" hash="e8997e8e36a265141b37790caaef39d6"/></dir></target><target name="mageweb"><dir name="js"><dir name="exactor"><file name="exactor.js" hash="5c23e40f4034e50a6e0df5b1c708b7e1"/></dir></dir></target><target name="magelib"><dir name="ExactorCommons"><file name="ExactorCommons.php" hash="7721531d9aa9f3732997e7c0180477fb"/><file name="ExactorDomainObjects.php" hash="642c46eb5e1c3daa624cce0f9329348a"/><file name="Magento.php" hash="76da7333fe0692053a47f8564c7b513a"/><file name="RegionResolver.php" hash="2537638a7895a169cee4b1df786d22fb"/><file name="XmlProcessing.php" hash="5d6393a68f86cf9a7d0f3b26b5b8f1e0"/><file name="config.php" hash="d71e1ef2d745f7499dfa0e3fc6739229"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Exactor_Tax</name>
4
+ <version>2013.06.06</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
12
  For additional information, please refer to the Exactor Magento User Guide that is attached to the plug-in, or which you can download directly from the Exactor control panel (navigate to Account Management Integration Points &amp; PlugIns).</description>
13
  <notes>Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x</notes>
14
  <authors><author><name>Exactor, Inc.</name><user>exactor</user><email>support@exactor.com</email></author></authors>
15
+ <date>2013-06-10</date>
16
+ <time>15:35:06</time>
17
+ <contents><target name="magelocal"><dir name="Exactor"><dir name="Core"><dir name="Helper"><file name="SessionCache.php" hash="72692a33574f8ba2f1858e2e93aa4edf"/></dir><dir name="Model"><file name="ExactorTransaction.php" hash="852aa20f6e3b7aa0001439d4bffe9724"/><file name="MerchantSettings.php" hash="71a7c2308f6f0eda102ae84dd90df751"/><dir name="Mysql4"><dir name="ExactorTransaction"><file name="Collection.php" hash="c7b890b4d3ab35e65a3856ae0e2fdf72"/></dir><file name="ExactorTransaction.php" hash="c91aebaae767613acf1c439a8b513c3b"/><dir name="MerchantSettings"><file name="Collection.php" hash="c1593f52e582e601409c4651c37495af"/><file name="Collection.php~" hash="d360e202eb30432ac41dc023ce13ffc0"/></dir><file name="MerchantSettings.php" hash="8f22b76bb64cdc7b1deb6f0e38889905"/></dir><dir name="Type"><file name="Onepage.php" hash="2441fb08bbeb579831cea4d3fbd31104"/></dir></dir><dir name="etc"><file name="config.xml" hash="98ecc82a5f7b74ac0bfc0f7ab512afdb"/></dir></dir><dir name="ExactorSettings"><dir name="Block"><file name="Form.php" hash="5ea1d72197306072fe5fad9b97d109e8"/></dir><dir name="Helper"><file name="Data.php" hash="a23bb9c251f0dbb77c107d01dde39e86"/><file name="VersionResolver.php" hash="14dce068dfe2a7d3364c4bd29e6f8431"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="c0985258b110e0314e6b6ea091ae8c19"/></dir><file name="AjaxController.php" hash="c07aeeca00e1408e52945fc027569793"/><file name="IndexController.php" hash="f47cbc274dd68c57c30b60bbee69259e"/></dir><dir name="etc"><file name="config.xml" hash="674c326bfc901d0becf7c94ddcdd1452"/></dir><dir name="sql"><dir name="ExactorSettings_setup"><file name="mysql4-install-14.04.2012.php" hash="f35af1e12921b57479cb4b5677937a0c"/><file name="upgrade-2012.06.14-2012.09.25.php" hash="174fda5224bc23cdf147fb059d079478"/></dir></dir></dir><dir name="Sales"><dir name="Model"><file name="Observer.php" hash="42de4489c7f93e2c1c9b6ea6e7309584"/></dir><dir name="etc"><file name="config.xml" hash="ba31618f5165dda20010c40e7ef8dad1"/></dir></dir><dir name="Tax"><dir name="Helper"><file name="Calculation.php" hash="29c5252bdd48b173c90588f449114024"/><file name="Mapping.php" hash="1bf0deb2c733390faf2de15d0256037f"/></dir><dir name="Model"><dir name="Sales"><dir name="Total"><dir name="Quote"><dir name="Nominal"><file name="Tax.php" hash="156eff380df5b16db55449759f193490"/></dir><file name="Tax.php" hash="8c79680737583ffb5c66658297d0a5a3"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="dac507a6a0437f511973c29646bd6a8d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="exactorsettings.xml" hash="3707eac08d2393c8796eebf1cf7a0bd9"/><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir><dir name="template"><dir name="ExactorSettings"><file name="settingsform.phtml" hash="3f6e14533076ab97dbb0c98ba770bf87"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exactor.xml" hash="e8997e8e36a265141b37790caaef39d6"/></dir></target><target name="mageweb"><dir name="js"><dir name="exactor"><file name="exactor.js" hash="5c23e40f4034e50a6e0df5b1c708b7e1"/></dir></dir></target><target name="magelib"><dir name="ExactorCommons"><file name="ExactorCommons.php" hash="e97250a67e09082767f131ddc9e1d134"/><file name="ExactorDomainObjects.php" hash="642c46eb5e1c3daa624cce0f9329348a"/><file name="Magento.php" hash="76da7333fe0692053a47f8564c7b513a"/><file name="RegionResolver.php" hash="2537638a7895a169cee4b1df786d22fb"/><file name="XmlProcessing.php" hash="5d6393a68f86cf9a7d0f3b26b5b8f1e0"/><file name="config.php" hash="efa966b1accc695ccf6ef7ac47883252"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>