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

GetMyFeesEstimatesResponse dto() issue #754

Closed
MickDev13 opened this issue Jul 2, 2024 · 6 comments
Closed

GetMyFeesEstimatesResponse dto() issue #754

MickDev13 opened this issue Jul 2, 2024 · 6 comments

Comments

@MickDev13
Copy link

MickDev13 commented Jul 2, 2024

Hi,

I already wrote in a previous issue #736
It seems to be fixed now, so I can do the request to the API without any problem.

$AMZConnector = SellingPartnerApi::seller(
  clientId: xxxx,
  clientSecret: xxxx,
  refreshToken: xxxxxx,
  endpoint: Endpoint::EU
);

$body = array();
foreach( $SKUList as $sku )
{
  $listing = new \SellingPartnerApi\Seller\ProductFeesV0\Dto\MoneyType("EUR", 100);

  $shipping = new \SellingPartnerApi\Seller\ProductFeesV0\Dto\MoneyType("EUR", 0);

  $priceToEstimateFees = new \SellingPartnerApi\Seller\ProductFeesV0\Dto\PriceToEstimateFees($listing, $shipping);

  $feesRequest = new \SellingPartnerApi\Seller\ProductFeesV0\Dto\FeesEstimateRequest(xxxxxxxxxx, $priceToEstimateFees, "myidentifier-fee-" . date('YmdHis'), true);

  $request = new \SellingPartnerApi\Seller\ProductFeesV0\Dto\FeesEstimateByIdRequest("SellerSKU", $sku, $feesRequest);
  $body[] = $request;
}
  
$apiInstance = $AMZConnector->productFeesV0();
$response = $apiInstance->getMyFeesEstimates($body);

I retrieve a GetMyFeesEstimatesResponse from the webservice call.
If i call $response->json(), I can get the raw json from the response correctly, but if I try to get the dto with $response->dto(), I get the following error:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function SellingPartnerApi\Seller\ProductFeesV0\Responses\GetMyFeesEstimatesResponse::__construct(), 0 passed in /trt/htdocs/admin/vendor/jlevers/selling-partner-api/src/Traits/Deserializes.php on line 72 and exactly 1 expected in /trt/htdocs/admin/vendor/jlevers/selling-partner-api/src/Seller/ProductFeesV0/Responses/GetMyFeesEstimatesResponse.php on line 23

ArgumentCountError: Too few arguments to function SellingPartnerApi\Seller\ProductFeesV0\Responses\GetMyFeesEstimatesResponse::__construct(), 0 passed in /trt/htdocs/admin/vendor/jlevers/selling-partner-api/src/Traits/Deserializes.php on line 72 and exactly 1 expected in /trt/htdocs/admin/vendor/jlevers/selling-partner-api/src/Seller/ProductFeesV0/Responses/GetMyFeesEstimatesResponse.php on line 23

Did I do something wrong?

Thank you for your work :)

@simonsolutions
Copy link
Contributor

Have you tried
$apiInstance->getMyFeesEstimateForSku($sellerSku, $feesRequest)->dto();

That works for me.
Otherwise can you post the response json body to see what response parameter might be missing in construction

@MickDev13
Copy link
Author

Hi,

Thank you for the answer. My example is not complete, this is why you thought about getMyFeesEstimateForSku, i will edit it
I need to use getMyFeesEstimates method because of performance issues.
For my project, I need to send multiples SKUs, and I think it's better to send them in a single call instead of one call for each SKU.

@simonsolutions
Copy link
Contributor

I haven't seen that the ProductFee API allows calls with multiple SellerSKUs. There are some SP API calls with multiple SKUs but not this one. In the documentation is always written "a product". So I'm not sure if multiple SKUs will be possible to send in one request.

@MickDev13
Copy link
Author

Here is the amazon documentation for this method: https://developer-docs.amazon.com/sp-api/docs/product-fees-api-v0-reference#post-productsfeesv0feesestimate

"Returns the estimated fees for a list of products."

@simonsolutions
Copy link
Contributor

Oh okay I missed that little part of the array :-)

@jlevers
Copy link
Owner

jlevers commented Aug 6, 2024

This should be fixed in v7.1.1.

@jlevers jlevers closed this as completed Aug 6, 2024
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

3 participants