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

getReturns() throw error: Object of class DateTime could not be converted to string #25

Open
meditatorzhang opened this issue May 14, 2024 · 0 comments

Comments

@meditatorzhang
Copy link

#0 \\vendor\\highsidelabs\\walmart-api\\src\\ObjectSerializer.php(567): GuzzleHttp\\Psr7\\Query::build(Array, 2)
#1 \\vendor\\highsidelabs\\walmart-api\\src\\Apis\\MP\\US\\ReturnsApi.php(811): Walmart\\ObjectSerializer::buildQuery(Array)
#2 \\vendor\\highsidelabs\\walmart-api\\src\\Apis\\MP\\US\\ReturnsApi.php(446): Walmart\\Apis\\MP\\US\\ReturnsApi->getReturnsRequest(NULL, NULL, NULL, NULL, NULL, NULL, NULL, Object(DateTime), Object(DateTime), '199')
#3 \\vendor\\highsidelabs\\walmart-api\\src\\Apis\\MP\\US\\ReturnsApi.php(411): Walmart\\Apis\\MP\\US\\ReturnsApi->getReturnsWithHttpInfo(NULL, NULL, NULL, NULL, NULL, NULL, NULL, Object(DateTime), Object(DateTime), '199')

I have found this error and fix it.
file: \src\Apis\MP\US\ReturnsApi.php

 ObjectSerializer::toQueryValue(
      $returnLastModifiedStartDate,
      'returnLastModifiedStartDate', // param base name
      'string', // openApiType
      'form', // style
      true, // explode
      false // required
  ) ?? [],
  ObjectSerializer::toQueryValue(
      $returnLastModifiedEndDate,
      'returnLastModifiedEndDate', // param base name
      'string', // openApiType
      'form', // style
      true, // explode
      false // required
  ) ?? [],

modify to:

 ObjectSerializer::toQueryValue(
      $returnLastModifiedStartDate,
      'returnLastModifiedStartDate', // param base name
      '\DateTime', // openApiType
      'form', // style
      true, // explode
      false // required
  ) ?? [],
  ObjectSerializer::toQueryValue(
      $returnLastModifiedEndDate,
      'returnLastModifiedEndDate', // param base name
      '\DateTime', // openApiType
      'form', // style
      true, // explode
      false // required
  ) ?? [],
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