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).
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | mollie_3511582_patch1.patch | 3.04 KB | hoporr |
Comments
Comment #2
hoporr commentedComment #3
hoporr commentedInitial patch attached. The module needed to just use the Parent Class constructor and create function.
Comment #4
martijn de witThere is a patch, a merge request for 2.3.x would be great :)
Comment #5
idebr commentedAlternatively use https://www.drupal.org/project/commerce_mollie
Comment #7
ricovandevin commentedThanks for reporting the issue and submitting a patch!
Blindly removing the
create()method and using the globalDrupalclass ingetMode()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.
Comment #9
kensae commentedI'll create a new issue to fix this also for Mollie 3.x
Comment #11
matthiasm11 commentedThe commit of this issue causes Mollie Commerce to not work anymore. See #3588424: configuration must be of type array, and getPluginId() on null.