Problem/Motivation
The payment gateway plugin is not defined correctly. Specifically, important attributes such as the payment type and default forms (e.g., refund-payment) are missing. These attributes are normally provided through the PaymentGatewayBase::create() method.
In Commerce 3.x, payment gateway plugins must be created using the create() factory method rather than the constructor. To ensure compatibility, our custom gateway plugins must also adopt this approach.
Steps to reproduce
- Install Commerce.
- Install
commerce_2c2p. - Create a new payment using the 2C2P gateway.
- Attempt to refund the payment.
Result: An error is thrown stating that the refund-payment form is missing from the plugin definition.
Proposed resolution
Update the plugin to use the new instance creation pattern introduced in Commerce 3.x:
- Move all service injections and property assignments into the
create()method. - Stop relying on the constructor for dependency injection.
- Ensure default forms (such as
refund-payment) are properly set.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce_2c2p-fix-commerce-3-compatibility.patch | 12.39 KB | abdelrahman khlefat |
Issue fork commerce_2c2p-3545328
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
abdelrahman khlefat commentedComment #4
mohammad-fayoumiComment #5
josebc commented@abdelrahman khlefat are these changes compatible wit Commerce 2.x or does it need a new version?
Comment #7
redwan jamous commentedMerged. Thanks!