Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting callback response JSON #78

Merged

Conversation

taskula
Copy link
Contributor

@taskula taskula commented Nov 28, 2023

Related tickets & documents

#77

Description

$response = $this->resultFactory->create(ResultFactory::TYPE_JSON);

$response is an object of type Magento\Framework\Controller\Result\Json, and we must use $response->setData() instead of handling it as an array.
$response['error'] = $this->processPayment->process($this->request->getParams(), $this->session);

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

$response is an object of type Magento\Framework\Controller\Result\Json\Interceptor,
and we must use $response->setData() instead of handling it as an array.
@konrad-konieczny
Copy link
Collaborator

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

@konrad-konieczny
Copy link
Collaborator

@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.

@loueranta-paytrail loueranta-paytrail merged commit 54e0b2c into paytrail:master Dec 11, 2023
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.

None yet

3 participants