From 81f8f81f48bb2726be07ff75cd1b7871b08cf66b Mon Sep 17 00:00:00 2001 From: Steffen Sandgren Petersen Date: Mon, 10 Mar 2025 15:25:01 +0100 Subject: [PATCH 1/3] Update README.md --- README.md | 76 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c3ee9c2..e511a59 100644 --- a/README.md +++ b/README.md @@ -3,30 +3,53 @@ [![PHP 8.1](https://img.shields.io/badge/php-8.1-blue.svg)](http://www.php.net) [![PHP 8.2](https://img.shields.io/badge/php-8.2-blue.svg)](http://www.php.net) -![Logo](unzer_logo.svg) +# Unzer Payment plugin for Magento 2 -# Payment extension for Magento2 and Unzer Payment API (PAPI) +Use Unzer Payment plugin for Magento 2 to provide an easy-to-install payment gateway integration for all your online payments. -This extension for Magento2 provides a direct integration of the Unzer payment methods to your Magento2 shop. +## Description -Currently supported payment methods are: -* Cards (Credit Card / Debit Card) +Accept payments with cards, bank transfers, wallets, and other global and local payment methods. Unzer Payment plugin helps you with quick and easy integration, full support, and flexible solutions that grow with your business. We are your payment partner for every situation. + +## Features + +* Seamless integration into the Shop-system +* Merchant-friendly order management with up-to-date payment details, real-time billing and refunds made easy. +* Payment processing via the Unzer Payment API +* 3D-Secure authentication +* PCI-DSS Level 1 certified + +## Content security policy (CSP) + +If you are using a Content Security Policy (CSP) you must include different Unzer URL's to your policy, which are required by the UI components to work. For more information, please go to [Unzer Documentation CSP Information](https://docs.unzer.com/online-payments/ui-component-v2/#content-security-policy-csp). + +## Supported payment methods + +Unzer payment plugin includes the following payment methods: +* Alipay +* Apple Pay +* Bancontact +* Credit Card +* Unzer Direct Bank Transfer * EPS -* Giropay +* Google Pay * iDEAL * PayPal -* Sofort -* Unzer (SEPA) Direct Debit -* Unzer (SEPA) Direct Debit secured B2C -* Unzer Bank Transfer -* Unzer Invoice -* Unzer Invoice secured B2B -* Unzer Invoice secured B2C -* Unzer Prepayment -* Bancontact -* Przelewy -* Alipay -* Wechat +* Prepayment +* SEPA Direct Debit +* SOFORT +* TWINT +* Unzer Direct Debit +* Unzer direct Debit (secured) +* Unzer Invoice B2C / B2B (secured) +* Unzer Installment (secured) +* WeChat Pay + +Regarding plugin compatibility, please take a look at the release notes for more information. + +## Installation + +Please see our documentation for [how to install the plugin](https://docs.unzer.com/plugins/magento-2/magento2-install-plugin/). ## SYSTEM REQUIREMENTS This extension requires PHP 7.4, PHP 8.1 or PHP 8.2. @@ -50,20 +73,17 @@ See the License for the specific language governing permissions and limitations under the License. ## User Guide -Please find information on installation, configuration and usage within the [manual](https://docs.unzer.com/plugins/magento-2). + +Please find information on installation, configuration, usage etc on our [documentation pages](https://docs.unzer.com/plugins/magento-2). ## Support + For any issues or questions please get in touch with our support. -#### Web pages -* https://unzer.com/ -* https://docs.unzer.com/ +**Email**: support@unzer.com -#### Email -support@unzer.com +**Phone**: +49 (0)6221/6471-100 -#### Phone -+49 (0)6221/6471-100 +**Twitter**: [@UnzerTech](https://twitter.com/UnzerTech) -#### Twitter -[@UnzerTech](https://twitter.com/UnzerTech) +**Webpage**: https://unzer.com/ From 5ba56c11043e4e9a85eba72c96d8b27770e2f35c Mon Sep 17 00:00:00 2001 From: Boljanovic Date: Tue, 15 Apr 2025 14:05:46 +0200 Subject: [PATCH 2/3] Fix the issue with discount amount when taxes are enabled ISSUE: MAGENTO-105 --- Helper/Order.php | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/Helper/Order.php b/Helper/Order.php index 02493f8..955c69b 100644 --- a/Helper/Order.php +++ b/Helper/Order.php @@ -3,6 +3,7 @@ namespace Unzer\PAPI\Helper; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ProductMetadataInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Module\ModuleListInterface; @@ -12,6 +13,8 @@ use Magento\Sales\Api\Data\OrderAddressInterface; use Magento\Sales\Model\Order as OrderModel; use Magento\Sales\Model\Order\Item; +use Magento\Store\Model\ScopeInterface; +use Magento\Tax\Model\Config as MagentoTaxConfig; use Unzer\PAPI\Block\System\Config\Form\Field\BirthDateFactory; use Unzer\PAPI\Model\Config; use Unzer\PAPI\Model\Source\CreateThreatMetrixId; @@ -54,6 +57,11 @@ class Order */ private ProductMetadataInterface $_productMetadata; + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @var BasketFactory */ @@ -80,6 +88,7 @@ class Order * @param Config $moduleConfig * @param ModuleListInterface $moduleList * @param ProductMetadataInterface $productMetadata + * @param ScopeConfigInterface $scopeConfig * @param BasketFactory $basketFactory * @param BasketItemFactory $basketItemFactory * @param BirthDateFactory $birthDateFactory @@ -89,6 +98,7 @@ public function __construct( Config $moduleConfig, ModuleListInterface $moduleList, ProductMetadataInterface $productMetadata, + ScopeConfigInterface $scopeConfig, BasketFactory $basketFactory, BasketItemFactory $basketItemFactory, BirthDateFactory $birthDateFactory, @@ -97,6 +107,7 @@ public function __construct( $this->_moduleConfig = $moduleConfig; $this->_moduleList = $moduleList; $this->_productMetadata = $productMetadata; + $this->scopeConfig = $scopeConfig; $this->basketFactory = $basketFactory; $this->basketItemFactory = $basketItemFactory; $this->birthDateFactory = $birthDateFactory; @@ -113,6 +124,7 @@ public function __construct( public function createBasketForOrder(OrderModel $order): Basket { $basket = $this->createBasket($order); + $vatRate = 0; if ($order->getShippingAmount() > 0) { $basket->addBasketItem( @@ -132,11 +144,15 @@ public function createBasketForOrder(OrderModel $order): Basket $basket->addBasketItem( $this->createBasketItem($orderItem) ); + + if($orderItem->getTaxPercent() !== null){ + $vatRate = (float)$orderItem->getTaxPercent(); + } } if (abs($order->getBaseDiscountAmount()) > 0) { $basket->addBasketItem( - $this->createVoucherItem($order) + $this->createVoucherItem($order, $vatRate) ); } @@ -198,12 +214,36 @@ protected function createBasketItem(Item $orderItem): BasketItem * Create Voucher Item * * @param OrderModel $order + * @param float $vatRate * @return BasketItem */ - protected function createVoucherItem(OrderModel $order): BasketItem + protected function createVoucherItem(OrderModel $order, float $vatRate): BasketItem { + $discount = $order->getBaseDiscountAmount(); + $storeId = $order->getStoreId(); + + $taxAfterDiscount = $this->scopeConfig->getValue( + MagentoTaxConfig::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, + ScopeInterface::SCOPE_STORE, + $storeId + ); + + $pricesIncludeTax = $this->scopeConfig->getValue( + MagentoTaxConfig::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + ScopeInterface::SCOPE_STORE, + $storeId + ); + + if ($taxAfterDiscount && !$pricesIncludeTax) { + $discount *= (1 + $vatRate/100); + } + $basketVoucherItemDiscountAmount = $this->basketItemFactory->create(); - $basketVoucherItemDiscountAmount->setAmountDiscountPerUnitGross(abs($order->getBaseDiscountAmount())); + $basketVoucherItemDiscountAmount->setAmountDiscountPerUnitGross( + abs(round($discount, 2, PHP_ROUND_HALF_DOWN) + ) + ); + $basketVoucherItemDiscountAmount->setVat($vatRate); $basketVoucherItemDiscountAmount->setAmountPerUnitGross(0); $basketVoucherItemDiscountAmount->setQuantity(1); $basketVoucherItemDiscountAmount->setTitle('Discount'); From 95604f35547c005032ac105ed5c0878c38074edf Mon Sep 17 00:00:00 2001 From: Boljanovic Date: Tue, 15 Apr 2025 14:14:48 +0200 Subject: [PATCH 3/3] [Release 3.2.6 - 2025-04-15] --- CHANGELOG.md | 4 ++++ composer.json | 2 +- etc/module.xml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9700573..345a8cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.2.6](https://github.com/unzerdev/magento2/compare/3.2.5..3.2.6) +### Fixed +* Discount amount when taxes are applied + ## [3.2.5](https://github.com/unzerdev/magento2/compare/3.2.4..3.2.5) ### Added * Direct Bank Transfer diff --git a/composer.json b/composer.json index 70be33e..63c46c5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "unzerdev/magento2", "description": "This extension for Magento 2 provides a direct integration of the Unzer payment types to your Magento 2 shop via the Unzer Payment API (PAPI).", "type": "magento2-module", - "version": "3.2.5", + "version": "3.2.6", "license": "Apache-2.0", "require": { "php": "~7.4.0|~8.1.0|~8.2.0|~8.3.0", diff --git a/etc/module.xml b/etc/module.xml index f7ad1ca..f717fe6 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - +