Rajout de la gestion du détail de TVA sur les frais de port Colissimo

This commit is contained in:
2020-12-09 15:43:03 +01:00
parent 5bffee869e
commit ef6c73c655

View File

@@ -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;