paytrail / paytrail-for-adobe-commerce

Paytrail payment service for Adobe Commerce (formerly known as Magento 2)
https://www.paytrail.com
MIT License
2 stars 7 forks source link

Fix setting callback response JSON #78

Closed taskula closed 11 months ago

taskula commented 11 months ago

Related tickets & documents

77

Description

https://github.com/paytrail/paytrail-for-adobe-commerce/blob/de5b21b7efc8639b175a350800d198fcfa723ae8/Controller/Callback/Index.php#L45 $response is an object of type Magento\Framework\Controller\Result\Json, and we must use $response->setData() instead of handling it as an array. https://github.com/paytrail/paytrail-for-adobe-commerce/blob/de5b21b7efc8639b175a350800d198fcfa723ae8/Controller/Callback/Index.php#L59

Otherwise we will die with main.CRITICAL: Error: Cannot use object of type Magento\Framework\Controller\Result\Json\Interceptor as array in /vendor/paytrail/paytrail-for-adobe-commerce/Controller/Callback/Index.php:59

konrad-konieczny commented 11 months ago

@taskula thank you for you Pull Request, we are now reviewing the issue.

konrad-konieczny commented 11 months ago

@taskula, I was able to reproduce the issue. It seems that your fix is valid. It will be included in version 2.0.2, which is scheduled to be published soon.