From ba70e70d66f7db539634178f399abafe1c15ad3a Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 20 Nov 2023 11:58:20 +0100 Subject: [PATCH 1/5] Bugfix: Use the correct method code when using payment link #718 --- Helper/General.php | 74 +++---------------- Model/Client/Orders.php | 46 +++--------- Model/Client/Payments.php | 34 +++------ Service/Order/MethodCode.php | 43 +++++++++++ .../Service/Order/MethodCodeTest.php | 74 +++++++++++++++++++ 5 files changed, 144 insertions(+), 127 deletions(-) create mode 100644 Service/Order/MethodCode.php create mode 100644 Test/Integration/Service/Order/MethodCodeTest.php diff --git a/Helper/General.php b/Helper/General.php index 36683d2556e..faf42696d71 100755 --- a/Helper/General.php +++ b/Helper/General.php @@ -9,12 +9,9 @@ use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Framework\App\ProductMetadataInterface; -use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Locale\Resolver; -use Magento\Framework\Math\Random as MathRandom; use Magento\Framework\Module\ModuleListInterface; use Magento\Sales\Api\Data\OrderInterface; -use Magento\Sales\Api\OrderManagementInterface; use Magento\Sales\Model\Order; use Magento\Sales\Model\OrderRepository; use Magento\Store\Model\StoreManagerInterface; @@ -25,9 +22,8 @@ use Mollie\Payment\Logger\MollieLogger; use Magento\SalesRule\Model\Coupon; use Magento\SalesRule\Model\ResourceModel\Coupon\Usage as CouponUsage; -use Mollie\Payment\Service\Mollie\TransactionDescription; use Mollie\Payment\Service\Order\CancelOrder; -use Mollie\Payment\Service\Order\OrderCommentHistory; +use Mollie\Payment\Service\Order\MethodCode; use Mollie\Payment\Service\Order\Transaction; use Mollie\Payment\Service\Order\Uncancel; @@ -129,10 +125,6 @@ class General extends AbstractHelper * @var OrderRepository */ private $orderRepository; - /** - * @var MathRandom - */ - private $mathRandom; /** * @var Coupon */ @@ -141,14 +133,6 @@ class General extends AbstractHelper * @var CouponUsage */ private $couponUsage; - /** - * @var OrderCommentHistory - */ - private $orderCommentHistory; - /** - * @var OrderManagementInterface - */ - private $orderManagement; /** * @var Config */ @@ -162,45 +146,16 @@ class General extends AbstractHelper */ private $uncancel; - /** - * @var TransactionDescription - */ - private $transactionDescription; - /** * @var CancelOrder */ private $cancelOrder; /** - * @var EncryptorInterface + * @var MethodCode */ - private $encryptor; + private $methodCode; - /** - * General constructor. - * - * @param Context $context - * @param PaymentHelper $paymentHelper - * @param OrderRepository $orderRepository - * @param StoreManagerInterface $storeManager - * @param ResourceConfig $resourceConfig - * @param ModuleListInterface $moduleList - * @param ProductMetadataInterface $metadata - * @param Resolver $resolver - * @param MathRandom $mathRandom - * @param MollieLogger $logger - * @param Coupon $coupon - * @param CouponUsage $couponUsage - * @param OrderCommentHistory $orderCommentHistory - * @param OrderManagementInterface $orderManagement - * @param Config $config - * @param Transaction $transaction - * @param Uncancel $uncancel - * @param TransactionDescription $transactionDescription - * @param CancelOrder $cancelOrder - * @param EncryptorInterface $encryptor - */ public function __construct( Context $context, PaymentHelper $paymentHelper, @@ -210,18 +165,14 @@ public function __construct( ModuleListInterface $moduleList, ProductMetadataInterface $metadata, Resolver $resolver, - MathRandom $mathRandom, MollieLogger $logger, Coupon $coupon, CouponUsage $couponUsage, - OrderCommentHistory $orderCommentHistory, - OrderManagementInterface $orderManagement, Config $config, Transaction $transaction, Uncancel $uncancel, - TransactionDescription $transactionDescription, CancelOrder $cancelOrder, - EncryptorInterface $encryptor + MethodCode $methodCode ) { $this->paymentHelper = $paymentHelper; $this->storeManager = $storeManager; @@ -229,20 +180,16 @@ public function __construct( $this->orderRepository = $orderRepository; $this->urlBuilder = $context->getUrlBuilder(); $this->moduleList = $moduleList; - $this->mathRandom = $mathRandom; $this->metadata = $metadata; $this->resolver = $resolver; $this->logger = $logger; $this->coupon = $coupon; $this->couponUsage = $couponUsage; - $this->orderCommentHistory = $orderCommentHistory; - $this->orderManagement = $orderManagement; $this->config = $config; $this->transaction = $transaction; $this->uncancel = $uncancel; - $this->transactionDescription = $transactionDescription; $this->cancelOrder = $cancelOrder; - $this->encryptor = $encryptor; + $this->methodCode = $methodCode; parent::__construct($context); } @@ -418,16 +365,13 @@ public function disableExtension() * @param OrderInterface $order * * @return string + * + * @deprecated since v2.33.0 + * @see \Mollie\Payment\Service\Order\MethodCode */ public function getMethodCode($order): string { - $method = $order->getPayment()->getMethodInstance()->getCode(); - - if ($method == 'mollie_methods_paymentlink' || strstr($method, 'mollie_methods') === false) { - return ''; - } - - return str_replace('mollie_methods_', '', $method); + return $this->methodCode->execute($order); } /*** diff --git a/Model/Client/Orders.php b/Model/Client/Orders.php index fe796344c80..bdcf8d67fbe 100644 --- a/Model/Client/Orders.php +++ b/Model/Client/Orders.php @@ -36,11 +36,11 @@ use Mollie\Payment\Service\Order\BuildTransaction; use Mollie\Payment\Service\Order\Invoice\ShouldEmailInvoice; use Mollie\Payment\Service\Order\Lines\StoreCredit; +use Mollie\Payment\Service\Order\MethodCode; use Mollie\Payment\Service\Order\OrderCommentHistory; use Mollie\Payment\Service\Order\PartialInvoice; use Mollie\Payment\Service\Order\ProcessAdjustmentFee; use Mollie\Payment\Service\Order\Transaction; -use Mollie\Payment\Service\OrderLockService; use Mollie\Payment\Service\PaymentToken\PaymentTokenForOrder; /** @@ -148,43 +148,15 @@ class Orders extends AbstractModel */ private $linkTransactionToOrder; - /** - * @var OrderLockService - */ - private $orderLockService; /** * @var ShouldEmailInvoice */ private $shouldEmailInvoice; - /** - * Orders constructor. - * - * @param OrderLines $orderLines - * @param InvoiceSender $invoiceSender - * @param OrderRepository $orderRepository - * @param CheckoutSession $checkoutSession - * @param ManagerInterface $messageManager - * @param Registry $registry - * @param MollieHelper $mollieHelper - * @param ProcessAdjustmentFee $adjustmentFee - * @param OrderCommentHistory $orderCommentHistory - * @param PartialInvoice $partialInvoice - * @param StoreCredit $storeCredit - * @param RefundUsingPayment $refundUsingPayment - * @param Expires $expires - * @param State $orderState - * @param Transaction $transaction - * @param BuildTransaction $buildTransaction - * @param PaymentTokenForOrder $paymentTokenForOrder - * @param ProcessTransaction $processTransaction - * @param \Mollie\Payment\Service\Mollie\MollieApiClient $mollieApiClient - * @param Config $config - * @param EventManager $eventManager - * @param LinkTransactionToOrder $linkTransactionToOrder - * @param OrderLockService $orderLockService - * @param ShouldEmailInvoice $shouldEmailInvoice + * @var MethodCode */ + private $methodCode; + public function __construct( OrderLines $orderLines, InvoiceSender $invoiceSender, @@ -208,8 +180,8 @@ public function __construct( Config $config, EventManager $eventManager, LinkTransactionToOrder $linkTransactionToOrder, - OrderLockService $orderLockService, - ShouldEmailInvoice $shouldEmailInvoice + ShouldEmailInvoice $shouldEmailInvoice, + MethodCode $methodCode ) { $this->orderLines = $orderLines; $this->invoiceSender = $invoiceSender; @@ -233,8 +205,8 @@ public function __construct( $this->mollieApiClient = $mollieApiClient; $this->config = $config; $this->linkTransactionToOrder = $linkTransactionToOrder; - $this->orderLockService = $orderLockService; $this->shouldEmailInvoice = $shouldEmailInvoice; + $this->methodCode = $methodCode; } /** @@ -258,7 +230,7 @@ public function startTransaction(OrderInterface $order, $mollieApi) } $paymentToken = $this->paymentTokenForOrder->execute($order); - $method = $this->mollieHelper->getMethodCode($order); + $method = $this->methodCode->execute($order); $method = str_replace('_vault', '', $method); $orderData = [ 'amount' => $this->mollieHelper->getOrderAmountByOrder($order), @@ -673,7 +645,7 @@ public function createOrderRefund(Order\Creditmemo $creditmemo, Order $order) return $this; } - $methodCode = $this->mollieHelper->getMethodCode($order); + $methodCode = $this->methodCode->execute($order); $methods = ['klarna', 'klarnapaylater', 'klarnasliceit', 'klarnapaynow']; if (!$order->hasShipments() && (in_array($methodCode, $methods))) { $msg = __('Order can only be refunded after Klarna has been captured (after shipment)'); diff --git a/Model/Client/Payments.php b/Model/Client/Payments.php index 80f5a4fecd7..6cb8d125de4 100644 --- a/Model/Client/Payments.php +++ b/Model/Client/Payments.php @@ -24,6 +24,7 @@ use Mollie\Payment\Service\Mollie\TransactionDescription; use Mollie\Payment\Service\Mollie\ValidateMetadata; use Mollie\Payment\Service\Order\BuildTransaction; +use Mollie\Payment\Service\Order\MethodCode; use Mollie\Payment\Service\Order\OrderAmount; use Mollie\Payment\Service\Order\CancelOrder; use Mollie\Payment\Service\Order\OrderCommentHistory; @@ -137,31 +138,11 @@ class Payments extends AbstractModel * @var CanRegisterCaptureNotification */ private $canRegisterCaptureNotification; - /** - * Payments constructor. - * - * @param OrderRepository $orderRepository - * @param CheckoutSession $checkoutSession - * @param MollieHelper $mollieHelper - * @param OrderCommentHistory $orderCommentHistory - * @param BuildTransaction $buildTransaction - * @param DashboardUrl $dashboardUrl - * @param Transaction $transaction - * @param TransactionProcessor $transactionProcessor - * @param OrderAmount $orderAmount - * @param TransactionDescription $transactionDescription - * @param CancelOrder $cancelOrder - * @param PaymentTokenForOrder $paymentTokenForOrder - * @param SendOrderEmails $sendOrderEmails - * @param EventManager $eventManager - * @param LinkTransactionToOrder $linkTransactionToOrder - * @param ProcessTransaction $processTransaction - * @param ValidateMetadata $validateMetadata - * @param SaveAdditionalInformationDetails $saveAdditionalInformationDetails - * @param ExpiredOrderToTransaction $expiredOrderToTransaction - * @param CanRegisterCaptureNotification $canRegisterCaptureNotification + * @var MethodCode */ + private $methodCode; + public function __construct( OrderRepository $orderRepository, CheckoutSession $checkoutSession, @@ -182,7 +163,8 @@ public function __construct( ValidateMetadata $validateMetadata, SaveAdditionalInformationDetails $saveAdditionalInformationDetails, ExpiredOrderToTransaction $expiredOrderToTransaction, - CanRegisterCaptureNotification $canRegisterCaptureNotification + CanRegisterCaptureNotification $canRegisterCaptureNotification, + MethodCode $methodCode ) { $this->orderRepository = $orderRepository; $this->checkoutSession = $checkoutSession; @@ -204,6 +186,7 @@ public function __construct( $this->saveAdditionalInformationDetails = $saveAdditionalInformationDetails; $this->expiredOrderToTransaction = $expiredOrderToTransaction; $this->canRegisterCaptureNotification = $canRegisterCaptureNotification; + $this->methodCode = $methodCode; } /** @@ -225,7 +208,8 @@ public function startTransaction(OrderInterface $order, $mollieApi) } $paymentToken = $this->paymentTokenForOrder->execute($order); - $method = $this->mollieHelper->getMethodCode($order); + $method = $this->methodCode->execute($order); + $paymentData = [ 'amount' => $this->mollieHelper->getOrderAmountByOrder($order), 'description' => $this->transactionDescription->forRegularTransaction($order), diff --git a/Service/Order/MethodCode.php b/Service/Order/MethodCode.php new file mode 100644 index 00000000000..10b2b0b089f --- /dev/null +++ b/Service/Order/MethodCode.php @@ -0,0 +1,43 @@ +getPayment()->getMethodInstance()->getCode(); + + if ($method == 'mollie_methods_paymentlink') { + return $this->paymentLinkMethod($order); + } + + if ($method == 'mollie_methods_paymentlink' || strstr($method, 'mollie_methods') === false) { + return ''; + } + + return str_replace('mollie_methods_', '', $method); + } + + private function paymentLinkMethod(OrderInterface $order): string + { + $additionalInformation = $order->getPayment()->getAdditionalInformation(); + if (!$additionalInformation || !array_key_exists('limited_methods', $additionalInformation)) { + return ''; + } + + if (count($additionalInformation['limited_methods']) !== 1) { + return ''; + } + + return str_replace('mollie_methods_', '', $additionalInformation['limited_methods'][0]); + } +} diff --git a/Test/Integration/Service/Order/MethodCodeTest.php b/Test/Integration/Service/Order/MethodCodeTest.php new file mode 100644 index 00000000000..be04f8de50a --- /dev/null +++ b/Test/Integration/Service/Order/MethodCodeTest.php @@ -0,0 +1,74 @@ +loadOrderById('100000001'); + $order->getPayment()->setMethod('mollie_methods_ideal'); + + $instance = $this->objectManager->create(MethodCode::class); + + $result = $instance->execute($order); + + $this->assertEquals('ideal', $result); + } + + public function testReturnsNothingWhenItsNotAMollieMethod(): void + { + $order = $this->loadOrderById('100000001'); + $order->getPayment()->setMethod('wrong_method'); + + $instance = $this->objectManager->create(MethodCode::class); + + $result = $instance->execute($order); + + $this->assertEquals('', $result); + } + + public function testReturnsNothingWhenPaymentLinkHasMultipleMethods(): void + { + $order = $this->loadOrderById('100000001'); + $order->getPayment()->setMethod('mollie_methods_paymentlink'); + $order->getPayment()->setAdditionalInformation( + 'limited_methods', + ['mollie_methods_ideal', 'mollie_methods_eps'] + ); + + $instance = $this->objectManager->create(MethodCode::class); + + $result = $instance->execute($order); + + $this->assertEquals('', $result); + } + + public function testReturnsPaymentLinkReturnsTheSingleLimitedMethod(): void + { + $order = $this->loadOrderById('100000001'); + $order->getPayment()->setMethod('mollie_methods_paymentlink'); + $order->getPayment()->setAdditionalInformation( + 'limited_methods', + ['mollie_methods_ideal'] + ); + + $instance = $this->objectManager->create(MethodCode::class); + + $result = $instance->execute($order); + + $this->assertEquals('ideal', $result); + } +} From a0d9426479ae032c83298b64e4432d1b3b70185b Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 20 Nov 2023 10:48:16 +0100 Subject: [PATCH 2/5] Feature: End-2-End rest tests --- .github/workflows/end-2-end-test.yml | 5 +- .../graphql-place-order.cy.js} | 4 +- .../e2e/magento/api/rest-place-order.cy.js | 49 + .../cypress/fixtures/mollie-pwa-graphql.html | 834 ++++++++++++++++++ .../cypress/fixtures/mollie-pwa-rest.html | 537 +++++++++++ 5 files changed, 1425 insertions(+), 4 deletions(-) rename Test/End-2-end/cypress/e2e/magento/{graphql/place-order.cy.js => api/graphql-place-order.cy.js} (92%) create mode 100644 Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js create mode 100644 Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html create mode 100644 Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html diff --git a/.github/workflows/end-2-end-test.yml b/.github/workflows/end-2-end-test.yml index 14ff4a960e1..c6b6e5773b0 100644 --- a/.github/workflows/end-2-end-test.yml +++ b/.github/workflows/end-2-end-test.yml @@ -76,12 +76,13 @@ jobs: MAGENTO_URL=$(docker exec magento-project-community-edition /bin/bash -c "curl -s ngrok:4040/api/tunnels |jq -r \".tunnels[0].public_url\"") echo "magento_url=$MAGENTO_URL" >> $GITHUB_ENV - # Note the `mollie-pwa.html` file, as it is copied to the pub folder. This is so that it can be accessed by Cypress. + # Note the `mollie-pwa-*.html` files, as it is copied to the pub folder. This is so that it can be accessed by Cypress. - name: Upload the code into the docker container run: | sed -i '/version/d' ./composer.json && \ docker cp $(pwd) magento-project-community-edition:/data/extensions/ && \ - docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa.html magento-project-community-edition:/data/pub/opt/ && \ + docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html magento-project-community-edition:/data/pub/opt/ && \ + docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html magento-project-community-edition:/data/pub/opt/ && \ docker exec magento-project-community-edition ./install-composer-package mollie/magento2:@dev - name: Activate the extension diff --git a/Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js b/Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js similarity index 92% rename from Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js rename to Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js index b4251d1c255..b9f88195d70 100644 --- a/Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js +++ b/Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js @@ -13,9 +13,9 @@ const mollieHostedPaymentPage = new MollieHostedPaymentPage(); const checkoutSuccessPage = new CheckoutSuccessPage(); const ordersPage = new OrdersPage(); -describe('Check that the headless endpoints work as expected', () => { +describe('Check that the headless GraphQL endpoints work as expected', () => { it('C1835263: Validate that an order can be placed through GraphQL ', () => { - cy.visit('opt/mollie-pwa.html'); + cy.visit('opt/mollie-pwa-graphql.html'); cy.get('[data-key="start-checkout-process"]').click(); diff --git a/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js b/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js new file mode 100644 index 00000000000..71328dbebcf --- /dev/null +++ b/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js @@ -0,0 +1,49 @@ +/* + * Copyright Magmodules.eu. All rights reserved. + * See COPYING.txt for license details. + */ + +import Cookies from "Services/Cookies"; +import MollieHostedPaymentPage from "Pages/mollie/MollieHostedPaymentPage"; +import CheckoutSuccessPage from "Pages/frontend/CheckoutSuccessPage"; +import OrdersPage from "Pages/backend/OrdersPage"; + +const cookies = new Cookies(); +const mollieHostedPaymentPage = new MollieHostedPaymentPage(); +const checkoutSuccessPage = new CheckoutSuccessPage(); +const ordersPage = new OrdersPage(); + +describe('Check that the headless REST endpoints work as expected', () => { + it('C1988313: Validate that an order can be placed through REST', () => { + cy.visit('opt/mollie-pwa-rest.html'); + + cy.get('[data-key="start-checkout-process"]').click(); + + cy.get('[data-key="mollie_methods_ideal"]').click(); + + cy.get('[data-key="place-order-action"]').click(); + + cy.get('[data-key="order-id"]').then((element) => { + cy.wrap(element.text()).as('order-id'); + }); + + cookies.disableSameSiteCookieRestrictions(); + + cy.get('[data-key="redirect-url"]').then((element) => { + cy.visit(element.attr('href')); + }); + + mollieHostedPaymentPage.selectFirstIssuer(); + mollieHostedPaymentPage.selectStatus('paid'); + + checkoutSuccessPage.assertThatOrderSuccessPageIsShown(); + + cy.backendLogin(false); + + cy.get('@order-id').then((orderId) => { + ordersPage.openOrderById(orderId); + }); + + ordersPage.assertOrderStatusIs('Processing'); + }); +}) diff --git a/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html b/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html new file mode 100644 index 00000000000..fcea4e2c5e7 --- /dev/null +++ b/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html @@ -0,0 +1,834 @@ + + + + +
+
+ + +
+
+
+
Profile ID (optional)
+
+
+ +
+
+ Mode + (Must match payment/mollie_general/type) +
+
+
+ +
+
+ +
+
CurrentStep
+
{{ currentStep }}
+
+ +
+
CartId
+
{{ cartId }}
+
+ +
+ +
+
+
+
    +
  • + + + Create cart + + (from storage) + +
  • +
  • + + + Add product to cart +
  • +
  • + + + Add shipping & billing address +
  • +
  • + + + Get shippings methods ({{ shippingMethod }}) +
  • +
  • + + + Set shipping method +
  • +
  • + + + Get payment methods +
  • +
  • + + + Set the payment method +
  • +
  • + + + Place order +
  • +
  • + + + Check transaction +
  • +
