Version Notes
Initial Public Release
Download this release
Release Info
| Developer | Vonnda Development |
| Extension | Taxify_Sales_Tax_Rates_and_Filing |
| Version | 0.1.6 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.5 to 0.1.6
- app/code/local/Vonnda/Taxify/Block/Adminhtml/Tax/Class/Edit/Form.php +2 -3
- app/code/local/Vonnda/Taxify/Helper/Data.php +4 -5
- app/code/local/Vonnda/Taxify/Model/Client.php +9 -3
- app/code/local/Vonnda/Taxify/Model/Request/Calculate.php +1 -3
- app/code/local/Vonnda/Taxify/Model/Request/Codes.php +57 -0
- app/code/local/Vonnda/Taxify/Model/Request/Request.php +1 -3
- app/code/local/Vonnda/Taxify/Model/Sales/Quote/Address/Total/Tax.php +19 -25
- app/code/local/Vonnda/Taxify/etc/config.xml +1 -1
- app/code/local/Vonnda/Taxify/tests/Helper/DataTest.php +6 -4
- app/code/local/Vonnda/Taxify/tests/Request/CodesTest.php +51 -0
- package.xml +4 -4
app/code/local/Vonnda/Taxify/Block/Adminhtml/Tax/Class/Edit/Form.php
CHANGED
|
@@ -7,11 +7,11 @@ class Vonnda_Taxify_Block_Adminhtml_Tax_Class_Edit_Form extends Mage_Adminhtml_B
|
|
| 7 |
{
|
| 8 |
parent::_prepareForm();
|
| 9 |
$fieldset = $this->getForm()->getElement('base_fieldset');
|
| 10 |
-
|
| 11 |
$model = Mage::registry('tax_class');
|
| 12 |
$fieldset->addField('taxify_code', 'select', array(
|
| 13 |
'name' => 'taxify_customer_taxability',
|
| 14 |
-
'label' => Mage::helper('taxify')->__('Taxify
|
| 15 |
'required' => true,
|
| 16 |
'values' => Mage::helper('taxify')->getCustomerTaxabilityOptions(),
|
| 17 |
'value' => $model->getTaxifyCustomerTaxability(),
|
|
@@ -21,4 +21,3 @@ class Vonnda_Taxify_Block_Adminhtml_Tax_Class_Edit_Form extends Mage_Adminhtml_B
|
|
| 21 |
return $this;
|
| 22 |
}
|
| 23 |
}
|
| 24 |
-
|
| 7 |
{
|
| 8 |
parent::_prepareForm();
|
| 9 |
$fieldset = $this->getForm()->getElement('base_fieldset');
|
| 10 |
+
|
| 11 |
$model = Mage::registry('tax_class');
|
| 12 |
$fieldset->addField('taxify_code', 'select', array(
|
| 13 |
'name' => 'taxify_customer_taxability',
|
| 14 |
+
'label' => Mage::helper('taxify')->__('Taxify Tax Class'),
|
| 15 |
'required' => true,
|
| 16 |
'values' => Mage::helper('taxify')->getCustomerTaxabilityOptions(),
|
| 17 |
'value' => $model->getTaxifyCustomerTaxability(),
|
| 21 |
return $this;
|
| 22 |
}
|
| 23 |
}
|
|
|
app/code/local/Vonnda/Taxify/Helper/Data.php
CHANGED
|
@@ -4,11 +4,10 @@ class Vonnda_Taxify_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 4 |
{
|
| 5 |
public function getCustomerTaxabilityOptions()
|
| 6 |
{
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
);
|
| 12 |
}
|
| 13 |
|
| 14 |
public function getTaxifyCustomerTaxability($customerId)
|
| 4 |
{
|
| 5 |
public function getCustomerTaxabilityOptions()
|
| 6 |
{
|
| 7 |
+
$codReq = Mage::getModel('taxify/request_codes');
|
| 8 |
+
$codReq->send();
|
| 9 |
+
|
| 10 |
+
return $codReq->getCodesWithLabels();
|
|
|
|
| 11 |
}
|
| 12 |
|
| 13 |
public function getTaxifyCustomerTaxability($customerId)
|
app/code/local/Vonnda/Taxify/Model/Client.php
CHANGED
|
@@ -9,6 +9,7 @@ class Vonnda_Taxify_Model_Client extends Mage_Core_Model_Abstract
|
|
| 9 |
public $url = '';
|
| 10 |
public $soapClient;
|
| 11 |
public $logFilename = 'taxify.log';
|
|
|
|
| 12 |
const PARTNER_KEY = '275067E9-C359-4BF3-AC6E-2772456F6FAD';
|
| 13 |
|
| 14 |
public function __construct()
|
|
@@ -29,16 +30,21 @@ class Vonnda_Taxify_Model_Client extends Mage_Core_Model_Abstract
|
|
| 29 |
|
| 30 |
public function addSecurityToRequest()
|
| 31 |
{
|
| 32 |
-
$this->request[
|
| 33 |
'Username' => $this->config->getApiUsername(),
|
| 34 |
'Password' => $this->config->getApiPassword(),
|
| 35 |
);
|
| 36 |
-
$this->request[
|
| 37 |
}
|
| 38 |
|
| 39 |
public function buildRequest($req)
|
| 40 |
{
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
$this->addSecurityToRequest();
|
| 43 |
}
|
| 44 |
|
| 9 |
public $url = '';
|
| 10 |
public $soapClient;
|
| 11 |
public $logFilename = 'taxify.log';
|
| 12 |
+
public $requestNodeName = 'Request';
|
| 13 |
const PARTNER_KEY = '275067E9-C359-4BF3-AC6E-2772456F6FAD';
|
| 14 |
|
| 15 |
public function __construct()
|
| 30 |
|
| 31 |
public function addSecurityToRequest()
|
| 32 |
{
|
| 33 |
+
$this->request[$this->requestNodeName]['Security'] = array(
|
| 34 |
'Username' => $this->config->getApiUsername(),
|
| 35 |
'Password' => $this->config->getApiPassword(),
|
| 36 |
);
|
| 37 |
+
$this->request[$this->requestNodeName]['Security']['PartnerKey'] = self::PARTNER_KEY;
|
| 38 |
}
|
| 39 |
|
| 40 |
public function buildRequest($req)
|
| 41 |
{
|
| 42 |
+
// Because GetCodes doesn't have the "Request" node.
|
| 43 |
+
if (array_key_exists('GetCodes', $req)) {
|
| 44 |
+
$this->requestNodeName = 'GetCodes';
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
$this->request[$this->requestNodeName] = $req;
|
| 48 |
$this->addSecurityToRequest();
|
| 49 |
}
|
| 50 |
|
app/code/local/Vonnda/Taxify/Model/Request/Calculate.php
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
|
| 3 |
class Vonnda_Taxify_Model_Request_Calculate extends Vonnda_Taxify_Model_Request_Request
|
| 4 |
{
|
| 5 |
-
|
| 6 |
public $apiMethod = 'CalculateTax';
|
| 7 |
public $isCommited = 'false';
|
| 8 |
|
|
@@ -216,7 +215,7 @@ class Vonnda_Taxify_Model_Request_Calculate extends Vonnda_Taxify_Model_Request_
|
|
| 216 |
if ($this->order) {
|
| 217 |
$this->request['DocumentKey'] = $this->order->getIncrementId();
|
| 218 |
} else {
|
| 219 |
-
$this->request['DocumentKey'] = 'q-'
|
| 220 |
}
|
| 221 |
|
| 222 |
$timezone = 'America/Los_Angeles';
|
|
@@ -291,5 +290,4 @@ class Vonnda_Taxify_Model_Request_Calculate extends Vonnda_Taxify_Model_Request_
|
|
| 291 |
|
| 292 |
return $tax;
|
| 293 |
}
|
| 294 |
-
|
| 295 |
}
|
| 2 |
|
| 3 |
class Vonnda_Taxify_Model_Request_Calculate extends Vonnda_Taxify_Model_Request_Request
|
| 4 |
{
|
|
|
|
| 5 |
public $apiMethod = 'CalculateTax';
|
| 6 |
public $isCommited = 'false';
|
| 7 |
|
| 215 |
if ($this->order) {
|
| 216 |
$this->request['DocumentKey'] = $this->order->getIncrementId();
|
| 217 |
} else {
|
| 218 |
+
$this->request['DocumentKey'] = 'q-'.$this->getMageModel()->getId();
|
| 219 |
}
|
| 220 |
|
| 221 |
$timezone = 'America/Los_Angeles';
|
| 290 |
|
| 291 |
return $tax;
|
| 292 |
}
|
|
|
|
| 293 |
}
|
app/code/local/Vonnda/Taxify/Model/Request/Codes.php
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Vonnda_Taxify_Model_Request_Codes extends Vonnda_Taxify_Model_Request_Request
|
| 4 |
+
{
|
| 5 |
+
public $apiMethod = 'GetCodes';
|
| 6 |
+
public $defaultCodes = array(
|
| 7 |
+
'',
|
| 8 |
+
'CLOTHING',
|
| 9 |
+
'FOOD',
|
| 10 |
+
'FREIGHT',
|
| 11 |
+
'NONTAX',
|
| 12 |
+
'TAXABLE',
|
| 13 |
+
);
|
| 14 |
+
|
| 15 |
+
public function build()
|
| 16 |
+
{
|
| 17 |
+
$this->request['GetCodes'] = array('CodeType' => 'Item');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function getCodes()
|
| 21 |
+
{
|
| 22 |
+
// Return defaults if something goes wrong
|
| 23 |
+
if (!isset($this->response->GetCodesResult->Codes->string)) {
|
| 24 |
+
return $this->defaultCodes;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
if (!is_array($this->response->GetCodesResult->Codes->string)) {
|
| 28 |
+
return $this->defaultCodes;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
$result = $this->response->GetCodesResult->Codes->string;
|
| 32 |
+
array_unshift($result, ''); // add blank which is default tax
|
| 33 |
+
|
| 34 |
+
return $result;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function getCodesWithLabels()
|
| 38 |
+
{
|
| 39 |
+
$codesWithLabels = array();
|
| 40 |
+
$codes = $this->getCodes();
|
| 41 |
+
foreach ($codes as $code) {
|
| 42 |
+
$codesWithLabels[$code] = $this->getLabelFromCode($code);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return $codesWithLabels;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public function getLabelFromCode($code)
|
| 49 |
+
{
|
| 50 |
+
if ($code == '') {
|
| 51 |
+
return 'Default';
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return ucwords(strtolower($code));
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
}
|
app/code/local/Vonnda/Taxify/Model/Request/Request.php
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
|
| 3 |
class Vonnda_Taxify_Model_Request_Request extends Mage_Core_Model_Abstract
|
| 4 |
{
|
| 5 |
-
|
| 6 |
public $order;
|
| 7 |
public $request = array();
|
| 8 |
public $response;
|
|
@@ -16,7 +15,7 @@ class Vonnda_Taxify_Model_Request_Request extends Mage_Core_Model_Abstract
|
|
| 16 |
|
| 17 |
public function loadOrder($order)
|
| 18 |
{
|
| 19 |
-
$this->order = $order;
|
| 20 |
}
|
| 21 |
|
| 22 |
public function loadQuote($quote)
|
|
@@ -63,5 +62,4 @@ class Vonnda_Taxify_Model_Request_Request extends Mage_Core_Model_Abstract
|
|
| 63 |
|
| 64 |
return $region->getCode();
|
| 65 |
}
|
| 66 |
-
|
| 67 |
}
|
| 2 |
|
| 3 |
class Vonnda_Taxify_Model_Request_Request extends Mage_Core_Model_Abstract
|
| 4 |
{
|
|
|
|
| 5 |
public $order;
|
| 6 |
public $request = array();
|
| 7 |
public $response;
|
| 15 |
|
| 16 |
public function loadOrder($order)
|
| 17 |
{
|
| 18 |
+
$this->order = $order;
|
| 19 |
}
|
| 20 |
|
| 21 |
public function loadQuote($quote)
|
| 62 |
|
| 63 |
return $region->getCode();
|
| 64 |
}
|
|
|
|
| 65 |
}
|
app/code/local/Vonnda/Taxify/Model/Sales/Quote/Address/Total/Tax.php
CHANGED
|
@@ -4,7 +4,8 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 4 |
{
|
| 5 |
protected $_appliedTaxes = array();
|
| 6 |
|
| 7 |
-
public function __construct()
|
|
|
|
| 8 |
$this->setCode('tax');
|
| 9 |
}
|
| 10 |
|
|
@@ -14,8 +15,6 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 14 |
|
| 15 |
$address->setTaxAmount(0);
|
| 16 |
$address->setBaseTaxAmount(0);
|
| 17 |
-
//$address->setShippingTaxAmount(0);
|
| 18 |
-
//$address->setBaseShippingTaxAmount(0);
|
| 19 |
$address->setAppliedTaxes(array());
|
| 20 |
|
| 21 |
$items = $address->getAllItems();
|
|
@@ -25,7 +24,6 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 25 |
$custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
|
| 26 |
|
| 27 |
$taxCalculationModel = Mage::getSingleton('tax/calculation');
|
| 28 |
-
/* @var $taxCalculationModel Mage_Tax_Model_Calculation */
|
| 29 |
$request = $taxCalculationModel->getRateRequest(
|
| 30 |
$address,
|
| 31 |
$address->getQuote()->getBillingAddress(),
|
|
@@ -36,12 +34,10 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 36 |
// Added by Mark Sanborn
|
| 37 |
$data = $address->getQuote()->getShippingAddress()->getData();
|
| 38 |
if ($data) {
|
| 39 |
-
//if (in_array('street', array_keys($data)) && $data['street'] != '' && in_array('city', array_keys($data))) {
|
| 40 |
if (in_array('postcode', array_keys($data)) && $data['postcode'] != '') {
|
| 41 |
$calculate = Mage::getModel('taxify/request_calculate');
|
| 42 |
$calculate->loadQuote($address->getQuote());
|
| 43 |
$calculate->send();
|
| 44 |
-
|
| 45 |
} else {
|
| 46 |
return $this;
|
| 47 |
}
|
|
@@ -62,7 +58,6 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 62 |
$item->setTaxPercent($lineTax['rate']);
|
| 63 |
$item->setTaxAmount($lineTax['amount']);
|
| 64 |
$item->setBaseTaxAmount($lineTax['amount']);
|
| 65 |
-
//$item->calcTaxAmount();
|
| 66 |
|
| 67 |
if ($discountBefore != $item->getDiscountAmount()) {
|
| 68 |
$address->setDiscountAmount(
|
|
@@ -95,24 +90,23 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 95 |
);
|
| 96 |
}
|
| 97 |
|
| 98 |
-
|
| 99 |
$shippingTaxClass = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $store);
|
| 100 |
|
| 101 |
-
$shippingTax
|
| 102 |
-
$shippingBaseTax
|
| 103 |
|
| 104 |
if ($shippingTaxClass) {
|
| 105 |
if ($rate = $taxCalculationModel->getRate($request->setProductClassId($shippingTaxClass))) {
|
| 106 |
if (!Mage::helper('tax')->shippingPriceIncludesTax()) {
|
| 107 |
-
$shippingTax
|
| 108 |
-
$shippingBaseTax= $address->getBaseShippingAmount() * $rate/100;
|
| 109 |
} else {
|
| 110 |
-
$shippingTax
|
| 111 |
-
$shippingBaseTax= $address->getBaseShippingTaxAmount();
|
| 112 |
}
|
| 113 |
|
| 114 |
-
$shippingTax
|
| 115 |
-
$shippingBaseTax= $store->roundPrice($shippingBaseTax);
|
| 116 |
|
| 117 |
$address->setTaxAmount($address->getTaxAmount() + $shippingTax);
|
| 118 |
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $shippingBaseTax);
|
|
@@ -152,6 +146,7 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 152 |
|
| 153 |
$address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());
|
| 154 |
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());
|
|
|
|
| 155 |
return $this;
|
| 156 |
}
|
| 157 |
|
|
@@ -172,8 +167,8 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 172 |
$row['percent'] = $row['percent'] ? $row['percent'] : 1;
|
| 173 |
$rate = $rate ? $rate : 1;
|
| 174 |
|
| 175 |
-
$appliedAmount = $amount
|
| 176 |
-
$baseAppliedAmount = $baseAmount
|
| 177 |
} else {
|
| 178 |
$appliedAmount = 0;
|
| 179 |
$baseAppliedAmount = 0;
|
|
@@ -183,7 +178,6 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 183 |
}
|
| 184 |
}
|
| 185 |
|
| 186 |
-
|
| 187 |
if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) {
|
| 188 |
$previouslyAppliedTaxes[$row['id']]['amount'] += $appliedAmount;
|
| 189 |
$previouslyAppliedTaxes[$row['id']]['base_amount'] += $baseAppliedAmount;
|
|
@@ -200,15 +194,15 @@ class Vonnda_Taxify_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model
|
|
| 200 |
$store = $address->getQuote()->getStore();
|
| 201 |
$amount = $address->getTaxAmount();
|
| 202 |
|
| 203 |
-
if (($amount!=0) || (Mage::helper('tax')->displayZeroTax($store))) {
|
| 204 |
$address->addTotal(array(
|
| 205 |
-
'code'
|
| 206 |
-
'title'=>Mage::helper('sales')->__('Tax'),
|
| 207 |
-
'full_info'
|
| 208 |
-
'value'
|
| 209 |
));
|
| 210 |
}
|
|
|
|
| 211 |
return $this;
|
| 212 |
}
|
| 213 |
}
|
| 214 |
-
|
| 4 |
{
|
| 5 |
protected $_appliedTaxes = array();
|
| 6 |
|
| 7 |
+
public function __construct()
|
| 8 |
+
{
|
| 9 |
$this->setCode('tax');
|
| 10 |
}
|
| 11 |
|
| 15 |
|
| 16 |
$address->setTaxAmount(0);
|
| 17 |
$address->setBaseTaxAmount(0);
|
|
|
|
|
|
|
| 18 |
$address->setAppliedTaxes(array());
|
| 19 |
|
| 20 |
$items = $address->getAllItems();
|
| 24 |
$custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
|
| 25 |
|
| 26 |
$taxCalculationModel = Mage::getSingleton('tax/calculation');
|
|
|
|
| 27 |
$request = $taxCalculationModel->getRateRequest(
|
| 28 |
$address,
|
| 29 |
$address->getQuote()->getBillingAddress(),
|
| 34 |
// Added by Mark Sanborn
|
| 35 |
$data = $address->getQuote()->getShippingAddress()->getData();
|
| 36 |
if ($data) {
|
|
|
|
| 37 |
if (in_array('postcode', array_keys($data)) && $data['postcode'] != '') {
|
| 38 |
$calculate = Mage::getModel('taxify/request_calculate');
|
| 39 |
$calculate->loadQuote($address->getQuote());
|
| 40 |
$calculate->send();
|
|
|
|
| 41 |
} else {
|
| 42 |
return $this;
|
| 43 |
}
|
| 58 |
$item->setTaxPercent($lineTax['rate']);
|
| 59 |
$item->setTaxAmount($lineTax['amount']);
|
| 60 |
$item->setBaseTaxAmount($lineTax['amount']);
|
|
|
|
| 61 |
|
| 62 |
if ($discountBefore != $item->getDiscountAmount()) {
|
| 63 |
$address->setDiscountAmount(
|
| 90 |
);
|
| 91 |
}
|
| 92 |
|
|
|
|
| 93 |
$shippingTaxClass = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $store);
|
| 94 |
|
| 95 |
+
$shippingTax = 0;
|
| 96 |
+
$shippingBaseTax = 0;
|
| 97 |
|
| 98 |
if ($shippingTaxClass) {
|
| 99 |
if ($rate = $taxCalculationModel->getRate($request->setProductClassId($shippingTaxClass))) {
|
| 100 |
if (!Mage::helper('tax')->shippingPriceIncludesTax()) {
|
| 101 |
+
$shippingTax = $address->getShippingAmount() * $rate / 100;
|
| 102 |
+
$shippingBaseTax = $address->getBaseShippingAmount() * $rate / 100;
|
| 103 |
} else {
|
| 104 |
+
$shippingTax = $address->getShippingTaxAmount();
|
| 105 |
+
$shippingBaseTax = $address->getBaseShippingTaxAmount();
|
| 106 |
}
|
| 107 |
|
| 108 |
+
$shippingTax = $store->roundPrice($shippingTax);
|
| 109 |
+
$shippingBaseTax = $store->roundPrice($shippingBaseTax);
|
| 110 |
|
| 111 |
$address->setTaxAmount($address->getTaxAmount() + $shippingTax);
|
| 112 |
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $shippingBaseTax);
|
| 146 |
|
| 147 |
$address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());
|
| 148 |
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());
|
| 149 |
+
|
| 150 |
return $this;
|
| 151 |
}
|
| 152 |
|
| 167 |
$row['percent'] = $row['percent'] ? $row['percent'] : 1;
|
| 168 |
$rate = $rate ? $rate : 1;
|
| 169 |
|
| 170 |
+
$appliedAmount = $amount / $rate * $row['percent'];
|
| 171 |
+
$baseAppliedAmount = $baseAmount / $rate * $row['percent'];
|
| 172 |
} else {
|
| 173 |
$appliedAmount = 0;
|
| 174 |
$baseAppliedAmount = 0;
|
| 178 |
}
|
| 179 |
}
|
| 180 |
|
|
|
|
| 181 |
if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) {
|
| 182 |
$previouslyAppliedTaxes[$row['id']]['amount'] += $appliedAmount;
|
| 183 |
$previouslyAppliedTaxes[$row['id']]['base_amount'] += $baseAppliedAmount;
|
| 194 |
$store = $address->getQuote()->getStore();
|
| 195 |
$amount = $address->getTaxAmount();
|
| 196 |
|
| 197 |
+
if (($amount != 0) || (Mage::helper('tax')->displayZeroTax($store))) {
|
| 198 |
$address->addTotal(array(
|
| 199 |
+
'code' => $this->getCode(),
|
| 200 |
+
'title' => Mage::helper('sales')->__('Tax'),
|
| 201 |
+
'full_info' => $applied ? $applied : array(),
|
| 202 |
+
'value' => $amount,
|
| 203 |
));
|
| 204 |
}
|
| 205 |
+
|
| 206 |
return $this;
|
| 207 |
}
|
| 208 |
}
|
|
|
app/code/local/Vonnda/Taxify/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Vonnda_Taxify>
|
| 5 |
-
<version>0.1.
|
| 6 |
</Vonnda_Taxify>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Vonnda_Taxify>
|
| 5 |
+
<version>0.1.6</version>
|
| 6 |
</Vonnda_Taxify>
|
| 7 |
</modules>
|
| 8 |
<global>
|
app/code/local/Vonnda/Taxify/tests/Helper/DataTest.php
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
require_once '../../app/Mage.php'; umask(0); Mage::app('default');
|
| 4 |
-
|
| 5 |
class HelperDataTest extends PHPUnit_Framework_TestCase
|
| 6 |
{
|
| 7 |
public function testAssert()
|
|
@@ -10,8 +8,12 @@ class HelperDataTest extends PHPUnit_Framework_TestCase
|
|
| 10 |
$options = $helper->getCustomerTaxabilityOptions();
|
| 11 |
$expected = array(
|
| 12 |
'' => 'Default',
|
| 13 |
-
'
|
| 14 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
);
|
| 16 |
$this->assertEquals($expected, $options);
|
| 17 |
}
|
| 1 |
<?php
|
| 2 |
|
|
|
|
|
|
|
| 3 |
class HelperDataTest extends PHPUnit_Framework_TestCase
|
| 4 |
{
|
| 5 |
public function testAssert()
|
| 8 |
$options = $helper->getCustomerTaxabilityOptions();
|
| 9 |
$expected = array(
|
| 10 |
'' => 'Default',
|
| 11 |
+
'CLOTHING' => 'Clothing',
|
| 12 |
+
'FOOD' => 'Food',
|
| 13 |
+
'FREIGHT' => 'Freight',
|
| 14 |
+
'NONTAX' => 'Nontax',
|
| 15 |
+
'TAXABLE' => 'Taxable',
|
| 16 |
+
'WINE' => 'Wine',
|
| 17 |
);
|
| 18 |
$this->assertEquals($expected, $options);
|
| 19 |
}
|
app/code/local/Vonnda/Taxify/tests/Request/CodesTest.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class CodesTest extends PHPUnit_Framework_TestCase
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function testCodesModelExists()
|
| 7 |
+
{
|
| 8 |
+
$client = Mage::getModel('taxify/request_codes');
|
| 9 |
+
$this->assertTrue(is_object($client), 'The model taxify/request_codes should exist');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function testBuildRequest()
|
| 13 |
+
{
|
| 14 |
+
$client = Mage::getModel('taxify/request_codes');
|
| 15 |
+
$expected = array('GetCodes' => array('CodeType' => 'Item'));
|
| 16 |
+
|
| 17 |
+
$client->build();
|
| 18 |
+
|
| 19 |
+
$this->assertEquals($expected, $client->request);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function testGetCodes()
|
| 23 |
+
{
|
| 24 |
+
$client = Mage::getModel('taxify/request_codes');
|
| 25 |
+
$resp = new stdClass;
|
| 26 |
+
$resp->GetCodesResult->Codes->string = array('foo', 'bar');
|
| 27 |
+
$client->response = $resp;
|
| 28 |
+
|
| 29 |
+
$client->getCodes();
|
| 30 |
+
|
| 31 |
+
$this->assertEquals(array('', 'foo', 'bar'), $client->getCodes());
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function testGetCodesWithLabels()
|
| 35 |
+
{
|
| 36 |
+
$client = Mage::getModel('taxify/request_codes');
|
| 37 |
+
$resp = new stdClass;
|
| 38 |
+
$resp->GetCodesResult->Codes->string = array('foo', 'bar');
|
| 39 |
+
$client->response = $resp;
|
| 40 |
+
$expected = array(
|
| 41 |
+
'' => 'Default',
|
| 42 |
+
'foo' => 'Foo',
|
| 43 |
+
'bar' => 'Bar'
|
| 44 |
+
);
|
| 45 |
+
|
| 46 |
+
$client->getCodesWithLabels();
|
| 47 |
+
|
| 48 |
+
$this->assertEquals($expected, $client->getCodesWithLabels());
|
| 49 |
+
|
| 50 |
+
}
|
| 51 |
+
}
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Taxify_Sales_Tax_Rates_and_Filing</name>
|
| 4 |
-
<version>0.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License V2</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Taxify ensures that your Magento store collects, reports and remits accurate sales taxes for all Federal, state, and local jurisdictions throughout the United States</description>
|
| 11 |
<notes>Initial Public Release</notes>
|
| 12 |
<authors><author><name>Vonnda Development</name><user>Vonnda</user><email>info@vonnda.com</email></author></authors>
|
| 13 |
-
<date>2015-10-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magelocal"><dir name="Vonnda"><dir name="Taxify"><dir name="Block"><dir name="Adminhtml"><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.2</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Taxify_Sales_Tax_Rates_and_Filing</name>
|
| 4 |
+
<version>0.1.6</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License V2</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Taxify ensures that your Magento store collects, reports and remits accurate sales taxes for all Federal, state, and local jurisdictions throughout the United States</description>
|
| 11 |
<notes>Initial Public Release</notes>
|
| 12 |
<authors><author><name>Vonnda Development</name><user>Vonnda</user><email>info@vonnda.com</email></author></authors>
|
| 13 |
+
<date>2015-10-20</date>
|
| 14 |
+
<time>19:45:11</time>
|
| 15 |
+
<contents><target name="magelocal"><dir name="Vonnda"><dir name="Taxify"><dir name="Block"><dir name="Adminhtml"><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="478d678795f15de170217aff34b740db"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="3c8aae17e2ea381383f156062dae7c9a"/></dir><dir name="Model"><file name="Client.php" hash="65089d31a5c2fee314d9d88266153394"/><file name="Config.php" hash="2db3425ee59a162dedf5ef8a4fa655e3"/><dir name="Export"><file name="Row.php" hash="7c1ba01053c94524fa5bca031e310747"/></dir><file name="Export.php" hash="a7c54832cb11773f1598aa3a4778a59e"/><file name="Feed.php" hash="04f391cc7357d47184c243e81d068bf7"/><file name="Observer.php" hash="52d7d7e74b2a0676b58ad4262e26fc49"/><dir name="Request"><file name="Calculate.php" hash="ae7a5c3c934f0cf8f68fd88af532131e"/><file name="Cancel.php" hash="2d1eadf52123f4db8151832502d8ba01"/><file name="Codes.php" hash="d6ab37313e7336aca6228793714284ab"/><file name="Commit.php" hash="3ec21b8860ab14f3eadc7bb9e53c02c1"/><file name="Request.php" hash="0047d6dc437b007e7923b70082aead6c"/><file name="Verifyaddress.php" hash="fff9f9d0ac574ac185916afaf7bdde0c"/><file name="Version.php" hash="ff41825cbc827abed4e0a2597e67ee67"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="326120cd05749e9b48e7dd966a3b2c19"/></dir></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Tax.php" hash="e41ac495324df63351c07f7772df7e9b"/></dir><file name=".DS_Store" hash="d6c424b95f6c304aa0e0c861c9a01073"/></dir><file name=".DS_Store" hash="e3088067e0aac643641350be6bd5da89"/></dir><file name=".DS_Store" hash="d8aa3112ea4a1c59b473e14dcddf7d1f"/></dir><file name=".DS_Store" hash="89503324a3148078dbd8a9ac140ae571"/></dir><dir name="controllers"><file name="ExportController.php" hash="b3d01205020d5cf3809bdfc5625abb72"/></dir><dir name="etc"><file name="adminhtml.xml" hash="438da0a4ed05ca800233f73fef1c65a8"/><file name="config.xml" hash="7a0c568a8bcf88e5a9b8aed8d00238b2"/><file name="system.xml" hash="f99743421bbf8bf7c4d19dca7a4b0d53"/></dir><dir name="sql"><dir name="taxify_setup"><file name="mysql4-install-0.1.1.php" hash="523629216cc236efa1e3a08dc40b9291"/></dir></dir><dir name="tests"><dir name="Helper"><file name="DataTest.php" hash="ce5a7f43c3da4f7537ce927a28c2d2e2"/></dir><dir name="Model"><dir name="Export"><file name="RowTest.php" hash="370afb16507950dcbf2ac27090c8452c"/></dir><file name="ExportTest.php" hash="04ec5d1e4a71bf840881b2cb55be5528"/></dir><dir name="Request"><file name="CalculateTest.php" hash="7bd6291be8d42329a211fd6f73161cd8"/><file name="CancelTest.php" hash="b8ba6f0004d493f72ce22c66375ffdac"/><file name="CodesTest.php" hash="c32aaa4c7ed16e0831cb0063bde2ffb0"/><file name="CommitTest.php" hash="59c4473ba919047dd821e05b335dbc38"/></dir><file name="SampleTest.php" hash="32606c8d8b84d95aec73bdeb1c03ca1e"/><dir name="fixtures"><file name="calculateMultiSimpleProductSuccess.txt" hash="6d7426310bebbcb0b758697035a4e8f7"/><file name="calculateSuccess.txt" hash="892ebdae0cd70bcf36cc34be2d21da76"/><file name="exportQueryResult.txt" hash="d07fec0de05420e89536fadb822baa84"/></dir></dir><file name=".DS_Store" hash="1f5579cf877cc451179cc658a1117441"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vonnda_Taxify.xml" hash="b3120a86b364f80ee8daf825412a1318"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="taxify"><file name="export.phtml" hash="25487d4b0664dd7cfbea135ad50bf948"/></dir></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.2</max></php></required></dependencies>
|
| 18 |
</package>
|
