When adding a new Payment gateway and selecting 'PayPal recurring (Express Checkout)' none of the relevant configuration fields are displayed. The error is:

ArgumentCountError: Too few arguments to function Drupal\paypal_subscriptions\Plugin\Commerce\PaymentGateway\ExpressCheckoutSubscriptions::__construct(), 13 passed in /Users/chris/Sites/wilderoses/web/modules/contrib/commerce_paypal/src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php on line 157 and exactly 14 expected in Drupal\paypal_subscriptions\Plugin\Commerce\PaymentGateway\ExpressCheckoutSubscriptions->__construct() (line 81 of modules/contrib/paypal_subscriptions/src/Plugin/Commerce/PaymentGateway/ExpressCheckoutSubscriptions.php).

The final (missing) argument is AccountProxyInterface $current_user. This is with Commerce PayPal 8.x-1.0-beta6. Can anyone help?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cbrody created an issue. See original summary.

vuil’s picture

Status: Active » Needs review
FileSize
362 bytes

The $current_user persists already.
The problem is coming from a missing module dependency in .info.yml file:

+  - commerce_payment:commerce_payment

I create a patch for.

  • vuil committed e23e8aa on 8.x-1.x
    Issue #3119950 by vuil: Not working with commerce v2.17
    
vuil’s picture

vuil’s picture

Version: 8.x-1.0-alpha1 » 8.x-1.0
vuil’s picture

vuil’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
vuil’s picture

vuil’s picture

Status: Needs review » Needs work
erier’s picture

I'm not sure how to create patches, but i think i've found something that works.

In /commerce_paypal/src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php,

append $container->get('current_user') to return statement of public static function create()

... like ...

  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('entity_type.manager'),
      $container->get('plugin.manager.commerce_payment_type'),
      $container->get('plugin.manager.commerce_payment_method_type'),
      $container->get('datetime.time'),
      $container->get('logger.factory'),
      $container->get('http_client'),
      $container->get('commerce_price.rounder'),
      $container->get('commerce_paypal.ipn_handler'),
      $container->get('module_handler'),
      $container->get('event_dispatcher'),
      $container->get('current_user') // THIS LINE
    );
  }
JeremyFrench’s picture

Status: Needs work » Needs review
FileSize
1.65 KB

OK So I can see what has happened here.

The constructor for the Express Checkout Subscriptions has one more argument than the parent class, yet it still tries to use the parent classes construct method.

This patch allowed me to create the payment method.

vuil’s picture

Status: Needs review » Reviewed & tested by the community

  • vuil committed 2cdf719 on 8.x-1.x authored by JeremyFrench
    Issue #3119950 by vuil, JeremyFrench, erier: Not working with commerce...
vuil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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