+ +
+
+
+
+ + +
+
+

Order done!

+
+

Order ID: {{ orderId }}

+

1. Please open this url and select a payment status (or not):

+ {{ redirectUrl }}
+ +

2. When you have opened the url, click here to get the payment status:

+ + +
+ PaymentStatus: {{ paymentStatus }}
+ redirect_to_cart: {{ redirectToCart ? 'true' : 'false' }}
+ redirect_to_success_page: {{ redirectToSuccessPage ? 'true' : 'false' }}
+
+
+
+
+
+
+ +
+
+ + {{ method.title }} + + +
    +
  • + +
  • +
+
+ +
+
+
Card Number
+
+
+
+ +
+
Card Holder
+
+
+
+ +
+
Expiry Date
+
+
+
+ +
+
CVV
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ + Continue!? +
+
+
+ + + diff --git a/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html b/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html new file mode 100644 index 00000000000..b22c53d7abb --- /dev/null +++ b/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html @@ -0,0 +1,537 @@ + + + + +
+
+ + +
+
+
+
Profile ID (optional)
+
+
+ +
+
+ Mode + (Must match payment/mollie_general/type) +
+
+
+ +
+
+ +
+
CurrentStep
+
{{ currentStep }}
+
+ +
+
CartId
+
{{ cartId }}
+
+ +
+ +
+
+
+
    +
  • + + + Create cart + + (from storage) + +
  • +
  • + + + Add product to cart +
  • +
  • + + + Add shipping & billing address +
  • +
  • + + + Get shipping methods ({{ shippingMethod }}) +
  • +
  • + + + Set shipping method +
  • +
  • + + + Place order +
  • +
  • + + + Start transaction +
  • +
