craftcms / commerce-mollie

Mollie payment gateway for Craft Commerce.
https://plugins.craftcms.com/commerce-mollie
MIT License
5 stars 10 forks source link

Incorrect redirect via fetchPaymentMethods #52

Open bavodeclercq opened 1 year ago

bavodeclercq commented 1 year ago

Description

On the front-end, I'm using the gateway.fetchPaymentMethods() function to list payment methods as radio buttons. Previously, when a radio button was selected and the form was submitted, the user would be taken directly to the corresponding payment method in Mollie. However, the current behavior is different. After selecting a radio button and submitting the form, instead of being directed to the chosen payment method in Mollie, the user is taken to the general "select-method" page on the Mollie side. This requires the user to make the same selection again.

I also attempted to use the gateway.getPaymentFormHtml([]) function, but the issue persists in this scenario as well.

Steps to reproduce

  1. Navigate to the checkout page.
  2. Select a payment method from the list of radio buttons generated using gateway.fetchPaymentMethods().
  3. Submit the form.
  4. Instead of being taken directly to the chosen payment method in Mollie, you are redirected to the generic "select-method" page on the Mollie platform.

Additional info

lukeholder commented 6 months ago

I can't seem to reproduce this issue using getPaymentFormHtml() could there be a mollie side setting I am missing?

bavodeclercq commented 6 months ago

Diving into Craft Commerce's paymentsController and debugging within the actionPay function, it appears that the parameter name for payment methods should be more specific. Instead of just paymentMethod, it should be paymentForm[mollie][paymentMethod]. Making this adjustment resolves the issue for me. I'm unsure whether this change originates from Commerce or Mollie themselves.