GetMyFeesEstimatesResponse dto() issue
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
);
$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 = array($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 :)
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
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.
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.
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."
Oh okay I missed that little part of the array :-)
This should be fixed in v7.1.1.