Open FangedParakeet opened 1 week ago
Please add your planning poker estimate with Zenhub @FangedParakeet
I was able to put together a functioning proof of concept in the following branch: https://github.com/Automattic/woocommerce-payments/pull/9844/files
I've tested several flows using these changes and here are some of my most relevant findings:
WC_Payment_Gateway_WCPay
class is used to instantiate all the Gateways for every Payment Method that exists in WooPayments. Currently, the Credit Card Gateway and the "main" Gateway use the same instance, so they are deeply intertwined. In order to be able to disable Credit Cards without affecting other functionality, we need to separate the main gateway from the credit card gateway (if not the implementation, at least create separate instances).WC_Payment_Gateway_WCPay
class has a strict dependency on the UPE_Payment_Method
subclasses. If we want to minimize the amount of changes we need to implement a "dummy" UPE_Payment_Method
subclass for the main gateway.
woocommerce_payments_card
, if we follow the convention used by other payment methods). A migration will also be required to make sure this gateway is enabled in all the existing installations after updating the plugin. We'll also need to make sure that in all fresh installations the credit card gateway is enabled by default when enabling WooPayments.Payment_Method::CARD
instead of 'card'
).At this point I'm still unsure if there's a way to implement this gradually (maybe with a feature flag?) or if we require to use a main feature branch that we can merge later on. I'll start outlining the required tasks and while I think more about the specifics of the implementation.
Description
A long-requested feature has been to allow store owners to disable the card payment method, exclusively presenting EPMs or APMs at checkout instead. With the current state of our plugin, this should be technically feasible and is very achievable in our V2 plugin.
However, in WooPayments the card payment method is still closely tied to the main plugin gateway, with other payment methods relying on hooks, settings, and asset enqueuing functionality provided by this main gateway. In order disable the card payment method, we will need to refactor our plugin to separate the card payment method from the core payment gateway. We will also need to refactor the main plugin so that it can be initialised without registering the card payment method as a gateway and to allow this to be controlled by the
enabled
flag, as is the case with all of our other payment methods.Acceptance criteria
These are problems that we will need to solve in order to accomplish this goal. We don't need to actually solve them within this issue, but this spike is to explore their feasibility and plot out a pathway towards doing so, preferably in the form of a set of new issues.