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

Unresolvable dependency resolving when calling getFeaturedOfferExpectedPriceBatch #5

Open
mselmanyildirim opened this issue Feb 27, 2024 · 2 comments

Comments

@mselmanyildirim
Copy link

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

image

@jlevers
Copy link
Contributor

jlevers commented Aug 13, 2024

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.

@mselmanyildirim
Copy link
Author

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?

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

2 participants