Problem/Motivation
The commerce_paybox_payment module is currently not compatible with Commerce 3.x. Although the module can be installed on a Drupal 10 site using Commerce 3.x, attempting to place an order using a Paybox payment gateway results in a fatal error:
Error: Call to a member function getPluginId() on null in Drupal\commerce_payment\PaymentStorage->doCreate() (line 50 of modules/contrib/commerce/modules/payment/src/PaymentStorage.php).
This indicates that the module does not properly initialize the payment gateway plugin before trying to create a payment entity, which is now required by Commerce 3.x (see
change record →
).
Steps to reproduce
- Install a clean Drupal 10 site with Commerce 3.x.
- Enable the
commerce_paybox_payment module.
- Create a payment gateway using the Paybox plugin provided by the module.
- Place a product in the cart and proceed to checkout.
- Select the Paybox gateway and attempt to complete the payment.
Expected: The payment is processed via Paybox.
Actual: A fatal error is thrown due to an uninitialized plugin instance.
Proposed resolution
Update the commerce_paybox_payment module to support Commerce 3.x by ensuring compatibility with internal changes in the commerce_payment module.
The fatal error occurs because the payment gateway plugin is not properly initialized before calling PaymentStorage::create(). Commerce 3.x requires the gateway plugin to be set explicitly, as outlined in the following change record:
https://www.drupal.org/node/3468511 →
.
This merge request introduces the necessary adjustments to ensure the plugin is initialized, allowing payments to be processed correctly. Backward compatibility with Commerce 2.x is not guaranteed, so a separate 2.x release is recommended.
Remaining tasks
- Review the changes introduced in this merge request.
- Test the updated module with Commerce 3.x. It has been tested in a real project, but further review is appreciated due to the lack of automated tests.
- Decide whether to create a new 2.x branch to support Commerce 3.x separately from the 1.x branch.
- Confirm that all existing unit tests pass.