pronamic / wp-pronamic-pay-buckaroo

Buckaroo driver for the WordPress payment processing library.
http://www.wp-pay.org/gateways/buckaroo/
3 stars 2 forks source link

PHP warning `Invalid argument supplied for foreach()` when enriching payment methods #7

Closed rvdsteege closed 2 years ago

rvdsteege commented 2 years ago

A customer noticed the following error after updating a Buckaroo configuration:

Warning: Invalid argument supplied for foreach() in /wp-content/plugins/pronamic-ideal2/vendor/wp-pay-gateways/buckaroo/src/Gateway.php on line 141

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2023552014/24521

remcotolsma commented 2 years ago

I did not encounter this during testing, were we able to reproduce this problem?

rvdsteege commented 2 years ago

I'm unable to reproduce the warning. The only things I could think of was a temporary issue at Buckaroo or no services enabled for the Buckaroo account.

With invalid Buckaroo credentials the result is a fatal error (in Gravity Forms payment feed), not the mentioned warning:

Fatal error: Uncaught Exception: application access is denied, Authorization header value is invalid in /wp-content/plugins/pronamic-ideal/repositories/pronamic/wp-pronamic-pay-buckaroo/src/Gateway.php on line 728

rvdsteege commented 2 years ago

I've received Buckaroo account details from the customer and was able to reproduce the warning in live mode. In the response to the request to Transaction/Specifications the Services property is null. My initial property_exists() is therefore definitely not the proper solution — as the property exists, but just doesn't contain any services.

I have contacted Buckaroo support for clarification on why there are no services in the live mode response:

Kunnen jullie ophelderen waarom er in de live modus geen resultaat is? Heeft dat met de account te maken of kunnen de actieve services nooit op deze manier in de live modus opgevraagd worden?

rvdsteege commented 2 years ago

Response from Buckaroo:

Op live zal de call enkel de betaalmethoden teruggeven die actief staan binnen het account. Momenteel staan enkel iDeal en Transfer inactief opgevoerd (dus wel beschikbaar voor test). Vandaar dat dezelfde call naar de live checkout een leeg resultaat geeft voor deze klant.