Error when sending a GTIN value to the Merchant API
steve-ico3 opened this issue · 0 comments
Environment details
- PHP version: 8.2
- Package name and version: php-shopping-merchant-products v0.1.0 (possibly protobuf)
Steps to reproduce
- Send a product up to merchant using
InsertProductInputRequest
andinsertProductInput
- Include a gtin value on the attribute e.g.
5054511953633
- The product lists correctly in merchant, but the response throws an exception
Error comes back as Error occurred during parsing: Error occurred during parsing: String field only accepts string value
Google\Protobuf\Internal\Message
line 874 gets triggered and when I output the value it's
array(1) {
[0]=>string(13) "5054511953633"
}
When it should be a string, but that's in the API response not the data sent so it's not something I set / can fix
Code example
Won't provide the specific product details but it's when you send gtin
$request = new InsertProductInputRequest();
$request
->setParent(ProductInputsServiceClient::accountName($this->accountId))
->setDataSource(DataSourcesServiceClient::dataSourceName($this->accountId, $dataSourceId))
->setProductInput($productInput);
$response = $this->getProductInputClient()->insertProductInput($request);
If the product sent doesn't have a GTIN value then it all works correctly
It also occurs when you just call listProducts
if you have submitted a product with a GTIN value already
So I think there's a mapping issue somewhere making it think GTIN is an array when it should be a string
I could provide my merchant account and a specific example product if needed but obviously not on a public issue