The GlobalPayments\Api\Services\HostedService::parseResponse method is used to deserialize JSON coming from the HPP form. However, several of the array keys that it expects to find are optional. For example, if you're just using HPP to store a card for later and not actually charge it, or you aren't collecting the CVV number, the following warnings end up being generated:
PHP Notice: Undefined index: PASREF in globalpayments/php-sdk/src/Services/HostedService.php on line 108
PHP Notice: Undefined index: AUTHCODE in globalpayments/php-sdk/src/Services/HostedService.php on line 109
PHP Notice: Undefined index: CVNRESULT in globalpayments/php-sdk/src/Services/HostedService.php on line 133
PHP Notice: Undefined index: AVSPOSTCODERESULT in globalpayments/php-sdk/src/Services/HostedService.php on line 136
This was not an issue in the old rxp-hpp-php SDK, as that would correctly handle null/missing optional values.
Proposed solution
You should check the array keys exist before trying to access them.
Hi,
The
GlobalPayments\Api\Services\HostedService::parseResponse
method is used to deserialize JSON coming from the HPP form. However, several of the array keys that it expects to find are optional. For example, if you're just using HPP to store a card for later and not actually charge it, or you aren't collecting the CVV number, the following warnings end up being generated:This was not an issue in the old rxp-hpp-php SDK, as that would correctly handle null/missing optional values.
Proposed solution
You should check the array keys exist before trying to access them.