+ +
+
+
+
+ + +
+
+

Order done!

+
+

Order ID: {{ orderId }}

+

1. Please open this url and select a payment status (or not):

+ {{ redirectUrl }}
+ +

2. When you have opened the url, check the status in the backend of your webshop.

+
+
+
+
+
+ +
+
+ + + {{ method.title }} + +
+
+
Card Number
+
+
+
+ +
+
Card Holder
+
+
+
+ +
+
Expiry Date
+
+
+
+ +
+
CVV
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ + + From 9ec3f4bf4f7f870f11aa139195f0fdd9c46917d4 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 20 Nov 2023 15:35:46 +0100 Subject: [PATCH 3/5] Bugfix: Refund zero shipping refunds #720 --- Model/Client/Orders.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Client/Orders.php b/Model/Client/Orders.php index fe796344c80..d4d16477995 100644 --- a/Model/Client/Orders.php +++ b/Model/Client/Orders.php @@ -744,7 +744,7 @@ public function createOrderRefund(Order\Creditmemo $creditmemo, Order $order) * Check if Shipping Fee needs to be refunded. * Throws exception if Shipping Amount of credit does not match Shipping Fee of paid orderLine. */ - $addShippingToRefund = null; + $addShippingToRefund = false; $shippingCostsLine = $this->orderLines->getShippingFeeItemLineOrder($orderId); if ($shippingCostsLine->getId() && $shippingCostsLine->getQtyRefunded() == 0) { if ($creditmemo->getShippingAmount() > 0) { @@ -757,7 +757,7 @@ public function createOrderRefund(Order\Creditmemo $creditmemo, Order $order) } } - $shouldRefund = $addShippingToRefund || !$creditmemo->getAllItems(); + $shouldRefund = $addShippingToRefund || $creditmemo->getAllItems(); if (!$shouldRefund || $this->adjustmentFee->doNotRefundInMollie()) { return $this; } From 87433c705201754e89c103e8976104bbf9715c9e Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 21 Nov 2023 13:10:01 +0100 Subject: [PATCH 4/5] Bugfix: Make sure that there is a float value --- Controller/ApplePay/ShippingMethods.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/ApplePay/ShippingMethods.php b/Controller/ApplePay/ShippingMethods.php index f65b04b9da7..12d66eb57f3 100644 --- a/Controller/ApplePay/ShippingMethods.php +++ b/Controller/ApplePay/ShippingMethods.php @@ -83,7 +83,7 @@ public function execute() return [ 'identifier' => $method->getCarrierCode() . '_' . $method->getMethodCode(), 'label' => $method->getMethodTitle() . ' - ' . $method->getCarrierTitle(), - 'amount' => number_format($method->getPriceInclTax(), 2, '.', ''), + 'amount' => number_format($method->getPriceInclTax() ?: 0.0, 2, '.', ''), 'detail' => '', ]; }, $methods), @@ -92,7 +92,7 @@ public function execute() 'type' => 'final', 'code' => $total->getCode(), 'label' => $total->getData('title'), - 'amount' => number_format($total->getData('value'), 2, '.', ''), + 'amount' => number_format($total->getData('value') ?: 0.0, 2, '.', ''), ]; }, array_values($cart->getTotals())) ]); From 5c117b23cacab550e77ff8932a7d536eb7b9ab94 Mon Sep 17 00:00:00 2001 From: Marvin Besselsen Date: Tue, 21 Nov 2023 14:09:48 +0100 Subject: [PATCH 5/5] Version bump --- composer.json | 2 +- etc/config.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 057388c2ca7..285aa072bf7 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mollie/magento2", "description": "Mollie Payment Module for Magento 2", - "version": "2.32.3", + "version": "2.32.4", "keywords": [ "mollie", "payment", diff --git a/etc/config.xml b/etc/config.xml index 80db50cddd7..f0c6c6daa0e 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -3,7 +3,7 @@ - v2.32.3 + v2.32.4 0 0 test