Rajout de la gestion du détail de TVA sur les frais de port Colissimo
This commit is contained in:
@@ -27,10 +27,13 @@ use Thelia\Model\Message;
|
|||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
use Thelia\Model\ModuleQuery;
|
use Thelia\Model\ModuleQuery;
|
||||||
use Thelia\Model\Order;
|
use Thelia\Model\Order;
|
||||||
|
use Thelia\Model\OrderPostage;
|
||||||
|
use Thelia\Model\TaxRuleQuery;
|
||||||
use Thelia\Module\AbstractDeliveryModule;
|
use Thelia\Module\AbstractDeliveryModule;
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
use Thelia\Module\DeliveryModuleInterface;
|
use Thelia\Module\DeliveryModuleInterface;
|
||||||
use Thelia\Module\Exception\DeliveryException;
|
use Thelia\Module\Exception\DeliveryException;
|
||||||
|
use Thelia\TaxEngine\Calculator;
|
||||||
|
|
||||||
class ColissimoWs extends AbstractDeliveryModule
|
class ColissimoWs extends AbstractDeliveryModule
|
||||||
{
|
{
|
||||||
@@ -242,6 +245,21 @@ class ColissimoWs extends AbstractDeliveryModule
|
|||||||
if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) {
|
if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) {
|
||||||
throw new DeliveryException("Colissimo delivery unavailable for your cart weight or delivery country");
|
throw new DeliveryException("Colissimo delivery unavailable for your cart weight or delivery country");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TheCoreDev le 9/12/2020 : Tout ceci pour gérer l'affichage dans la facture de la TVA sur les frais de port Colissimo */
|
||||||
|
$orderPostage = new OrderPostage();
|
||||||
|
$taxRule = TaxRuleQuery::create()->findOneByIsDefault(true);
|
||||||
|
$tax = (new Calculator())
|
||||||
|
->loadTaxRuleWithoutProduct($taxRule, $country)
|
||||||
|
->getTaxAmountFromTaxedPrice($postage);
|
||||||
|
|
||||||
|
$orderPostage->setAmount($postage);
|
||||||
|
$orderPostage->setAmountTax($tax);
|
||||||
|
$orderPostage->setTaxRuleTitle(
|
||||||
|
$taxRule->setLocale($this->getRequest()->getSession()->getLang()->getLocale())->getTitle()
|
||||||
|
);
|
||||||
|
|
||||||
|
return $orderPostage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $postage;
|
return $postage;
|
||||||
|
|||||||
Reference in New Issue
Block a user