diff --git a/local/modules/ColissimoWs/ColissimoWs.php b/local/modules/ColissimoWs/ColissimoWs.php index 9b81e2f7..eb5778ad 100644 --- a/local/modules/ColissimoWs/ColissimoWs.php +++ b/local/modules/ColissimoWs/ColissimoWs.php @@ -27,10 +27,13 @@ use Thelia\Model\Message; use Thelia\Model\MessageQuery; use Thelia\Model\ModuleQuery; use Thelia\Model\Order; +use Thelia\Model\OrderPostage; +use Thelia\Model\TaxRuleQuery; use Thelia\Module\AbstractDeliveryModule; use Thelia\Module\BaseModule; use Thelia\Module\DeliveryModuleInterface; use Thelia\Module\Exception\DeliveryException; +use Thelia\TaxEngine\Calculator; class ColissimoWs extends AbstractDeliveryModule { @@ -242,6 +245,21 @@ class ColissimoWs extends AbstractDeliveryModule if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) { 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;