Work from #2838380: [META] Allow offsite payment gateways to create and use payment methods.
We should move OnsitePaymentGatewayInterface::createPayment
to SupportsStoredPaymentMethodsInterface
.
The createPayment
method has the intent that the on-site gateway will create a payment transaction with the payment method attached to the payment entity. By moving this method we can allow any gateway that supports stored payment methods to also support creating a payment with them.
After reviewing the available contributed payment gateways, all seem to implement \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\OnsitePaymentGatewayInterface
directly. So while this causes a breaking change in our interfaces, no one seems to be implementing \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\SupportsStoredPaymentMethodsInterface
on their own (because you technically can't.)
Comment | File | Size | Author |
---|---|---|---|
#2 | move_createpayment_t-3137116-2.patch | 2.67 KB | mglaman |
|
Comments
Comment #2
mglamanHere's the patch.
Comment #3
zaporylieNitpick: That line makes
use Drupal\commerce_payment\Entity\PaymentInterface;
unused.Otherwise, I think it's a good thing to move that particular method around. Giving it a new home in SupportsStoredPaymentMethodsInterface makes complete sense to me.
Comment #5
mglamanThanks, @zaporylie. Remaining unused imports has been a bane of my process in these off-site payment methods development 🤣
Fixed and committed!