Commit ab43ea92 authored by bojanz's avatar bojanz

Issue #3093784 followup: Use the calculation date in TaxOrderProcessor (did I...

Issue #3093784 followup: Use the calculation date in TaxOrderProcessor (did I finally get them all?).
parent 72e56a8e
...@@ -90,6 +90,7 @@ class TaxOrderProcessor implements OrderProcessorInterface { ...@@ -90,6 +90,7 @@ class TaxOrderProcessor implements OrderProcessorInterface {
// when selling to customers outside the EU, but only if no other tax // when selling to customers outside the EU, but only if no other tax
// was applied (e.g. a Japanese customer paying Japanese tax due to the // was applied (e.g. a Japanese customer paying Japanese tax due to the
// store being registered to collect tax there). // store being registered to collect tax there).
$calculation_date = $order->getCalculationDate();
$store = $order->getStore(); $store = $order->getStore();
if ($store->get('prices_include_tax')->value) { if ($store->get('prices_include_tax')->value) {
foreach ($order->getItems() as $order_item) { foreach ($order->getItems() as $order_item) {
...@@ -101,7 +102,7 @@ class TaxOrderProcessor implements OrderProcessorInterface { ...@@ -101,7 +102,7 @@ class TaxOrderProcessor implements OrderProcessorInterface {
$unit_price = $order_item->getUnitPrice(); $unit_price = $order_item->getUnitPrice();
$rates = $this->getDefaultRates($order_item, $store); $rates = $this->getDefaultRates($order_item, $store);
foreach ($rates as $rate) { foreach ($rates as $rate) {
$percentage = $rate->getPercentage(); $percentage = $rate->getPercentage($calculation_date);
$tax_amount = $percentage->calculateTaxAmount($order_item->getUnitPrice(), TRUE); $tax_amount = $percentage->calculateTaxAmount($order_item->getUnitPrice(), TRUE);
$tax_amount = $this->rounder->round($tax_amount); $tax_amount = $this->rounder->round($tax_amount);
$unit_price = $unit_price->subtract($tax_amount); $unit_price = $unit_price->subtract($tax_amount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment