Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Payment
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Mar 2017 at 09:38 UTC
Updated:
16 Apr 2018 at 18:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sumanthkumarc commentedPatch will be available shortly.
Comment #3
bojanz commentedRetitling.
Comment #4
sumanthkumarc commentedattaching an initial patch. Not a finalized one. the gateways array_keys might be passed instead of entire array is one way. Also need to check the methods.
Comment #5
bojanz commented$options are more important, let's add $payment_gateways after them.
This needs the real typehint: \Drupal\commerce_payment\Entity\PaymentGatewayInterface[]
Might be nicer to do isset($payment_gateways[$order_payment_gateway->id()])
Comment #6
sumanthkumarc commentedUpdated patch with the review comments.
Comment #7
sumanthkumarc commentedalso tested with normal gateways without methods and it works fine.
Comment #8
sumanthkumarc commentedthis is a blocker issue for https://www.drupal.org/node/2860111 and https://www.drupal.org/node/2858067.
Comment #9
bojanz commentedThis protects against a no-longer-available order payment gateway, but it doesn't cover the case where the order has a payment method from a no-longer-available payment gateway.
We need to change our approach here. Instead of modifying getDefaultPaymentMethodOption() we want to make sure $selected_option is not empty.
Comment #10
bojanz commentedComment #11
bojanz commentedComment #13
bojanz commentedCommitted a tweaked version of your PR. Thanks!
Comment #14
bojanz commentedI can still reproduce a crash after disabling a gateway and revisiting checkout. Looks like we also still get payment methods belonging to disabled gateways. Needs another look, and test coverage.
Comment #16
bojanz commentedjoachim supplied a potential fix in[https://www.drupal.org/project/commerce/issues/2917638#comment-12307962
Comment #17
bojanz commentedActually, setting this issue back to Fixed, since the other issue (#2917638: PaymentInformation can crash if the payment gateway becomes unavailable) shows that the remaining bug is not in getDefaultPaymentMethodOption(), it's in the buildPaneForm() method itself. Let's fix it there.