pronamic / wp-pay-core

Core components for the WordPress payment processing library. This library is used in the WordPress plugin Pronamic Pay: https://www.pronamicpay.com/, but also allows other plugin developers to set up a payment plugin.
https://www.wp-pay.org/
GNU General Public License v3.0
27 stars 3 forks source link

Retrieving iDEAL issuers from transient catches exceptions #69

Closed remcotolsma closed 2 years ago

remcotolsma commented 2 years ago

I believe this has been discussed before, the Gateway->get_transient_issuers() method catches exceptions. As a result, as an administrator you will not always see error messages that occur when retrieving the iDEAL issuers.

https://github.com/pronamic/wp-pay-core/blob/40a63d75d65abe049f6d769c54bbfad6a3d566aa/src/Core/Gateway.php#L157-L186

This catch was added in https://github.com/pronamic/wp-pay-core/commit/2c9a6bf800da9c14fd353663ef5d853916bcdf91 on March 31, 2022. Probably also necessary because the switch from errors to exceptions has not yet been made properly / completely.

This can be seen, for example, in the Gravity Forms integration:

We should remove the catch from the Gateway->get_transient_issuers() method and handle the exceptions downstream.

remcotolsma commented 2 years ago

This issue was brought to our attention again via internal HelpScout ticket: https://secure.helpscout.net/conversation/1942250530/24187?folderId=1425710. The customer probably made a mistake while setting up the iDEAL Advanced certificate, but didn't see the underlying error message:

Invalid electronic signature. System generating error: Acquirer
remcotolsma commented 2 years ago

I think we should also combine this directly with the following issue:

The following Gateway class methods have become somewhat complex over time:

I believe we should als abstract the way we use the WordPress https://developer.wordpress.org/apis/handbook/transients/ API.

We know from the iDEAL Advanced integration guide that it is not allowed to request the iDEAL issuers for each transaction:

It is not allowed to perform the Directory protocol for each transaction. Since the list of Issuers only changes occasionally, it is sufficient to execute the Directory protocol on a daily basis and check if the list has changed based on the directoryDateTimestamp. If the Issuer list has changed, the latest version has to be saved and used for any subsequent transaction. Acquirers will normally also inform all Merchants (e.g. by email) about changes in their Issuer list. The Directory protocol should at least be executed once a month.

https://github.com/pronamic/wp-pronamic-pay-ideal-advanced-v3/blob/master/documentation/iDEAL-Merchant-Integration-Guide_29696264_931138689.pdf

I think this is less important with, for example, the Mollie API: https://docs.mollie.com/reference/v2/methods-api/list-methods

remcotolsma commented 2 years ago

This has been improved in https://github.com/pronamic/wp-pay-core/blob/00ce242b498427594663b8429de62514cbce3730/views/meta-box-gateway-test.php#L68-L101.