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

  1. Install Commerce.
  2. Install commerce_2c2p.
  3. Create a new payment using the 2C2P gateway.
  4. 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.
Command icon 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

abdelrahman khlefat created an issue. See original summary.

abdelrahman khlefat’s picture

mohammad-fayoumi’s picture

Status: Active » Reviewed & tested by the community
josebc’s picture

@abdelrahman khlefat are these changes compatible wit Commerce 2.x or does it need a new version?

redwan jamous made their first commit to this issue’s fork.

redwan jamous’s picture

Version: 1.0.x-dev » 2.x-dev
Status: Reviewed & tested by the community » Fixed

Merged. Thanks!

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.

Status: Fixed » Closed (fixed)

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