laravel-spapi
laravel-spapi copied to clipboard
Unresolvable dependency resolving when calling getFeaturedOfferExpectedPriceBatch
Problem description:
Hi. I've been using this library for a while. Thanks for your great efforts.
Currently I'm able to use methods like getItemOffers
, getItemOffersBatch
etc, so my setup seems OK. But when I try to call getFeaturedOfferExpectedPriceBatch
, I get the error below.
When I try to debug, seems the error rises before my code below.
I'm using Laravel 10.45.1
and Php 8.1.10
Error:
Illuminate \ Contracts \ Container \ BindingResolutionException
Unresolvable dependency resolving [Parameter #0 [ <required> array $configurationOptions ]] in class SellingPartnerApi\Configuration
Code
$skus = [
'my-sku-1',
'my-sku-2',
];
$marketplaceId = 'ATVPDKIKX0DER';
$requests = array_map(function ($sku) use ($marketplaceId) {
return new \SellingPartnerApi\Model\ProductPricingV20220501\FeaturedOfferExpectedPriceRequest([
'uri' => "/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice",
'method' => 'GET',
'marketplace_id' => $marketplaceId,
'sku' => $sku,
]);
}, $skus);
$body = new \SellingPartnerApi\Model\ProductPricingV20220501\GetFeaturedOfferExpectedPriceBatchRequest(['requests' => $requests]);
try {
$result = $api->getFeaturedOfferExpectedPriceBatch($body);
return response()->json($result);
} catch (ApiException $e) {
$jsonBody = json_decode($e->getResponseBody());
return response()->json($jsonBody, $e->getCode());
}
Seller Central SP API config page screenshot
Hey @mselmanyildirim, sorry for taking a while to respond. Please try upgrading to v2
and let me know if you're still running into errors.
Hey @jlevers, sorry that I missed your response. Very good news that V2 is out.
Thanks for your response and maintaining Laravel-Spapi.
Yes, I've tried with V2 and now I can get the response 🎉
Updating to the new syntax take me a while. If I'm not wrong, the new syntax is more in line with the Amazon's documentation now.
The blog page had really helped when I started using v1, but it seems obsolete now. Would you mind suggesting another page for easy upgrade from v1 to v2 or a page like the previous blog which included example code?