bummzack / silverstripe-omnipay-ui

UI components for SilverStripe Omnipay Module
BSD 3-Clause "New" or "Revised" License
5 stars 9 forks source link

Incorrectly offering "Capture" on gateways that do not support it. #12

Closed hailwood closed 6 years ago

hailwood commented 7 years ago

Basically pxpay supports authorize but not capture (you need to log into their payline system to capture it). But on an authorized payment I am getting the option to "capture" the payment which is erroring out after I enter the amount to capture and submit with a validation error "The "Gateway_Name" gateway does not support capture" (or something similar).

So the package can tell the gateway doesn't support it; I believe we're just missing whatever check it's running before running the auth before we render the button.

bummzack commented 7 years ago

The library doesn't try to detect all functionality. Instead, you should configure your gateway capabilities in the config file. For your case, that might include setting the can_capture flag.

hailwood commented 7 years ago

Is there any reason we don't attempt to detect these options if they're not specified?

It just feels a bit redundant having to specify them when the gateway itself can tell you whether or not it's supported.

bummzack commented 7 years ago

Because there isn't just a "capture is allowed or not" setting, but there can be gateways that support partial capture (once or multiple times), only full capture or no capture. There's no way to automatically detect that from the gateway and therefore you'd have to configure it anyway.