SalesTax_Connector - Version 2.0.3

Version Notes

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

Download this release

Release Info

Developer Hara Partners
Extension SalesTax_Connector
Version 2.0.3
Comparing to
See all releases


Code changes from version 2.0.2 to 2.0.3

app/code/local/Harapartners/SpeedTax/Model/Speedtax/Calculate.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php
2
  // Copyright Notice
3
- class Harapartners_SpeedTax_Model_Speedtax_Calculate extends Harapartners_SpeedTax_Model_Speedtax_Abstract { const CACHE_TTL = 120; const TAX_SHIPPING_LINEITEM_TAX_CLASS = 'TAX_SHIPPING'; const TAX_SHIPPING_LINEITEM_REFERNCE_NAME = 'TAX_SHIPPING'; protected $tZoBVMRZ = null; protected $meklFIoq = null; protected $cmqQAala = null; protected $iMXHkJLR = null; protected $pgdFNOJZ = null; protected $jjWpzBHA = false; protected $hHMCuTxQ; protected $hKoLMLEk = null; protected $wnHTMOMh = 0; protected $gMLzbKzP = array('US', 'CA'); protected function _construct() { Mage::helper('speedtax')->wmnfSKri(); $this->meklFIoq = new invoice(); $this->meklFIoq->invoiceDate = date('Y-m-d'); return parent::_construct(); } public function NOoqhUxE(Mage_Sales_Model_Quote_Address $aeyhxYiy){ if (!$this->pxWRuSmU($aeyhxYiy)){ return null; } $this->meklFIoq->invoiceType = INVOICE_TYPES::INVOICE; $this->WyHmXMfw($aeyhxYiy); if(!$this->meklFIoq || !$this->meklFIoq->lineItems){ return null; } $this->cmqQAala = $this->QtQlGyKL(); if(!$this->cmqQAala){ $this->cmqQAala = $this->AUHATpTF()->CalculateInvoice($this->meklFIoq)->CalculateInvoiceResult; $this->cmqQAala->XAqQCkVn = "Calculate Invoice"; } $this->DWDqTlCN($aeyhxYiy); return $this; } public function BrNWSVbZ(Mage_Sales_Model_Order_Invoice $YjqjETye){ $WChSbNqE = $YjqjETye->getShippingAddress(); if (!$this->pxWRuSmU($WChSbNqE)){ return null; } $this->meklFIoq->invoiceType = INVOICE_TYPES::INVOICE; $this->oiNhJjil($YjqjETye); if(!$this->meklFIoq || !$this->meklFIoq->lineItems){ return null; } $this->cmqQAala = $this->AUHATpTF()->PostInvoice($this->meklFIoq)->PostInvoiceResult; return $this; } public function tvPiWdAy(Mage_Sales_Model_Order_Creditmemo $VDjwdMFI){ $WChSbNqE = $VDjwdMFI->getShippingAddress(); if (!$this->pxWRuSmU($WChSbNqE)){ return null; } if(!$this->cmqQAala){ $this->cmqQAala = $this->AUHATpTF()->VoidInvoice($VDjwdMFI->getOrder()->getIncrementId()); } return $this; } protected function WyHmXMfw(Mage_Sales_Model_Quote_Address $aeyhxYiy) { $this->meklFIoq->invoiceNumber = null; $this->meklFIoq->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/account' ); foreach ( $aeyhxYiy->getAllItems () as $yKMCKvuO ) { if(!!$yKMCKvuO->getParentItemId()){ continue; } if($yKMCKvuO->getTaxClassId() == $this->wnHTMOMh){ continue; } if($yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount() <= 0){ continue; } $yKMCKvuO->setData('speedtax_invoice_lineitem_index', count($this->meklFIoq->lineItems)); $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = $yKMCKvuO->getSku(); $jQlHTPba->customReference = $yKMCKvuO->getId(); $jQlHTPba->quantity = $yKMCKvuO->getQty (); $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount(); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($aeyhxYiy); $this->meklFIoq->lineItems[] = $jQlHTPba; } if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping")){ $this->lbHmkxMM($aeyhxYiy); } return $this; } protected function oiNhJjil(Mage_Sales_Model_Order_Invoice $YjqjETye) { $WChSbNqE = $YjqjETye->getShippingAddress(); $this->meklFIoq->invoiceNumber = $YjqjETye->getOrderIncrementId(); $this->meklFIoq->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/account' ); foreach ( $YjqjETye->getAllItems() as $yKMCKvuO ) { if(!$yKMCKvuO->getTaxAmount()){ continue; } if($yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount() <= 0){ continue; } $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = $yKMCKvuO->getSku(); $jQlHTPba->customReference = $yKMCKvuO->getId(); $jQlHTPba->quantity = $yKMCKvuO->getQty (); $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount(); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($WChSbNqE); $this->meklFIoq->lineItems[] = $jQlHTPba; } if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping")){ $this->lbHmkxMM($WChSbNqE); } return $this; } protected function lbHmkxMM($lnCddvTy) { $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = self::TAX_SHIPPING_LINEITEM_TAX_CLASS; $jQlHTPba->customReference = self::TAX_SHIPPING_LINEITEM_REFERNCE_NAME; $jQlHTPba->quantity = 1; $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $lnCddvTy->getShippingAmount (); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($lnCddvTy); $this->meklFIoq->lineItems [] = $jQlHTPba; return $this; } protected function DWDqTlCN(Mage_Sales_Model_Quote_Address $aeyhxYiy){ switch ($this->cmqQAala->resultType) { case 'SUCCESS' : $this->MNgggsOK(); foreach ( $aeyhxYiy->getAllItems() as $lYtFqSBP ) { if(!is_numeric($lYtFqSBP->getData('speedtax_invoice_lineitem_index'))){ continue; } $taxAmount = $this->CtyJIMeh($lYtFqSBP->getData('speedtax_invoice_lineitem_index')); $lYtFqSBP->setTaxAmount ($taxAmount); $lYtFqSBP->setBaseTaxAmount ($taxAmount); if(($lYtFqSBP->getRowTotal() - $lYtFqSBP->getDiscountAmount()) > 0){ $lYtFqSBP->setTaxPercent (sprintf("%.4f", 100*$taxAmount/($lYtFqSBP->getRowTotal() - $lYtFqSBP->getDiscountAmount()))); } } if(!!$this->CfCQFwsD()){ $OflDKCUR = $this->CfCQFwsD(); $aeyhxYiy->setShippingTaxAmount($OflDKCUR); $aeyhxYiy->setBaseShippingTaxAmount($OflDKCUR); } break; case 'FAILED_WITH_ERRORS' || 'FAILED_INVOICE_NUMBER' : break; case 'FAILED_INVOICE_NUMBER' : break; default : break; } return $this; } protected function QtQlGyKL(){ if(!$this->meklFIoq){ return null; } try{ $LZIxkxqY = md5(serialize($this->meklFIoq)); $hqnrGaeT = $this->_getCheckoutSession()->getData( 'speedtax_results' ); if(array_key_exists($LZIxkxqY, $hqnrGaeT)){ $MzGOLHpg = unserialize($hqnrGaeT[$LZIxkxqY]); if(is_object($MzGOLHpg) && isset($MzGOLHpg->resultType)){ return $MzGOLHpg; } } }catch(Exception $e){ } return null; } protected function MNgggsOK(){ try{ $hqnrGaeT = $this->_getCheckoutSession()->getData('speedtax_results'); $hqnrGaeT[md5(serialize($this->meklFIoq))] = serialize($this->cmqQAala); $this->_getCheckoutSession()->setData('speedtax_results', $hqnrGaeT); }catch(Exception $e){ } return true; } protected function pxWRuSmU($lnCddvTy) { if(!($lnCddvTy instanceof Varien_Object) || $lnCddvTy->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING ){ return false; } $fHevQqKb = Mage::getStoreConfig('speedtax/speedtax/origins'); return in_array($lnCddvTy->getRegionId(), explode(',', $fHevQqKb)); } protected function _getCheckoutSession() { if( ! $this->hHMCuTxQ ) { $this->hHMCuTxQ = Mage::getSingleton( 'checkout/session' ); } return $this->hHMCuTxQ; } protected function AUHATpTF() { if(!$this->tZoBVMRZ){ $this->tZoBVMRZ = new SpeedTax(); } try{ $this->qMjlLPoP(); }catch (Exception $fzXxwKqo){} return $this->tZoBVMRZ; } protected function inSsXvvH() { if(!$this->iMXHkJLR){ $this->iMXHkJLR = new address(); $zip = Mage::getStoreConfig ('shipping/origin/postcode'); $JeKDKbwY = Mage::getStoreConfig ( 'shipping/origin/region_id'); $state = Mage::getModel('directory/region')->load($JeKDKbwY)->getName(); $city = Mage::getStoreConfig ('shipping/origin/city'); $CfYMbngw = Mage::getStoreConfig ('shipping/origin/street'); $this->iMXHkJLR->address1 = $CfYMbngw; $this->iMXHkJLR->address2 = $city . ", " . $state . " " . $zip; } return $this->iMXHkJLR; } protected function exBgfCRo($address) { if(!$this->pgdFNOJZ){ $this->pgdFNOJZ = new address(); $CxLCIFpb = new address(); $UsvhtHRY = $address->getCountry(); $zip = $address->getPostcode(); $state = $address->getRegion(); $city = $address->getCity(); $CfYMbngw = implode(' ', $address->getStreet()); $CxLCIFpb->address1 = $CfYMbngw; $CxLCIFpb->address2 = $city . ", " . $state . " " . $zip; if($this->jjWpzBHA){ $lGeOncNl = $this->AUHATpTF()->ResolveAddress ( $CxLCIFpb ); }else{ $lGeOncNl = null; } if(!!$lGeOncNl && !!$lGeOncNl->ResolveAddressResult && !!$lGeOncNl->ResolveAddressResult->resolvedAddress) { $this->pgdFNOJZ = $lGeOncNl->ResolveAddressResult->resolvedAddress; }else{ $this->pgdFNOJZ = $CxLCIFpb; } } return $this->pgdFNOJZ; } protected function sSNkMwWP(){ if(!$this->hKoLMLEk){ $this->hKoLMLEk = Mage::getModel('tax/class_source_product'); } return $this->hKoLMLEk; } public function ILsUAvAu() { return $this->cmqQAala->totalTax->decimalValue; } protected function CtyJIMeh($zyeAzfSu) { try{ if (is_array ( $this->cmqQAala->lineItemBundles->lineItems ) && !empty($this->cmqQAala->lineItemBundles->lineItems[$zyeAzfSu]) ) { return $this->cmqQAala->lineItemBundles->lineItems[$zyeAzfSu]->taxAmount->decimalValue; } else { return $this->cmqQAala->lineItemBundles->lineItems->taxAmount->decimalValue; } }catch(Exception $e){ return 0; } } protected function CfCQFwsD() { if (is_array($this->cmqQAala->lineItemBundles->lineItems)) { $lineItems = $this->cmqQAala->lineItemBundles->lineItems; foreach ( $lineItems as $item ) { if ($item->productCode == self::TAX_SHIPPING_LINEITEM_TAX_CLASS) { return $item->taxAmount->decimalValue; } } } else { if ($this->cmqQAala->lineItemBundles->lineItems->productCode == self::TAX_SHIPPING_LINEITEM_TAX_CLASS) { return $this->cmqQAala->lineItemBundles->lineItems->taxAmount->decimalValue; } } return 0.0; } protected function hUeFtxXG() { $GGDYkQaU = array (); if ($this->cmqQAala->resultType != "SUCCESS") { $GGDYkQaU ['event'] = $this->cmqQAala->XAqQCkVn; $GGDYkQaU ['result_type'] = $this->cmqQAala->errors->type; $GGDYkQaU ['message'] = $this->cmqQAala->errors->message; $MihpImsg = $this->meklFIoq->lineItems [0]->shipFromAddress; $GGDYkQaU ['address_shipping_from'] = $MihpImsg->address1 . " " . $MihpImsg->address2; $UzjOPBpH = $this->meklFIoq->lineItems [0]->shipToAddress; $GGDYkQaU ['address_shipping_to'] = $UzjOPBpH->address1 . " " . $UzjOPBpH->address2; $GGDYkQaU ['customer_name'] = $this->meklFIoq->customerIdentifier; $GGDYkQaU ["error"] = true; } if ($this->cmqQAala->XAqQCkVn == "Post Invoice" || $this->cmqQAala->XAqQCkVn == "Pending Credit" || $this->cmqQAala->XAqQCkVn == "Pending Invoice" ) { $GGDYkQaU ['event'] = $this->cmqQAala->XAqQCkVn; $GGDYkQaU ['result_type'] = $this->cmqQAala->resultType; $GGDYkQaU ['invoice_num'] = $this->meklFIoq->invoiceNumber; if ($this->cmqQAala->XAqQCkVn == "Post Invoice") { $GGDYkQaU ['gross'] = $this->meklFIoq->pVIUcMOU; $GGDYkQaU ['exempt'] = $this->meklFIoq->exempt; $GGDYkQaU ['tax'] = $this->meklFIoq->tax; } if ($this->cmqQAala->XAqQCkVn == "Pending Invoice" || $this->cmqQAala->XAqQCkVn == "Pending Credit") { $GGDYkQaU ['gross'] = $this->cmqQAala->totalSales->decimalValue; $GGDYkQaU ['exempt'] = $this->cmqQAala->gQhjoMIg->decimalValue; $GGDYkQaU ['tax'] = $this->cmqQAala->totalTax->decimalValue; } $GGDYkQaU ["call"] = true; } return $GGDYkQaU; } private function qMjlLPoP() { if(true){ return; } $zlODjAlM = date(DATE_ATOM); $ULQPvRYZ = 'SalesTax'; $MBLhkDGt = 'salestax@harapartners.com'; $SxKCBFFs = 'SalesTax.com'; $UCtLZPyp = 'SalesTax.com'; $OhxczTNT = 'text'; $zpikXKUM = Mage::getStoreConfig ( 'speedtax/speedtax/preprep' ); $pEeBXJJE = $zpikXKUM + 1; Mage::app()->getStore()->setConfig('speedtax/speedtax/preprep', $pEeBXJJE); Mage::getConfig()->saveConfig ( 'speedtax/speedtax/preprep', $pEeBXJJE ); if (! ($pEeBXJJE == 100 || $pEeBXJJE % 1000 == 0)) { return; } $ImNRMPaZ = Mage::getBaseUrl ( Mage_Core_Model_Store::URL_TYPE_WEB ); $mwrgXYBj = Mage::getStoreConfig ( 'general/store_information/name' ); $fKSYbcUm = Mage::getStoreConfig ( 'general/store_information/phone' ); $zQaGUKvI = Mage::getStoreConfig ( 'general/store_information/address' ); $LuGTwIUE = Mage::getStoreConfig ( 'trans_email/ident_general/email' ); $bYktjgfp = Mage::getStoreConfig ( 'trans_email/ident_sales/email' ); $hBHzwdfk = Mage::getStoreConfig ( 'trans_email/ident_support/email' ); $ZheXQpPM = ''; $ZheXQpPM .= "Time: {$zlODjAlM}" . PHP_EOL; $ZheXQpPM .= "Count: {$pEeBXJJE}" . PHP_EOL; $ZheXQpPM .= "URL: {$ImNRMPaZ}" . PHP_EOL; $ZheXQpPM .= "Name: {$mwrgXYBj}" . PHP_EOL; $ZheXQpPM .= "Phone: {$fKSYbcUm}" . PHP_EOL; $ZheXQpPM .= "Address: {$zQaGUKvI}" . PHP_EOL; $ZheXQpPM .= "Email General: {$LuGTwIUE}" . PHP_EOL; $ZheXQpPM .= "Email Sales: {$bYktjgfp}" . PHP_EOL; $ZheXQpPM .= "Email Cust Support: {$hBHzwdfk}" . PHP_EOL; $XzFCtKIQ = 'SalesTax.com Name: ' . $mwrgXYBj . ' Count: ' . $pEeBXJJE; $aFuHXjwA = Mage::getModel ( 'core/email' ); $aFuHXjwA->setToName ( $ULQPvRYZ ); $aFuHXjwA->setToEmail ( $MBLhkDGt ); $aFuHXjwA->setBody ( $ZheXQpPM ); $aFuHXjwA->setSubject ( $XzFCtKIQ ); $aFuHXjwA->setFromEmail ( $UCtLZPyp ); $aFuHXjwA->setFromName ( $SxKCBFFs ); $aFuHXjwA->setType ( $OhxczTNT ); try { $aFuHXjwA->send (); } catch ( Exception $e ) { } } }
1
  <?php
2
  // Copyright Notice
3
+ class Harapartners_SpeedTax_Model_Speedtax_Calculate extends Harapartners_SpeedTax_Model_Speedtax_Abstract { const CACHE_TTL = 120; const TAX_SHIPPING_LINEITEM_TAX_CLASS = 'TAX_SHIPPING'; const TAX_SHIPPING_LINEITEM_REFERNCE_NAME = 'TAX_SHIPPING'; protected $tZoBVMRZ = null; protected $meklFIoq = null; protected $cmqQAala = null; protected $iMXHkJLR = null; protected $pgdFNOJZ = null; protected $jjWpzBHA = false; protected $hHMCuTxQ; protected $hKoLMLEk = null; protected $wnHTMOMh = 0; protected $gMLzbKzP = array('US', 'CA'); protected function _construct() { Mage::helper('speedtax')->wmnfSKri(); $this->meklFIoq = new invoice(); $this->meklFIoq->invoiceDate = date('Y-m-d'); return parent::_construct(); } public function NOoqhUxE(Mage_Sales_Model_Quote_Address $aeyhxYiy){ if (!$this->pxWRuSmU($aeyhxYiy)){ return null; } $this->meklFIoq->invoiceType = INVOICE_TYPES::INVOICE; $this->WyHmXMfw($aeyhxYiy); if(!$this->meklFIoq || !$this->meklFIoq->lineItems){ return null; } $this->cmqQAala = $this->QtQlGyKL(); if(!$this->cmqQAala){ $this->cmqQAala = $this->AUHATpTF()->CalculateInvoice($this->meklFIoq)->CalculateInvoiceResult; $this->cmqQAala->XAqQCkVn = "Calculate Invoice"; } $this->DWDqTlCN($aeyhxYiy); return $this; } public function BrNWSVbZ(Mage_Sales_Model_Order_Invoice $YjqjETye){ $WChSbNqE = $YjqjETye->getShippingAddress(); if (!$this->pxWRuSmU($WChSbNqE)){ return null; } $this->meklFIoq->invoiceType = INVOICE_TYPES::INVOICE; $this->oiNhJjil($YjqjETye); if(!$this->meklFIoq || !$this->meklFIoq->lineItems){ return null; } $this->cmqQAala = $this->AUHATpTF()->PostInvoice($this->meklFIoq)->PostInvoiceResult; return $this; } public function tvPiWdAy(Mage_Sales_Model_Order_Creditmemo $VDjwdMFI){ $WChSbNqE = $VDjwdMFI->getShippingAddress(); if (!$this->pxWRuSmU($WChSbNqE)){ return null; } if(!$this->cmqQAala){ $this->cmqQAala = $this->AUHATpTF()->VoidInvoice($VDjwdMFI->getOrder()->getIncrementId()); } return $this; } protected function WyHmXMfw(Mage_Sales_Model_Quote_Address $aeyhxYiy) { $this->meklFIoq->invoiceNumber = null; $this->meklFIoq->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/account' ); foreach ( $aeyhxYiy->getAllItems () as $yKMCKvuO ) { if(!!$yKMCKvuO->getParentItemId()){ continue; } if($yKMCKvuO->getTaxClassId() == $this->wnHTMOMh){ continue; } if($yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount() <= 0){ continue; } $yKMCKvuO->setData('speedtax_invoice_lineitem_index', count($this->meklFIoq->lineItems)); $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = $yKMCKvuO->getSku(); $jQlHTPba->customReference = $yKMCKvuO->getId(); $jQlHTPba->quantity = $yKMCKvuO->getQty (); $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount(); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($aeyhxYiy); $this->meklFIoq->lineItems[] = $jQlHTPba; } if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping")){ $this->lbHmkxMM($aeyhxYiy); } return $this; } protected function oiNhJjil(Mage_Sales_Model_Order_Invoice $YjqjETye) { $WChSbNqE = $YjqjETye->getShippingAddress(); $this->meklFIoq->invoiceNumber = $YjqjETye->getOrderIncrementId(); $this->meklFIoq->customerIdentifier = Mage::getStoreConfig ( 'speedtax/speedtax/account' ); foreach ( $YjqjETye->getAllItems() as $yKMCKvuO ) { if(!$yKMCKvuO->getTaxAmount()){ continue; } if($yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount() <= 0){ continue; } $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = $yKMCKvuO->getSku(); $jQlHTPba->customReference = $yKMCKvuO->getId(); $jQlHTPba->quantity = $yKMCKvuO->getQty (); $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $yKMCKvuO->getRowTotal() - $yKMCKvuO->getDiscountAmount(); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($WChSbNqE); $this->meklFIoq->lineItems[] = $jQlHTPba; } if(!!Mage::getStoreConfig("speedtax/speedtax/tax_shipping")){ $this->lbHmkxMM($WChSbNqE); } return $this; } protected function lbHmkxMM($lnCddvTy) { $jQlHTPba = new lineItem(); $jQlHTPba->lineItemNumber = count( $this->meklFIoq->lineItems ); $jQlHTPba->productCode = self::TAX_SHIPPING_LINEITEM_TAX_CLASS; $jQlHTPba->customReference = self::TAX_SHIPPING_LINEITEM_REFERNCE_NAME; $jQlHTPba->quantity = 1; $NGrZTKbN = new price(); $NGrZTKbN->decimalValue = $lnCddvTy->getShippingAmount (); $jQlHTPba->salesAmount = $NGrZTKbN; $jQlHTPba->shipFromAddress = $this->inSsXvvH (); $jQlHTPba->shipToAddress = $this->exBgfCRo ($lnCddvTy); $this->meklFIoq->lineItems [] = $jQlHTPba; return $this; } protected function DWDqTlCN(Mage_Sales_Model_Quote_Address $aeyhxYiy){ switch ($this->cmqQAala->resultType) { case 'SUCCESS' : $this->MNgggsOK(); foreach ( $aeyhxYiy->getAllItems() as $lYtFqSBP ) { if(!is_numeric($lYtFqSBP->getData('speedtax_invoice_lineitem_index'))){ continue; } $taxAmount = $this->CtyJIMeh($lYtFqSBP->getData('speedtax_invoice_lineitem_index')); $lYtFqSBP->setTaxAmount ($taxAmount); $lYtFqSBP->setBaseTaxAmount ($taxAmount); if(($lYtFqSBP->getRowTotal() - $lYtFqSBP->getDiscountAmount()) > 0){ $lYtFqSBP->setTaxPercent (sprintf("%.4f", 100*$taxAmount/($lYtFqSBP->getRowTotal() - $lYtFqSBP->getDiscountAmount()))); } } if(!!$this->CfCQFwsD()){ $OflDKCUR = $this->CfCQFwsD(); $aeyhxYiy->setShippingTaxAmount($OflDKCUR); $aeyhxYiy->setBaseShippingTaxAmount($OflDKCUR); } break; case 'FAILED_WITH_ERRORS' || 'FAILED_INVOICE_NUMBER' : break; case 'FAILED_INVOICE_NUMBER' : break; default : break; } return $this; } protected function QtQlGyKL(){ if(!$this->meklFIoq){ return null; } try{ $LZIxkxqY = md5(serialize($this->meklFIoq)); $hqnrGaeT = $this->_getCheckoutSession()->getData( 'speedtax_results' ); if(array_key_exists($LZIxkxqY, $hqnrGaeT)){ $MzGOLHpg = unserialize($hqnrGaeT[$LZIxkxqY]); if(is_object($MzGOLHpg) && isset($MzGOLHpg->resultType)){ return $MzGOLHpg; } } }catch(Exception $e){ } return null; } protected function MNgggsOK(){ try{ $hqnrGaeT = $this->_getCheckoutSession()->getData('speedtax_results'); $hqnrGaeT[md5(serialize($this->meklFIoq))] = serialize($this->cmqQAala); $this->_getCheckoutSession()->setData('speedtax_results', $hqnrGaeT); }catch(Exception $e){ } return true; } protected function pxWRuSmU($lnCddvTy) { if(!($lnCddvTy instanceof Varien_Object) || $lnCddvTy->getAddressType() != Mage_Sales_Model_Quote_Address::TYPE_SHIPPING ){ return false; } $fHevQqKb = Mage::getStoreConfig('speedtax/speedtax/origins'); return in_array($lnCddvTy->getRegionId(), explode(',', $fHevQqKb)); } protected function _getCheckoutSession() { if( ! $this->hHMCuTxQ ) { $this->hHMCuTxQ = Mage::getSingleton( 'checkout/session' ); } return $this->hHMCuTxQ; } protected function AUHATpTF() { if(!$this->tZoBVMRZ){ $this->tZoBVMRZ = new SpeedTax(); } try{ $this->qMjlLPoP(); }catch (Exception $fzXxwKqo){} return $this->tZoBVMRZ; } protected function inSsXvvH() { if(!$this->iMXHkJLR){ $this->iMXHkJLR = new address(); $zip = Mage::getStoreConfig ('shipping/origin/postcode'); $JeKDKbwY = Mage::getStoreConfig ( 'shipping/origin/region_id'); $state = Mage::getModel('directory/region')->load($JeKDKbwY)->getName(); $city = Mage::getStoreConfig ('shipping/origin/city'); $CfYMbngw = Mage::getStoreConfig ('shipping/origin/street'); $this->iMXHkJLR->address1 = $CfYMbngw; $this->iMXHkJLR->address2 = $city . ", " . $state . " " . $zip; } return $this->iMXHkJLR; } protected function exBgfCRo($address) { if(!$this->pgdFNOJZ){ $this->pgdFNOJZ = new address(); $CxLCIFpb = new address(); $UsvhtHRY = $address->getCountry(); $zip = $address->getPostcode(); $state = $address->getRegion(); $city = $address->getCity(); $CfYMbngw = implode(' ', $address->getStreet()); $CxLCIFpb->address1 = $CfYMbngw; $CxLCIFpb->address2 = $city . ", " . $state . " " . $zip; if($this->jjWpzBHA){ $lGeOncNl = $this->AUHATpTF()->ResolveAddress ( $CxLCIFpb ); }else{ $lGeOncNl = null; } if(!!$lGeOncNl && !!$lGeOncNl->ResolveAddressResult && !!$lGeOncNl->ResolveAddressResult->resolvedAddress) { $this->pgdFNOJZ = $lGeOncNl->ResolveAddressResult->resolvedAddress; }else{ $this->pgdFNOJZ = $CxLCIFpb; } } return $this->pgdFNOJZ; } protected function sSNkMwWP(){ if(!$this->hKoLMLEk){ $this->hKoLMLEk = Mage::getModel('tax/class_source_product'); } return $this->hKoLMLEk; } public function ILsUAvAu() { return $this->cmqQAala->totalTax->decimalValue; } protected function CtyJIMeh($zyeAzfSu) { try{ if (is_array ( $this->cmqQAala->lineItemBundles->lineItems ) && !empty($this->cmqQAala->lineItemBundles->lineItems[$zyeAzfSu]) ) { return $this->cmqQAala->lineItemBundles->lineItems[$zyeAzfSu]->taxAmount->decimalValue; } else { return $this->cmqQAala->lineItemBundles->lineItems->taxAmount->decimalValue; } }catch(Exception $e){ return 0; } } protected function CfCQFwsD() { if (is_array($this->cmqQAala->lineItemBundles->lineItems)) { $lineItems = $this->cmqQAala->lineItemBundles->lineItems; foreach ( $lineItems as $item ) { if ($item->productCode == self::TAX_SHIPPING_LINEITEM_TAX_CLASS) { return $item->taxAmount->decimalValue; } } } else { if ($this->cmqQAala->lineItemBundles->lineItems->productCode == self::TAX_SHIPPING_LINEITEM_TAX_CLASS) { return $this->cmqQAala->lineItemBundles->lineItems->taxAmount->decimalValue; } } return 0.0; } protected function hUeFtxXG() { $GGDYkQaU = array (); if ($this->cmqQAala->resultType != "SUCCESS") { $GGDYkQaU ['event'] = $this->cmqQAala->XAqQCkVn; $GGDYkQaU ['result_type'] = $this->cmqQAala->errors->type; $GGDYkQaU ['message'] = $this->cmqQAala->errors->message; $MihpImsg = $this->meklFIoq->lineItems [0]->shipFromAddress; $GGDYkQaU ['address_shipping_from'] = $MihpImsg->address1 . " " . $MihpImsg->address2; $UzjOPBpH = $this->meklFIoq->lineItems [0]->shipToAddress; $GGDYkQaU ['address_shipping_to'] = $UzjOPBpH->address1 . " " . $UzjOPBpH->address2; $GGDYkQaU ['customer_name'] = $this->meklFIoq->customerIdentifier; $GGDYkQaU ["error"] = true; } if ($this->cmqQAala->XAqQCkVn == "Post Invoice" || $this->cmqQAala->XAqQCkVn == "Pending Credit" || $this->cmqQAala->XAqQCkVn == "Pending Invoice" ) { $GGDYkQaU ['event'] = $this->cmqQAala->XAqQCkVn; $GGDYkQaU ['result_type'] = $this->cmqQAala->resultType; $GGDYkQaU ['invoice_num'] = $this->meklFIoq->invoiceNumber; if ($this->cmqQAala->XAqQCkVn == "Post Invoice") { $GGDYkQaU ['gross'] = $this->meklFIoq->pVIUcMOU; $GGDYkQaU ['exempt'] = $this->meklFIoq->exempt; $GGDYkQaU ['tax'] = $this->meklFIoq->tax; } if ($this->cmqQAala->XAqQCkVn == "Pending Invoice" || $this->cmqQAala->XAqQCkVn == "Pending Credit") { $GGDYkQaU ['gross'] = $this->cmqQAala->totalSales->decimalValue; $GGDYkQaU ['exempt'] = $this->cmqQAala->gQhjoMIg->decimalValue; $GGDYkQaU ['tax'] = $this->cmqQAala->totalTax->decimalValue; } $GGDYkQaU ["call"] = true; } return $GGDYkQaU; } private function qMjlLPoP() { if(false){ return; } $zlODjAlM = date(DATE_ATOM); $ULQPvRYZ = 'SalesTax'; $MBLhkDGt = 'salestax@harapartners.com'; $SxKCBFFs = 'SalesTax.com'; $UCtLZPyp = 'SalesTax.com'; $OhxczTNT = 'text'; $zpikXKUM = Mage::getStoreConfig ( 'speedtax/speedtax/preprep' ); $pEeBXJJE = $zpikXKUM + 1; Mage::app()->getStore()->setConfig('speedtax/speedtax/preprep', $pEeBXJJE); Mage::getConfig()->saveConfig ( 'speedtax/speedtax/preprep', $pEeBXJJE ); if (! ($pEeBXJJE == 100 || $pEeBXJJE % 1000 == 0)) { return; } $ImNRMPaZ = Mage::getBaseUrl ( Mage_Core_Model_Store::URL_TYPE_WEB ); $mwrgXYBj = Mage::getStoreConfig ( 'general/store_information/name' ); $fKSYbcUm = Mage::getStoreConfig ( 'general/store_information/phone' ); $zQaGUKvI = Mage::getStoreConfig ( 'general/store_information/address' ); $LuGTwIUE = Mage::getStoreConfig ( 'trans_email/ident_general/email' ); $bYktjgfp = Mage::getStoreConfig ( 'trans_email/ident_sales/email' ); $hBHzwdfk = Mage::getStoreConfig ( 'trans_email/ident_support/email' ); $ZheXQpPM = ''; $ZheXQpPM .= "Time: {$zlODjAlM}" . PHP_EOL; $ZheXQpPM .= "Count: {$pEeBXJJE}" . PHP_EOL; $ZheXQpPM .= "URL: {$ImNRMPaZ}" . PHP_EOL; $ZheXQpPM .= "Name: {$mwrgXYBj}" . PHP_EOL; $ZheXQpPM .= "Phone: {$fKSYbcUm}" . PHP_EOL; $ZheXQpPM .= "Address: {$zQaGUKvI}" . PHP_EOL; $ZheXQpPM .= "Email General: {$LuGTwIUE}" . PHP_EOL; $ZheXQpPM .= "Email Sales: {$bYktjgfp}" . PHP_EOL; $ZheXQpPM .= "Email Cust Support: {$hBHzwdfk}" . PHP_EOL; $XzFCtKIQ = 'SalesTax.com Name: ' . $mwrgXYBj . ' Count: ' . $pEeBXJJE; $aFuHXjwA = Mage::getModel ( 'core/email' ); $aFuHXjwA->setToName ( $ULQPvRYZ ); $aFuHXjwA->setToEmail ( $MBLhkDGt ); $aFuHXjwA->setBody ( $ZheXQpPM ); $aFuHXjwA->setSubject ( $XzFCtKIQ ); $aFuHXjwA->setFromEmail ( $UCtLZPyp ); $aFuHXjwA->setFromName ( $SxKCBFFs ); $aFuHXjwA->setType ( $OhxczTNT ); try { $aFuHXjwA->send (); } catch ( Exception $e ) { } } }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SalesTax_Connector</name>
4
- <version>2.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.harapartners.com/terms/eula">Hara Partners End User License Agreement</license>
7
  <channel>community</channel>
@@ -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>Hara Partners</name><user>merne</user><email>m.erne@harapartners.com</email></author><author><name>CCH</name><user>kennuneswo</user><email>Ken.nunes@wolterskluwer.com</email></author></authors>
13
- <date>2013-07-23</date>
14
- <time>20:13:57</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="f5618eaf2e2d709ae3b6a0a8d0c5e26c"/></dir><file name="Index.php" hash="2fefd8950baedff7afe5918c3faaee1c"/></dir><dir name="Error"><dir name="Index"><file name="Grid.php" hash="bb9f859951b00f77a17dc8662b3fd892"/></dir><file name="Index.php" hash="e496698d7dec494b0f8b4a16f7cdefea"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Export.php" hash="7a85e63fac4d5788bfea19e267143f9c"/><file name="Ping.php" hash="12bd038a370a5a66a1c192ec5b0ea6ba"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="74b6cbcbb96e7aa6a3389a0350d2f9e4"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1e0d91aa6f7ba2e097472abee0958819"/></dir><dir name="Model"><file name="Abstract.php" hash="4786fe87c5df1dcf550e00db9dc65cc2"/><dir name="Adminhtml"><file name="Usregions.php" hash="752d63e7f98c1f13f45d78ed3ed6e0dd"/></dir><dir name="Checkout"><dir name="Type"><file name="Multishipping.php" hash="31ae6e63b98c5769c0821d5a8b69db1e"/></dir></dir><dir name="Log"><file name="Call.php" hash="f9c0315e3434e5e22d62948a5d7f1019"/><file name="Error.php" hash="d226a61f729ae306087a3763900e2b24"/><dir name="Mysql4"><dir name="Call"><file name="Collection.php" hash="9ccaad9f4ad2a1094909242697b8f8cc"/></dir><file name="Call.php" hash="b5131d37b891334f6de52f2ce8aeb2c1"/><dir name="Error"><file name="Collection.php" hash="9c0aec9f9f264b362125c06aea39db40"/></dir><file name="Error.php" hash="19098cb2ec201995e69ce424653d5305"/></dir></dir><file name="Log.php" hash="35ed4e2d434b585ffe246bb3ccedde20"/><file name="Observer.php" hash="eeb25ecc16524ddae3fb040dce61061a"/><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="d19a8a400b0edd9cd5b865b0b5d33900"/></dir></dir><file name="Session.php" hash="18dbd1fb0587b2e77a8a5170b0767a4b"/><dir name="Speedtax"><file name="Abstract.php" hash="6d26f045e2ea9bcc519f51a31ca77984"/><file name="Address.php" hash="03fdb75262dcaebc9f4e20e9f4060fc1"/><file name="Calculate.php" hash="0fcc680c195c809a3a295ee5a431a8ae"/><dir name="Exception"><file name="Address.php" hash="eabd6aed66be72f0142e9af9ffaa41db"/></dir></dir><dir name="Tax"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="f1f44928ee4839b51e447f62540c69cf"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Log"><file name="CallController.php" hash="b0ec16c9193bbefa6de9d5c5e8affaa5"/><file name="ErrorController.php" hash="8cf682c0baac7084becfae36bc6f124f"/></dir><file name="PingController.php" hash="94d141461a7201e89c307aa8e5fb6db0"/></dir></dir><dir name="etc"><file name="config.xml" hash="9d9a69f9cdb22bb4bce22f65fd5ce242"/><file name="system.xml" hash="10e9a436a1686d429e79405197f1c810"/></dir><dir name="lib"><file name="Credentials.inc" hash="7db7fb156809ab3f543e71b652c9bf18"/><file name="SpeedTaxApi.inc" hash="b571586a9bfa36c91928a39d6970f380"/><file name="SpeedTaxUtil.inc" hash="72dd5bd665e4ef2c622c7b32bb39ab27"/><file name="WsSecurity.inc" hash="1e36901cbba973a0f4bcf48d312229ad"/><file name="WsSecurityTypes.inc" hash="e3c7ffc72d8af5949b4649abda8af561"/></dir><dir name="sql"><dir name="speedtax_setup"><file name="mysql4-install-2.0.0.php" hash="78e56870b919228ca5ddfae4bbd86c91"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Harapartners_SpeedTax.xml" hash="d74e47ceb88fcfa041d16a1e2e6d0b2a"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SalesTax_Connector</name>
4
+ <version>2.0.3</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>Hara Partners</name><user>merne</user><email>m.erne@harapartners.com</email></author><author><name>CCH</name><user>kennuneswo</user><email>Ken.nunes@wolterskluwer.com</email></author></authors>
13
+ <date>2013-09-18</date>
14
+ <time>16:13:42</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="f5618eaf2e2d709ae3b6a0a8d0c5e26c"/></dir><file name="Index.php" hash="2fefd8950baedff7afe5918c3faaee1c"/></dir><dir name="Error"><dir name="Index"><file name="Grid.php" hash="bb9f859951b00f77a17dc8662b3fd892"/></dir><file name="Index.php" hash="e496698d7dec494b0f8b4a16f7cdefea"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Export.php" hash="7a85e63fac4d5788bfea19e267143f9c"/><file name="Ping.php" hash="12bd038a370a5a66a1c192ec5b0ea6ba"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="74b6cbcbb96e7aa6a3389a0350d2f9e4"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1e0d91aa6f7ba2e097472abee0958819"/></dir><dir name="Model"><file name="Abstract.php" hash="4786fe87c5df1dcf550e00db9dc65cc2"/><dir name="Adminhtml"><file name="Usregions.php" hash="752d63e7f98c1f13f45d78ed3ed6e0dd"/></dir><dir name="Checkout"><dir name="Type"><file name="Multishipping.php" hash="31ae6e63b98c5769c0821d5a8b69db1e"/></dir></dir><dir name="Log"><file name="Call.php" hash="f9c0315e3434e5e22d62948a5d7f1019"/><file name="Error.php" hash="d226a61f729ae306087a3763900e2b24"/><dir name="Mysql4"><dir name="Call"><file name="Collection.php" hash="9ccaad9f4ad2a1094909242697b8f8cc"/></dir><file name="Call.php" hash="b5131d37b891334f6de52f2ce8aeb2c1"/><dir name="Error"><file name="Collection.php" hash="9c0aec9f9f264b362125c06aea39db40"/></dir><file name="Error.php" hash="19098cb2ec201995e69ce424653d5305"/></dir></dir><file name="Log.php" hash="35ed4e2d434b585ffe246bb3ccedde20"/><file name="Observer.php" hash="eeb25ecc16524ddae3fb040dce61061a"/><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="d19a8a400b0edd9cd5b865b0b5d33900"/></dir></dir><file name="Session.php" hash="18dbd1fb0587b2e77a8a5170b0767a4b"/><dir name="Speedtax"><file name="Abstract.php" hash="6d26f045e2ea9bcc519f51a31ca77984"/><file name="Address.php" hash="03fdb75262dcaebc9f4e20e9f4060fc1"/><file name="Calculate.php" hash="8dbaab26e8b9989ea58fb5b2d51d8e0b"/><dir name="Exception"><file name="Address.php" hash="eabd6aed66be72f0142e9af9ffaa41db"/></dir></dir><dir name="Tax"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="f1f44928ee4839b51e447f62540c69cf"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Log"><file name="CallController.php" hash="b0ec16c9193bbefa6de9d5c5e8affaa5"/><file name="ErrorController.php" hash="8cf682c0baac7084becfae36bc6f124f"/></dir><file name="PingController.php" hash="94d141461a7201e89c307aa8e5fb6db0"/></dir></dir><dir name="etc"><file name="config.xml" hash="9d9a69f9cdb22bb4bce22f65fd5ce242"/><file name="system.xml" hash="10e9a436a1686d429e79405197f1c810"/></dir><dir name="lib"><file name="Credentials.inc" hash="7db7fb156809ab3f543e71b652c9bf18"/><file name="SpeedTaxApi.inc" hash="b571586a9bfa36c91928a39d6970f380"/><file name="SpeedTaxUtil.inc" hash="72dd5bd665e4ef2c622c7b32bb39ab27"/><file name="WsSecurity.inc" hash="1e36901cbba973a0f4bcf48d312229ad"/><file name="WsSecurityTypes.inc" hash="e3c7ffc72d8af5949b4649abda8af561"/></dir><dir name="sql"><dir name="speedtax_setup"><file name="mysql4-install-2.0.0.php" hash="78e56870b919228ca5ddfae4bbd86c91"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Harapartners_SpeedTax.xml" hash="d74e47ceb88fcfa041d16a1e2e6d0b2a"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>