jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API
BSD 3-Clause "New" or "Revised" License
409 stars 200 forks source link

Sample code in SETUP is out of date #774

Closed TonyMarston closed 2 months ago

TonyMarston commented 3 months ago

Problem description:

Sample code in SETUP (https://github.com/jlevers/selling-partner-api?tab=readme-ov-file#setup) is out of date.

Error:

The SellingPartnerApi::seller method is called statically, but it is no longer static. The revised code is shown below

Code


$connector = new SellingPartnerApi(
    clientId: '<LWA client ID>',
    clientSecret: '<LWA client secret>',
    refreshToken: '<LWA refresh token>',
    endpoint: Endpoint::NA
);
$connector = $connector->seller();

$api = $connector->aPlusContentV20201101();
try {
    $result = $api->SearchContentDocuments($marketplace_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling aPlusContentV20201101->SearchContentDocuments: ',
        $e->getMessage(),
        PHP_EOL;
}
jlevers commented 3 months ago

Is it possible that you're using v6 instead of v7? The SellingPartnerApi::seller() method was not static in v6, but it definitely is in v7:

https://github.com/jlevers/selling-partner-api/blob/0915d8f57f7b4f43e97002855f0fe6e3ec8bc216/src/SellingPartnerApi.php#L67

TonyMarston commented 3 months ago

I am using the latest version available on https://github.com/jlevers/selling-partner-api which I installed using composer require jlevers/selling-partner-api

I am using PHP v8.3.10

Tony Marston

http://www.tonymarston.net http://www.tonymarston.net http://www.radicore.org http://www.radicore.org

From: Jesse Evers @.> Sent: Monday, August 26, 2024 6:26 AM To: jlevers/selling-partner-api @.> Cc: Tony Marston @.>; Author @.> Subject: Re: [jlevers/selling-partner-api] Sample code in SETUP is out of date (Issue #774)

Is it possible that you're using v6 instead of v7? The SellingPartnerApi::seller() method was not static in v6, but it definitely is in v7: https://github.com/jlevers/selling-partner-api/blob/0915d8f57f7b4f43e97002855f0fe6e3ec8bc216/src/SellingPartnerApi.php#L67 — Reply to this email directly, view it on GitHub https://github.com/jlevers/selling-partner-api/issues/774#issuecomment-2309345563 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRYNOCUCM3XV5TVDRJ7KTDZTK36JAVCNFSM6AAAAABNCUDPAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZGM2DKNJWGM . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ADRYNOGL3BHGO2AKLG3BJXDZTK36JA5CNFSM6AAAAABNCUDPAWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUJUXIRW.gif Message ID: @. @.> >

jlevers commented 3 months ago

Could you share your composer.json?

TonyMarston commented 3 months ago

Here it is:

{ "require": { "phpoffice/phpspreadsheet": "^1.29", "firebase/php-jwt": "^5.5", "aws/aws-sdk-php": "^3.232", "symfony/mailer": "^6.3", "webklex/php-imap": "^5.4", "jlevers/selling-partner-api": "^6.0", "composer/semver": "^3.4" } }

Tony Marston

http://www.tonymarston.net http://www.tonymarston.net http://www.radicore.org http://www.radicore.org

From: Jesse Evers @.> Sent: Monday, August 26, 2024 5:24 PM To: jlevers/selling-partner-api @.> Cc: Tony Marston @.>; Author @.> Subject: Re: [jlevers/selling-partner-api] Sample code in SETUP is out of date (Issue #774)

Could you share your composer.json? — Reply to this email directly, view it on GitHub https://github.com/jlevers/selling-partner-api/issues/774#issuecomment-2310593568 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRYNOH5NNRLRKKCWQBPK2LZTNJDNAVCNFSM6AAAAABNCUDPAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGU4TGNJWHA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ADRYNOBQFUNV6IKDEPWKYZ3ZTNJDNA5CNFSM6AAAAABNCUDPAWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUJXDOCA.gif Message ID: @. @.> >

jlevers commented 2 months ago

Yep, you're using v6. Change this line:

"jlevers/selling-partner-api": "^6.0",

to this:

"jlevers/selling-partner-api": "^7.1",