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

Changed return type of getAdditionalInformation interfaces #8311

Conversation

fxdegroot
Copy link

@fxdegroot fxdegroot commented Jan 27, 2017

Pre-requisites :

  1. Make an order using PayPal Express as a payment method and then pay by entering credit card information within Paypal
  2. Try to access this particular order via Magento REST api : /rest/V1/orders

Result :

API call returns the following error : Notice: Array to string conversion in vendor/magento/framework/Reflection/TypeCaster.php on line 34

Cause :

  1. When the API tries to get additional_information from the sales_order_payment table, it calls the getAdditionalInformation method. As the function returns an array but the interface return type is defined as a string, an error is generated.

Note that return type of models and interfaces they implement also mismatch.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jan 27, 2017

CLA assistant check
All committers have signed the CLA.

@@ -261,7 +261,7 @@ public function getAdditionalData();
/**
* Gets the additional information for the order payment.
*
* @return string[] Array of additional information.
* @return array|null|mixed Array of additional information.
Copy link
Contributor

@YevSent YevSent Jan 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing annotation doesn't fix the problem in global scope. It fixes an issue for rest API but brokes payment methods output. The common issue more deeply than that annotation and related to how some payment methods use additional information, some payments contains a multi-nested array of data instead of an array of strings.

It's known issue (internal ticket MAGETWO-58379) and requires deep refactoring for some payment methods, like PayPal and Authorize.net. After that refactoring, this annotation also will be fixed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the deep explanation. I was expecting this kind of response. Let's wait for the new version then.

@ishakhsuvarov
Copy link
Contributor

@fxdegroot Thank you for your contribution to Magento.
Closing this PR for now. Please reopen if you have anything to add.

magento-devops-reposync-svc pushed a commit that referenced this pull request Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants