Rajout du dossier core + MAJ .gitignore
This commit is contained in:
38
core/lib/Thelia/Model/TaxRule.php
Normal file
38
core/lib/Thelia/Model/TaxRule.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\TaxRule as BaseTaxRule;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
use Thelia\TaxEngine\OrderProductTaxCollection;
|
||||
|
||||
class TaxRule extends BaseTaxRule
|
||||
{
|
||||
use ModelEventDispatcherTrait;
|
||||
|
||||
/**
|
||||
* @param Product $product
|
||||
* @param Country $country
|
||||
* @param $untaxedAmount
|
||||
* @param $untaxedPromoAmount
|
||||
* @param null $askedLocale
|
||||
*
|
||||
* @return OrderProductTaxCollection
|
||||
*/
|
||||
public function getTaxDetail(Product $product, Country $country, $untaxedAmount, $untaxedPromoAmount, $askedLocale = null)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
|
||||
$taxCollection = new OrderProductTaxCollection();
|
||||
$taxCalculator->loadTaxRule($this, $country, $product)->getTaxedPrice($untaxedAmount, $taxCollection, $askedLocale);
|
||||
$promoTaxCollection = new OrderProductTaxCollection();
|
||||
$taxCalculator->loadTaxRule($this, $country, $product)->getTaxedPrice($untaxedPromoAmount, $promoTaxCollection, $askedLocale);
|
||||
|
||||
foreach ($taxCollection as $index => $tax) {
|
||||
$tax->setPromoAmount($promoTaxCollection->getKey($index)->getAmount());
|
||||
}
|
||||
|
||||
return $taxCollection;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user