TaxManager is now a service in the container.

This commit is contained in:
Franck Allimant
2014-01-22 01:18:28 +01:00
parent c9c489a76b
commit 5d92ea0bab
23 changed files with 414 additions and 152 deletions

View File

@@ -5,12 +5,23 @@ namespace Thelia\Model;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\Base\Tax as BaseTax;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\TaxEngine\TaxType\BaseTaxType;
use Thelia\TaxEngine\BaseTaxType;
class Tax extends BaseTax
{
use ModelEventDispatcherTrait;
/**
* Provides a form-and-javascript-safe version of the type, which is a fully qualified classname, with \
*/
public static function escapeTypeName($name) {
return str_replace('\\', '-', $name);
}
public static function unescapeTypeName($name) {
return str_replace('-', '\\', $name);
}
public function calculateTax($amount)
{
if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) {
@@ -39,7 +50,7 @@ class Tax extends BaseTax
public function getTypeInstance()
{
$class = '\\Thelia\\TaxEngine\\TaxType\\' . $this->getType();
$class = $this->getType();
/* test type */
if(!class_exists($class)) {