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

Error when sending a GTIN value to the Merchant API #7766

Open
steve-ico3 opened this issue Oct 25, 2024 · 0 comments
Open

Error when sending a GTIN value to the Merchant API #7766

steve-ico3 opened this issue Oct 25, 2024 · 0 comments

Comments

@steve-ico3
Copy link

Environment details

  • PHP version: 8.2
  • Package name and version: php-shopping-merchant-products v0.1.0 (possibly protobuf)

Steps to reproduce

  1. Send a product up to merchant using InsertProductInputRequest and insertProductInput
  2. Include a gtin value on the attribute e.g. 5054511953633
  3. 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

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

No branches or pull requests

1 participant