diff --git a/Plugin/Tax/Helper/Data.php b/Plugin/Tax/Helper/Data.php deleted file mode 100644 index 4dab1a67857..00000000000 --- a/Plugin/Tax/Helper/Data.php +++ /dev/null @@ -1,112 +0,0 @@ -config = $config; - $this->taxClassRepository = $taxClassRepository; - } - - /** - * This plugin aims to add the Mollie Payment Fee tax to the tax summary when generating a creditmemo. - * @see \Magento\Tax\Helper\Data::getCalculatedTaxes() - * - * @param Subject $subject - * @param array $result - * @param OrderInterface|InvoiceInterface|CreditmemoInterface $source - * @return void - * @throws NoSuchEntityException - */ - public function afterGetCalculatedTaxes(Subject $subject, array $result, $source): array - { - if (!$source instanceof CreditmemoInterface && !$source instanceof InvoiceInterface) { - return $result; - } - - $this->result = $result; - - $order = $source->getOrder(); - if (!$order->getPayment() || - strstr($order->getPayment()->getMethod(), 'mollie_methods_') === false - ) { - return $result; - } - - $amount = $order->getMolliePaymentFee(); - $taxAmount = $order->getMolliePaymentFeeTax(); - $baseTaxAmount = $order->getMolliePaymentFee(); - - $rate = 0; - if ((float)$order->getMolliePaymentFeeTax()) { - $rate = round(($taxAmount / $amount) * 100); - } - - $taxClassId = $this->config->paymentSurchargeTaxClass( - $order->getPayment()->getMethod(), - $order->getStoreId() - ); - - $taxClass = $this->taxClassRepository->get($taxClassId); - $name = $taxClass->getClassName(); - - $this->mergeResult([ - 'title' => $name, - 'percent' => $rate, - 'tax_amount' => $taxAmount, - 'base_tax_amount' => $baseTaxAmount, - ]); - - return $this->result; - } - - private function mergeResult(array $taxClass): void - { - $existing = array_search($taxClass['title'], array_column($this->result, 'title')); - - if ($existing === false) { - $this->result[] = [ - 'title' => $taxClass['title'], - 'percent' => $taxClass['percent'], - 'tax_amount' => $taxClass['tax_amount'], - 'base_tax_amount' => $taxClass['base_tax_amount'], - ]; - - return; - } - - $this->result[$existing]['tax_amount'] += $taxClass['tax_amount']; - $this->result[$existing]['base_tax_amount'] += $taxClass['base_tax_amount']; - } -} diff --git a/composer.json b/composer.json index 17cbd0e3ad2..086128c0ee2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mollie/magento2", "description": "Mollie Payment Module for Magento 2", - "version": "2.32.1", + "version": "2.32.2", "keywords": [ "mollie", "payment", diff --git a/etc/config.xml b/etc/config.xml index d08d74ed199..753a4a59a11 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -3,7 +3,7 @@ - v2.32.1 + v2.32.2 0 0 test diff --git a/etc/di.xml b/etc/di.xml index 2bc95357b80..cbaa6870e46 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -355,10 +355,6 @@ - - - -