mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
101 stars 53 forks source link

Dependency on Magento_InstantPurchase in CheckoutSubmitAllAfter Observer #507

Closed MatthijsBreed closed 2 years ago

MatthijsBreed commented 2 years ago

Describe the bug The Mollie\Payment\Observer\CheckoutSubmitAllAfter\StartTransactionForInstantPurchaseOrders uses a class constant of Magento\InstantPurchase\Model\QuoteManagement\PaymentConfiguration on line 49: $instantPurchase = $payment->getAdditionalInformation(PaymentConfiguration::MARKER);

If Magento_InstantPurchase is not installed, this results in an error when trying to place an order: Error: Class 'Magento\InstantPurchase\Model\QuoteManagement\PaymentConfiguration' not found in <magento_root>/vendor/mollie/magento2/Observer/CheckoutSubmitAllAfter/StartTransactionForInstantPurchaseOrders.php:49

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Magento 2.4.3-p1
  2. Have "magento/module-instant-purchase": "*", in the replace node of composer.json
  3. Place an order using a Mollie payment method

Expected behavior When clicking in 'Place Order' in the checkout, redirection to the mollie payment portal

Actual behavior The call to <base_url>/rest/nl/V1/carts/mine/payment-information returns 500 with the abovementioned error. The subsequent call to <base_url>/rest/nl/V1/carts/mine/totals also returns an error that the current customer has no active cart. The order is created with the status 'Payment Review'

Additional context Judging by the fix for issue 470, dependency on the Magento_InstantPurchase is not intended and/or documented.

Locally editing the class constant to the literal string it represents ('instant-purchase') creates a workaround to restore normal functionality. But this would not be best practice for a permanent fix. A potential fix could be to check if the Magento_InstantPurchase module is enabled via the Magento ModuleManager

Frank-Magmodules commented 2 years ago

HI @MatthijsBreed ,

We are happy to share that we've just released the new 2.9.0 version where we have fixed this issue. Thank you for opening this issue and for the detailed issue report.

We are closing this issue now but please feel free to reopen the issue if this still occurs.