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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR created an issue. See original summary.

TR’s picture

Status: Needs work » Needs review
FileSize
2.03 KB
TR’s picture

Issue summary: View changes

  • TR committed a33cabf on 8.x-4.x
    Issue #2643688 by TR: Allow redirect and express PaymentMethods
    
TR’s picture

Status: Needs review » Fixed

Committed.

longwave’s picture

I 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.

TR’s picture

Yes, 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.