Skip to content

Conversation

@pveiga2
Copy link
Contributor

@pveiga2 pveiga2 commented Aug 19, 2021

Added Null coalescing to "pspReference" response parameter. Added string check to isTestNotification()

Summary

The NotificationReceiver method validateHmac() crashes when the property 'pspReference' is missing on the $response array.
Somehow, this property was not always set for all my notifications.

The method isTestNotification() uses string comparison on this property to determine whether the notification is indeed a test.
But the function strtolower() does not accept null.
So if somehow the "pspReference" is missing from the response, this workflow generates a PHP error and crashes the process, which should otherwise be a valid notification.

Tested scenarios

Created a Standard notification Webhook in the Adyen Customer Area.
Configured my endpoint for JSON, HTTP Authentication and HMAC signature.
Then generated an AUTHORIZATION test notification, using the "Test configuration" button.

@pveiga2
Copy link
Contributor Author

pveiga2 commented Aug 19, 2021

Perhaps we may assume there will always be a "pspReference", as I'm always getting one right now.
But still it wouldn't hurt to reinforce the code against a possible crash.

@peterojo peterojo merged commit 83655c0 into Adyen:develop Aug 23, 2021
@acampos1916 acampos1916 mentioned this pull request Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants