craftcms / commerce-mollie

Mollie payment gateway for Craft Commerce.
https://plugins.craftcms.com/commerce-mollie
MIT License
5 stars 10 forks source link

Catch a RequestException in fetchIssuers, for when there are no issuers configured in Mollie. #30

Closed timvermaercke closed 2 years ago

timvermaercke commented 3 years ago

Description

As described in issue https://github.com/craftcms/commerce-mollie/issues/18, this plugin doesn't work if you're not using iDEAL. iDEAL payments aren't so commonly used on the Belgian market, so it's perfectly possibly to not have iDEAL on a Belgian webstore.

Anyhow, the reason for the plugin not to work is because it thinks there should be issuers, which come from the iDEAL setup in Mollie. The fetchIssuers() method throws a Omnipay\Common\Http\Exception\RequestException, as there are no issuers defined for non-iDEAL payment methods. The getPaymentFormHtmlmethod then catches the exception and returns an empty response.

By catching the exception in the fetchIssuers-method and returning an empty array, this plugin works for configurations where iDEAL isn't set up.

Related issues

nfourtythree commented 2 years ago

Thanks for this!

Brought this up to date with develop, tweaked the payment form template and then merged it in.

This will be included in the next release of the plugin.