Drupal 10.4.3
Commerce Core 3.0.0 (Fresh install), this is the recommended Version for Drupal Core ^10.3
Mollie 2.2.1

Multiple errors with Commerce 3.0:

1) When setting up the mollie payment gateway (at /admin/commerce/config/payment-gateways), and then trying to edit it, I get the following error:
TypeError: array_map(): Argument #2 ($array) must be of type array, null given in array_map() (line 304 of C:\...\modules\contrib\commerce\modules\payment\src\Plugin\Commerce\PaymentGateway\PaymentGatewayBase.php).

Stack Trace:
#0 C: ...modules\contrib\commerce\modules\payment\src\Plugin\Commerce\PaymentGateway\PaymentGatewayBase.php(304): array_map(Object(Closure), NULL)
#1 C:...\modules\contrib\mollie\modules\mollie_commerce\src\Plugin\Commerce\PaymentGateway\Mollie.php(99): Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\PaymentGatewayBase->buildConfigurationForm(Array, Object(Drupal\Core\Form\FormState))

2) During checkout, using mollie payment gateway, on the last step when pressing "Pay and complete purchase":
Error: Call to a member function get() on null in Drupal\mollie_commerce\Plugin\Commerce\PaymentGateway\Mollie->getMode() (line 188 of modules\contrib\mollie\modules\mollie_commerce\src\Plugin\Commerce\PaymentGateway\Mollie.php).

CommentFileSizeAuthor
#3 mollie_3511582_patch1.patch3.04 KBhoporr

Comments

hoporr created an issue. See original summary.

hoporr’s picture

Title: Mollie noy compatible with Commerce 3.0 » Mollie not compatible with Commerce 3.0
hoporr’s picture

StatusFileSize
new3.04 KB

Initial patch attached. The module needed to just use the Parent Class constructor and create function.

martijn de wit’s picture

Version: 2.2.1 » 2.3.x-dev
Status: Active » Needs work

There is a patch, a merge request for 2.3.x would be great :)

idebr’s picture

  • ricovandevin committed 04ddb436 on 2.3.x
    fix: #3511582 Mollie not compatible with Commerce 3.0
    
    By: hoporr
    By:...
ricovandevin’s picture

Status: Needs work » Fixed

Thanks for reporting the issue and submitting a patch!

Blindly removing the create() method and using the global Drupal class in getMode() is not the solution as that breaks dependency injection.

The origin of the problem is that Commerce removed the constructor in favor of extending the create() method. A pattern that I'm deeply in favor of as it remove quite some boilerplate code. I have adopted this pattern for this specific class in the 2.3.x branch. Might refactor it in the rest of the codebase later too.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

kensae’s picture

I'll create a new issue to fix this also for Mollie 3.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

matthiasm11’s picture

The commit of this issue causes Mollie Commerce to not work anymore. See #3588424: configuration must be of type array, and getPluginId() on null.