Now that the basic payment methods like Check and COD have been turned into plugins, we can move on to more complex payment methods. In order to make redirect methods and express methods works (see #2643682: Port uc_2checkout to D8 and #2625276: Port PayPal payment methods to D8) we have to implement annotation keys for 'redirect' and 'express' which used to exist in hook_uc_payment_method().
The attached patch adds the annotation keys and adds code to use the contents of those keys. I know the redirect now works because I'm currently using it as part of #2643682: Port uc_2checkout to D8. I will be testing the express in the near future as part of #2625276: Port PayPal payment methods to D8, and I expect that might need a small tweak to this patch.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2643688-redirect-express.patch | 2.03 KB | TR |
|
Comments
Comment #2
TR CreditAttribution: TR commentedComment #3
TR CreditAttribution: TR commentedComment #5
TR CreditAttribution: TR commentedCommitted.
Comment #6
longwaveI think this might better handled with interfaces? Payment method plugins could implement e.g. RedirectedPaymentMethodInterface and ExpressPaymentMethodInterface with relevant form builder methods if they support this type of functionality. Still, this is a good fix for now to get the existing methods converted over.
Comment #7
TR CreditAttribution: TR commentedYes, I thought of using interfaces or subclasses (with the payment plugin extended from e.g. RedirectPaymentMethodPluginBase) so that the redirect/express functionality could be included in a specially-named method in the plugin, just like we do with the configuration form. But for expediency I just went with adding the annotation. I actually like the interface method better because it provides type information which can be used programmatically unlike an annotation which is in essence just a code comment. A subclass means we could (maybe) put some boilerplate code in the base class.
I think it will be easier to try out this idea after we have some examples of redirect/express methods to experiment with. uc_2checkout (redirect) is now almost fully functional, and I will be working on PayPal EC over the next few days.