- 🇫🇷France solene_ggd
I wanted to use this patch to get multiple Paypal options (offsite payments) with the right display label. But when I set one of my Paypal options as default payment method with the #13 patch installed, I get this error :
Drupal\Core\Entity\EntityStorageException : Missing bundle for entity type commerce_payment_method dans Drupal\Core\Entity\ContentEntityStorageBase->doCreate() (ligne 125 de /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).
This is because the payment method type id is not set in the option with the patch, but it is required by buildPaymentMethodForm() method called to construct the default payment option in PaymentInformation class.
I think this is what @DamienMo wanted to patch in his comment but I don't think he did it the right way.
I think the condition on offsite gateway should not be on the first condition to build the option but on the one inside that checks if there are multiple methods. This solution allows to keep the payment method type id in the option.And to get the payment gateway display label as option label, I change the default call of createLabel.
- Status changed to Needs review
5 months ago 5:34pm 9 February 2024 - last update
5 months ago 786 pass, 1 fail The last submitted patch, 21: 3250069-commerce-offsite-payment-methods-21.patch, failed testing. View results →
- 🇫🇷France solene_ggd
My bad, I did not think my patch could affect on site payment methods. Here is a new patch that should pass tests.
- Status changed to Needs review
5 months ago 6:10pm 9 February 2024 - last update
5 months ago 789 pass I tested with commerce 2.38. Patch applied successfully and PayPal payment method label appeared as it should (e.g. 'Pay with PayPal'). Yet, if I proceed with payment, cancel it I'm returned to the order information page with payment method just 'PayPal' instead of the label (behaviour the same as without the patch).
It just a heads up, I didn't test with 3.x and clean setup.
- 🇫🇷France solene_ggd
Hello @vaidas_a,
If you want to see your display label instead of just "Paypal" when you go back, you need to install this patch in addition (on drupal/commerce_paypal module) : https://www.drupal.org/project/commerce_paypal/issues/3420132#comment-15... 🐛 Use payment gateway label instead of Paypal by default Active
#24 Worked for us using webform commerce order + commerce paypal, thanks!
+1 for RTBC- 🇺🇸United States rszrama
I think this may need to be tested against payment gateway integrations like the Stripe Payment Element. They are technically implemented as offsite payment gateways even though all payment occurs on site. I haven't applied this patch to review the before / after, but I wonder if that use case was considered when this patch was written.