Adding a payment method is only possible for one gateway

Created on 25 November 2018, about 6 years ago
Updated 17 May 2023, over 1 year ago

To reproduce:
- Enable the commerce_payment_example module.
- Create 2 "Example (On-site)" payment gateways.
- Grant the "Manage own payment methods" permission to authenticated users
- Login and go to /user/123/payment-methods
- Click "Add a new payment method".

Actual result:
We are presented a payment method add form for one of the payment gateways created above, without being able to choose which gateway we want to create a payment method for.

Expected result:
A multistep form where the first step is selecting the payment gateway.

--ORIGINAL ISSUE---

I am trying to add a new payment method as a custom user and I cannot seem to. I had a look at the routing.yml file and under here:
entity.commerce_payment_method.add_form:
path: '/user/{user}/payment-methods/add'
defaults:
_form: '\Drupal\commerce_payment\Form\PaymentMethodAddForm'
_title: 'Add payment method'
requirements:
_custom_access: '\Drupal\commerce_payment\Access\PaymentMethodAccessCheck::checkAccess'
options:
parameters:
user:
type: entity:user

the method checkAccess() returns the $return object true, ie:
$result->isNeutral() is false but isAllowed() is true and isForbidden() is false

but I still get a 403 when i try to add a payment method for a given user under:

/user/{user}/payment-methods/add

I can confirm that I can see the list of empty payment methods page OK .

I can also confirm that the permissions have been set to allow for manage own payment method for the user role .

Please help

Hittesh

🐛 Bug report
Status

Fixed

Version

2.11

Component

Payment

Created by

🇬🇧United Kingdom hitteshahuja

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I'm getting this error when I add manual payment gateway. I have other gateways enabled but i want to add a new gateway also as manual gateway.

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\commerce\ConditionManager are: commerce_conditions_plus_and_operator, commerce_conditions_plus_or_operator, order_billing_address, order_currency, order_customer, order_customer_role, order_email, order_item_purchased_entity:commerce_product_variation, order_purchased_entity:commerce_product_variation, order_shipping_address, order_store, order_total_price, order_type, order_payment_gateway, order_item_product, order_item_product_category, order_item_product_type, order_item_variation_type, order_product, order_product_category, order_product_type, order_variation_type, order_item_quantity, shipment_address, shipment_quantity, shipment_weight in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
    Drupal\Core\Plugin\DefaultPluginManager->getDefinition() (Line: 16)
    Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 83)
    Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 324)
    Drupal\commerce_conditions_plus\Element\ConditionsTable::addNewCondition()
    call_user_func_array() (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 595)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • 🇮🇱Israel jsacksick

    The only Commerce code I'm seeing in your backtrace is:
    Drupal\commerce_conditions_plus\Element\ConditionsTable::addNewCondition()

    Which is coming from the Commerce conditions plus module it seems.

Production build 0.71.5 2024