Payment Method Braintree Configured and Enabled, Vault Enabled: yes
Create an order using Braintree payment method and save the card
Make a call to the rest API to GET /rest/V1/orders
Order json returned
Error is returned: Notice: Array to string conversion in vendor/magento/framework/Reflection/TypeCaster.php on line 34 with stack trace
The cause of this error is due to Vault payments storing an array within the additional_information field in the table sales_order_payment. The array within is token_metadata which is an array containing customer_id and public_hash.
This was added in https://github.com/magento/magento2/commit/16d049fa4117f562120a68927c8c30c6b1e758b5
The error is thrown in Magento\Framework\Reflection\DataObjectProcessor::buildOutputDataArray:
https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php#L115
The code tries to cast the token_metadata field into a string, causing the array to string conversion error.
The error occurs when processing the getAdditionalInformation method
Magento\Sales\Api\Data\OrderPaymentInterface::getAdditionalInformation:
https://github.com/magento/magento2/blob/2.1/app/code/Magento/Sales/Api/Data/OrderPaymentInterface.php#L266
The method is marked with a return type of string[], so all values in the additional_information attribute should be of class string or Phrase.
There either needs to be a way of handling when the additional_information attribute has an array value within it, or the additional_information needs to be enforced to only have string values.
Hi, @phirunson, thanks for reporting and detailed description, this issue also reproducible on the latest develop. I've created internal MAGETWO-57115.
Hi @phirunson,
Fix for MAGETWO-57115 ticket is already merged to develop branch.
Closing the issue, please feel free to reopen if the issue still reproducible for you.
@alena-marchenko @joni-jones Do you know when this is fix is going to be released? You mentioned 2.1.3, but do you have any release date for this version?
Most helpful comment
@alena-marchenko @joni-jones Do you know when this is fix is going to be released? You mentioned 2.1.3, but do you have any release date for this version?