Git Product home page Git Product logo

sp-api-sdk's Introduction

Amazon Selling Partner API - PHP SDK

This repository is not an official Amazon PHP library for their SP API.

social-preview

We Stand Against Terror

Stand With Ukraine Stand With Us
Flag of Ukraine Flag of Israel

On Feb. 24, 2022, Russia declared an unprovoked war on Ukraine and launched a full-scale invasion. Russia is currently bombing peaceful Ukrainian cities, including schools and hospitals and attacking civilians who are fleeing conflict zones.

On Oct. 7, 2023, the national holiday of Simchat Torah, Hamas terrorists initiated an attack on Israel in the early hours, targeting civilians. They unleashed violence that resulted in at least 1,400 casualties and abducted at least 200 individuals, not limited to Israelis.

Why next library?

The main goal of this SDK is to provide SDK's for the Amazon SP API in a way that would let the application to pass Amazon audit.

Amazon audit might happen to systems that must access API endpoints with PII.

There are already few php sp api SDKs available for PHP however most of them comes with many issues of auto generated code.

  • hardcoded dependencies like guzzlehttp/guzzle or aws/aws-sdk-php
  • legacy code base (7.2)
  • no logger
  • SDK's are oriented around single seller which is not suitable for bigger systems
  • missing or lacking support for client_credentials grant type
  • not all API covered
  • no extensions

This library goal is to resolve all above mentioned issues.

Installations

composer require amazon-php/sp-api-sdk

This library is not in a stable stage yet, please use with caution.

Releases

branch maintained
1.x 🚫
2.x 🚫
3.x 🚫
4.x 🚫
5.x 🚫
6.x βœ…

Version 1.x is deprecated becuase of the attempt to make a little more sense of what Amazon is doing with using "tags" in their Open API specification. This attempt failed and in order to keep Backward Compatibility promise, changes in the class names had to be introduced in 2.x. Version 1.0 is not going to be updated anymore, please migrate to version 2.0 that will stay consistent with Amazon Models Branch 3.x comes with BC breaks introduced by Amazon in Catalog Item models. Until old model won't go away, branches 2.x and 3.x should be maintained in parallel.

4.x comes with BC breaks in following Amazon api models:

  • Listings
  • Reports
  • Vendor
    • Direct Fulfillment Shipping
    • Direct Fulfillment Orders
    • Direct Fulfillment Transactions

5.x moves to Catalog Item API version 2022-04-01 which is replacing version 2020-12-01. Additionally, uuid used to generate correlation identifiers was replaced with IdGenerator interface that by default is using php internal uniqid(). This change allowed us to drop one additional dependency. Some minor adjustments were made in the template files for models/api.

6.x comes with changes to the Fulfillment Inbound API as well as other additions and removals.

  • Additions
    • Fulfillment Inbound API v2024-03-20
      • This is a major change. The v2024-03-20 version takes the place of the V0 version in namespace whereas the V0 version SDK is now FulfillmentInboundV0SDK and the V0 models are within the Model\FulfillmentInboundV0 directory.
    • Amazon Warehousing and Distribution API v2024-05-09
    • Application Management API v2023-11-30
  • Removals
    • Authorization API
    • FBA Small and Light API
      • You can retrieve the new fees for affected products by using the Product Fees API and/or the relevant FBA and Referral Fee reports.

Available SDKs

SellingPartnerSDK - Facade for all SDK's

Authorization

In order to start using SP API you need to first register as a Developer and create application. Whole process is described in Amazon Official Guides.

Amazon recommends to use Role IAM when creating application however this requires and additional API request in order to obtain access token. It's easier to use User IAM and just make sure that the user has following Inline Policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "execute-api:Invoke",
            "Resource": "arn:aws:execute-api:*:*:*"
        }
    ]
}

IAM User

Example of changing refresh token into access token.

<?php

use AmazonPHP\SellingPartner\OAuth;
use AmazonPHP\SellingPartner\Configuration;
use AmazonPHP\SellingPartner\HttpFactory;
use Buzz\Client\Curl;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Log\NullLogger;

$factory = new Psr17Factory();
$client = new Curl($factory);

$oauth = new OAuth(
    $client,
    $httpFactory = new HttpFactory($factory, $factory),
    $config = Configuration::forIAMUser(
        'lwaClientId',
        'lwaClientIdSecret',
        'awsAccessKey',
        'awsSecretKey'
    ),
    new NullLogger()
);

$accessToken = $oauth->exchangeRefreshToken('seller_oauth_refresh_token');

IAM Role

<?php

use AmazonPHP\SellingPartner\OAuth;
use AmazonPHP\SellingPartner\Configuration;
use AmazonPHP\SellingPartner\HttpFactory;
use AmazonPHP\SellingPartner\STSClient;
use Buzz\Client\Curl;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Log\NullLogger;

$factory = new Psr17Factory();
$client = new Curl($factory);

$sts = new STSClient(
    $client,
    $requestFactory = $factory,
    $streamFactory = $factory
);

$oauth = new OAuth(
    $client,
    $httpFactory = new HttpFactory($requestFactory, $streamFactory),
    $config = Configuration::forIAMRole(
        'lwaClientID',
        'lwaClientIdSecret',
        $sts->assumeRole(
            'awsAccessKey',
            'awsSecretKey',
            'arn:aws:iam::.........'
        )
    ),
    new NullLogger()
);

$accessToken = $oauth->exchangeRefreshToken('seller_oauth_refresh_token');

Development

99% of code in this library is auto generated from Amazon Selling Partner API Models using OpenAPI Generator tool. Output is later automatically upgraded by RectorPHP to PHP 7.4 version and finally coding standards are also automatically unified by PHP CS Fixer.

Requirements:

In oder to regenerate code (for example when API definitions change), execute following code:

composer generate

Examples

<?php

use AmazonPHP\SellingPartner\Marketplace;
use AmazonPHP\SellingPartner\Regions;
use AmazonPHP\SellingPartner\SellingPartnerSDK;
use Buzz\Client\Curl;
use AmazonPHP\SellingPartner\Exception\ApiException;
use AmazonPHP\SellingPartner\Configuration;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Nyholm\Psr7\Factory\Psr17Factory;

require_once __DIR__ . '/vendor/autoload.php';

$factory = new Psr17Factory();
$client = new Curl($factory);

$configuration = Configuration::forIAMUser(
    'lwaClientId',
    'lwaClientIdSecret',
    'awsAccessKey',
    'awsSecretKey'
);

$logger = new Logger('name');
$logger->pushHandler(new StreamHandler(__DIR__ . '/sp-api-php.log', Logger::DEBUG));

$sdk = SellingPartnerSDK::create($client, $factory, $factory, $configuration, $logger);

$accessToken = $sdk->oAuth()->exchangeRefreshToken('seller_oauth_refresh_token');

try {
    $item = $sdk->catalogItem()->getCatalogItem(
        $accessToken,
        Regions::NORTH_AMERICA,
        $asin = 'B07W13KJZC',
        $marketplaceId = [Marketplace::US()->id()]
    );
    dump($item);
} catch (ApiException $exception) {
    dump($exception->getMessage());
}

Logging

Default log level is set up to DEBUG, but it can be changed in configuration to any other level for all operations in all APIs or only for given operation in given API.

$configuration->setDefaultLogLevel(\Psr\Log\LogLevel::INFO);

Specific API's or only given operations can be also excluded from logging (for example APIs with PII or sensitive data).

$configuration->setLogLevel(CatalogItemSDK::API_NAME, CatalogItemSDK::OPERATION_GETCATALOGITEM, LogLevel::INFO);
$configuration->setSkipLogging(TokensSDK::API_NAME);
$configuration->setSkipLogging(AuthorizationSDK::API_NAME, AuthorizationSDK::OPERATION_GETAUTHORIZATIONCODE);

Finally, you can also ignore specific headers when logging http request/response. By default, configuration is set to ignore following sensitive authorization headers:

'authorization',
'x-amz-access-token',
'x-amz-security-token',
'proxy-authorization',
'www-authenticate',
'proxy-authenticate',

you can also add your own ignored headers:

$configuration->loggingAddSkippedHeader('some-sensitive-key');

Extensions

Each SDK allows you to register custom extensions executed before and after sending API requests.

<?php

$configuration->registerExtension(new class implements \AmazonPHP\SellingPartner\Extension {
    public function preRequest(string $api, string $operation, RequestInterface $request): void
    {
        echo "pre: " . $api . "::" . $operation . " " . $request->getUri() . "\n";
    }

    public function postRequest(string $api, string $operation, RequestInterface $request, ResponseInterface $response): void
    {
        echo "post: " . $api . "::" . $operation . " " . $request->getUri() . " "
            . $response->getStatusCode() . " rate limit: " . implode(' ', $response->getHeader('x-amzn-RateLimit-Limit')) . "\n";
    }
});

Sandbox

Sandbox mode can be turned on using configuration:

$configuration->setSandbox();

Some APIs endpoints are covered in functional tests. To run tests that are using sandbox mode, you need to create .env file and populate it with your credentials:

cp .env.dist .env

Then you can enter composer test:functional te execute sandbox test suite.

sp-api-sdk's People

Contributors

aeon-automation avatar belguinan avatar dependabot[bot] avatar georanma avatar jasonhebert avatar norberttech avatar owsiakl avatar raing3 avatar sergoslav avatar staabm avatar stevad avatar sw-oldeu avatar tetsuya-takiguchi avatar to-heeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sp-api-sdk's Issues

RDT issue with getOrders()

I'm able to use the RDT to get an order using getOrder()
however if I use the same thing to getOrders() I get an error.
I am calling the RDT the exact same way and using it in the getOrders() call. I do get the RDT, but for some reason it doesn't want to work.

$orders = $this->sdk->orders()->getOrders( new AccessToken( $this->restrictedDataAccessToken->getRestrictedDataToken(), 'not_available', 'bearer', $this->restrictedDataAccessToken->getExpiresIn(), 'restricted_data_token' ), Regions::NORTH_AMERICA, $marketplaceId = [Marketplace::US()->id()], $date, null, null, null, $order_statuses );

ERROR:

name.DEBUG: Amazon Selling Partner API post request {"api":"Orders","operation":"getOrders","response_correlation_id":"85e7fef7-4359-4a9c-b52f-77006fd59190","response_body":"{\n "errors": [\n {\n "code": "Unauthorized",\n "message": "Access to requested resource is denied.",\n "details": ""\n }\n ]\n}","response_headers":{"Server":["Server"],"Date":["Thu, 25 May 2023 17:35:37 GMT"],"Content-Type":["application/json"],"Content-Length":["143"],"Connection":["keep-alive"],"x-amz-rid":["CJA6BQQPFGWA4P4P3W7N"],"x-amzn-RequestId":["6db3c96f-658a-410d-a366-79b4e9c4cc33"],"x-amz-apigw-id":["OPF6db3c96f658a"],"X-Amzn-Trace-Id":["Root=1-646f9c69-6db3c96f658a410d"],"x-amzn-ErrorType":["AccessDeniedException"],"Vary":["Content-Type,Accept-Encoding,User-Agent"],"Strict-Transport-Security":["max-age=47474747; includeSubDomains; preload"]},"response_status_code":403}

Request's body not validated

Currently the ObjectSerializer checks the type of data.

if Value is null, it won't throw any error
that's where the function validate should throw an error, but it is never called.
Example:
this block should validate data of type array, it does not check if the array is empty

class \AmazonPHP\SellingPartner\ObjectSerializer::sanitizeForSerialization

 if (\is_array($data)) {
            foreach ($data as $property => $value) {
                $data[$property] = self::sanitizeForSerialization($value);
            }

            return $data;
        }

The validation should take place in function validate()

class: \AmazonPHP\SellingPartner\Model\ListingsItems\FulfillmentAvailability::validate

    /**
     * Validate all properties.
     *
     * @throws AssertionException
     */
    public function validate() : void
    {
        if ($this->container['fulfillment_channel_code'] === null) {
            throw new AssertionException("'fulfillment_channel_code' can't be null");
        }

        if (null !== $this->container['quantity'] && ($this->container['quantity'] < 0)) {
            throw new AssertionException("invalid value for 'quantity', must be bigger than or equal to 0.");
        }
    }

Solution: we should add $data->validate; inside if ($data instanceof ModelInterface)

/**
     * Serialize data.
     *
     * @param mixed $data the data to serialize
     * @param null|string $type the OpenAPIToolsType of the data
     * @param null|string $format the format of the OpenAPITools type of the data
     *
     * @return null|array|object|scalar serialized form of $data
     */
    public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null)
    {
        if (\is_scalar($data) || null === $data) {
            return $data;
        }

        if ($data instanceof \DateTimeInterface) {
            return ($format === 'date') ? $data->format('Y-m-d') : $data->setTimezone(new \DateTimeZone('UTC'))->format(self::$dateTimeFormat);
        }

        if (\is_array($data)) {
            foreach ($data as $property => $value) {
                $data[$property] = self::sanitizeForSerialization($value);
            }

            return $data;
        }

        if (\is_object($data)) {
            $values = [];

            if ($data instanceof ModelInterface) {
             
                $formats = $data::openAPIFormats();

                foreach ($data::openAPITypes() as $property => $openAPIType) {
                    $getter = $data::getters()[$property];
                    $value = $data->{$getter}();

                    if ($value !== null && \is_object($value) && \method_exists($value, 'getAllowableEnumValues')) {
                        $callable = [$openAPIType, 'getAllowableEnumValues'];

                        if (\is_callable($callable)) {
                            /** array $callable */
                            $allowedEnumTypes = $callable();

                            if (!\in_array($value->toString(), $allowedEnumTypes, true) &&
                                !\in_array(\ltrim((string) $openAPIType, '\\'), self::getBrokenModelDefinitions(), true)) {
                                $imploded = \implode("', '", $allowedEnumTypes);

                                throw new \InvalidArgumentException("Invalid value for enum '{$openAPIType}', must be one of: '{$imploded}'");
                            }
                        }

                        $value = $value->toString();
                    }

                    if ($value !== null) {
                        $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
                    }
                }
            } else {
                foreach ($data as $property => $value) {
                    $values[$property] = self::sanitizeForSerialization($value);
                }
            }

            return $values;
        }

        return (string) $data;
    }

FulfillmentInbound enum validation

Hey,
we have some problems when creating request for putTransportContent method in fulfillment inbound SDK.
code for this is:

$response = $sdk->fulfillmentInbound()->putTransportDetails(
    $accessToken,
    $marketplace->region(),
    'FBA000000001',
    new AmazonPHP\SellingPartner\Model\FulfillmentInbound\PutTransportDetailsRequest([
        'is_partnered' => true,
        'shipment_type' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\ShipmentType(AmazonPHP\SellingPartner\Model\FulfillmentInbound\ShipmentType::SP),
        'transport_details' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\TransportDetailInput([
            'partnered_small_parcel_data' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\PartneredSmallParcelDataInput([
                'carrier_name' => 'UNITED_PARCEL_SERVICE_INC',
                'package_list' => [
                    new AmazonPHP\SellingPartner\Model\FulfillmentInbound\PartneredSmallParcelPackageInput([
                        'dimensions' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\Dimensions([
                            'length' => 18,
                            'width' => 12,
                            'height' => 12,
                            'unit' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfMeasurement(AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfMeasurement::INCHES)
                        ]),
                        'weight' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\Weight([
                            'value' => 25,
                            'unit' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfWeight(AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfWeight::POUNDS)
                        ])
                    ])
                ]
            ])
        ])
    ])
);

and looks like it's a problem with object serializer - it can't validate shipment type enum cuz it comparing ShipmentType object with strings SP or LT:

InvalidArgumentException {#3341
  #message: "Invalid value for enum '\AmazonPHP\SellingPartner\Model\FulfillmentInbound\ShipmentType', must be one of: 'SP', 'LTL'"
  #code: 0
  #file: "./vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php"
  #line: 66
  trace: {
    ./vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php:66 { …}
    ./vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Api/FbaInboundApi/FulfillmentInboundSDK.php:3355 { …}
    ./vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Api/FbaInboundApi/FulfillmentInboundSDK.php:3203 { …}
    ./ui/scratchpad/amazon.php:69 {
      β€Ί     'value' => 25,
      β€Ί     'unit' => new AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfWeight(AmazonPHP\SellingPartner\Model\FulfillmentInbound\UnitOfWeight::POUNDS)
      β€Ί ])
    }
  }
}

Catalog Item image variant validation error

InvalidArgumentException: Invalid value 'PT09' for 'variant', must be one of 'MAIN', 'PT01', 'PT02', 'PT03', 'PT04', 'PT05', 'PT06', 'PT07', 'PT08', 'SWCH'

/app/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/CatalogItem/ItemImage.php:315

Example ASIN: B0000CF98Q

HttpSignatureHeaders issue when URL contains special symbols

Hello,

I found a new issue in HttpSignatureHeaders when trying to put a product with SKU that contains special chars.

The product SKU: 301Y3EA#ABH

While sending product data to Listing API I got the next error from Amazon:

{
  "errors": [
    {
      "message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

The Canonical String for this request should have been
'PUT
/listings/2021-08-01/items/SELLER-ID/301Y3EA%2523ABH
marketplaceIds=A1805IZSGTT6HS
host:sellingpartnerapi-eu.amazon.com
x-amz-security-token: ...

host;x-amz-security-token
1c18c85f178d03338b2e1b023a636403f4fb3d264fb7485e93dc58f7f9e608ac'

The String-to-Sign should have been
'AWS4-HMAC-SHA256
20220706T071719Z
20220706/eu-west-1/execute-api/aws4_request
925b2ab9c22be74202b3ed26f03617806c13cc4d9d918a02409799c9e2418101'
",
     "code": "InvalidSignature"
    }
  ]
}

While debugging I checked both values that were generated by \AmazonPHP\SellingPartner\HttpSignatureHeaders::forConfig method and here are they:

Canonical string:

PUT
/listings/2021-08-01/items/SELLER-ID/301Y3EA%23ABH
marketplaceIds=A1805IZSGTT6HS
host:sellingpartnerapi-eu.amazon.com
x-amz-security-token:...

host;x-amz-security-token
1c18c85f178d03338b2e1b023a636403f4fb3d264fb7485e93dc58f7f9e608ac

String-to-Sign:

AWS4-HMAC-SHA256
20220706T071719Z
20220706/eu-west-1/execute-api/aws4_request
fba5c165936272951bf64b552ee161457f3856a61c66d7389760d30a33c92d0a

The only difference is in the second line in the Canonical string:

  • Amazon expects: /listings/2021-08-01/items/SELLER-ID/301Y3EA%2523ABH
  • We send: /listings/2021-08-01/items/SELLER-ID/301Y3EA%23ABH

Looks like Amazon expects a value that should be URL-encoded once more time. To test, I made changes in code related to $canonicalString preparation. With this code I was able to send data to API without error:

        $canonicalString = $request->getMethod()
            //. "\n" . $request->getUri()->getPath()   <-- original line, below is changed line
            . "\n" . \str_replace('%2F', '/', \rawurlencode($request->getUri()->getPath()))
            . "\n" . \http_build_query($queryElements, '', '&', PHP_QUERY_RFC3986)
            . "\n" . $canonicalHeadersStr
            . "\n" . $signedHeadersStr
            . "\n" . $hashedPayload;

Yes, it may look weird at the moment, but it works. Can you check, please?

Similar problem found over the internet:

TypeError when serializing ItemSearchResults when no pages or refinements are present

Version: 4.0.8
What causes the error: After calling the CatalogItems::searchCatalogItems() method call ItemSearchResults::jsonSerialize(). The method ItemSearchResults::jsonSerialize() expects an Object of type Pagination but instead null is returned.

I think just make the response optional would save the problem. But I don't know what impact this change may have and which ResponseResults may have the same error.

Regards

must be of the type string, null

Uncaught TypeError: Return value of AmazonPHP\SellingPartner\Model\Orders\Address::getName() must be of the type string, null returned in /home/jsanchez/www/domains/dev2.cron/bins/cron_scripts/amazon_mws_v2/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/Orders/Address.php:282

Convert protected object/array to public

I'm working on getting orders from amazon and I'm building an array with the full information for the order, such as Items, however, it is like I cannot do anything with the original order array or orders array.

Am I doing something wrong? or how can I access this another way as we do manipulation to the orders coming in so that we can enter them into out system.

`$orderArr = array();

	// new order get
	$order_statuses = array(SPOrder::ORDER_STATUS_UNSHIPPED, SPOrder::ORDER_STATUS_SHIPPED);
	$orders = $this->sdk->orders()->getOrders(
		$this->accessToken, 
		Regions::NORTH_AMERICA,
		$marketplaceId = [Marketplace::US()->id()],
		$date, 
		null, 
		null, 
		null, 
		$order_statuses
	);
	
	
    //error_log('orders:'); error_log(json_encode($orders));
    if (isset($orders['payload']['orders'])) { $orders = $orders['payload']['orders']; }
	//$orders = json_encode($orders);
	//$orders = json_decode($orders, true, 5, JSON_OBJECT_AS_ARRAY);
	//dump($orders); exit;
    $c = 0;
    foreach ($orders as $order) {
        if($this->isFlowOrder($order['amazon_order_id'])) {
            continue;
        }
		$orderId = $order['amazon_order_id'];
		//$order = $this->object_to_array($order);
		$orderArr[$c] = $order;
		$items = $this->sdk->orders()->getOrderItems(
			$this->accessToken,
			Regions::NORTH_AMERICA,
			$orderId
		);
		
        $orderArr[$c]['Items'] = $this->object_to_array($items['payload']['order_items']);
		
        $c++;
    }
    return (array) $orderArr;`

Vendor/OrdersSDK should return a VendorOrdersSDK

public function ordersSDK() : VendorDirectFulfillmentOrdersSDKInterface
{
return $this->instantiateSDK(VendorDirectFulfillmentOrdersSDK::class);
}

If I understand correctly, this should actually return a VendorOrdersSDK instance instead of a VendorDirectFulfillmentOrdersSDK:

    public function ordersSDK() : VendorOrdersSDKInterface
    {
        return $this->instantiateSDK(VendorOrdersSDK::class);
    }

To be completely honest, I couldn't quite figure out yet what exactly the difference is, but according to the documentation, the VendorOrders namespaces has more specific usecases and uses a different endpoint path. I monkeypatched the code locally, but keep getting unauthorized responses (while calling the top level OrdersSDK directly works fine).

New Catalog Items API v2022-04-01 Version, Errors executing: composer generate

Hi,

here is the new Catalog Version: https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference.

Can you please update the https://github.com/amazon-php/sp-api-sdk/blob/4.x/src/AmazonPHP/SellingPartner/Api/CatalogApi/CatalogItemSDK.php?

and Update: https://github.com/amazon-php/sp-api-sdk/blob/4.x/bin/generate.sh

replace:
https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/catalog-items-api-model/catalogItems_2020-12-01.json with
https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/catalog-items-api-model/catalogItems_2022-04-01.json

When i'll execute composer generate
I'll got the following Errors

> Composer\Config::disableProcessTimeout
> rm -rf src/AmazonPHP/SellingPartner/Api
> rm -rf src/AmazonPHP/SellingPartner/Model
> bin/generate.sh
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-aplus.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-aplus.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-aplus.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-authorization.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-authorization.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-authorization.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
-sh-4.2$ composer generate
> Composer\Config::disableProcessTimeout
> rm -rf src/AmazonPHP/SellingPartner/Api
> rm -rf src/AmazonPHP/SellingPartner/Model
> bin/generate.sh
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-aplus.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-aplus.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-aplus.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-authorization.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-authorization.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-authorization.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-catalog-item.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-catalog-item.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-catalog-item.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-inbound.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-inbound.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-fba-inbound.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-inventory.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-inventory.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-fba-inventory.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-small-and-light.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fba-small-and-light.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-fba-small-and-light.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-feeds.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-feeds.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-feeds.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-finances.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-finances.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-finances.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fulfillment-inbound.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fulfillment-inbound.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-fulfillment-inbound.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fulfillment-outbound.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-fulfillment-outbound.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-fulfillment-outbound.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-listings-items.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-listings-items.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-listings-items.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-merchant-fulfillment.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-merchant-fulfillment.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-merchant-fulfillment.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-messaging.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-messaging.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-messaging.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-notifications.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-notifications.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-notifications.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-orders.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-orders.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-orders.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-fees.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-fees.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-product-fees.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-pricing.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-pricing.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-product-pricing.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-types-definitions.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-product-types-definitions.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-product-types-definitions.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-reports.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-reports.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-reports.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-sales.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-sales.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-sales.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-sellers.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-sellers.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-sellers.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-services.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-services.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-services.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-shipment-invoicing.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-shipment-invoicing.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-shipment-invoicing.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-shipping.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-shipping.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-shipping.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-solicitations.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-solicitations.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-solicitations.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-tokens.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-tokens.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-tokens.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-uploads.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-uploads.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-uploads.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-inventory.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-inventory.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-direct-fulfillment-inventory.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-orders.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-orders.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-direct-fulfillment-orders.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-payments.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-payments.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-direct-fulfillment-payments.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-shipping.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-shipping.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-direct-fulfillment-shipping.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-transactions.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-direct-fulfillment-transactions.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-direct-fulfillment-transactions.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-invoices.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-invoices.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-invoices.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-orders.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-orders.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-orders.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-shipments.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-shipments.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-shipments.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-transaction-status.yaml (No such file or directory)
[main] ERROR o.o.c.config.CodegenConfigurator - /sp-api/config/generator-vendor-transaction-status.yaml (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: /sp-api/config/generator-vendor-transaction-status.yaml
        at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:163)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:88)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:286)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Script bin/generate.sh handling the generate event returned with error code 1

Where can i find the *.yaml Files? or am I missing something here?

Docker version 20.10.17, build 100c701

ty
regards
Torsten

Listing API item deserialization error

I am trying to load the product using Listing API SDK.

Request log:

[2022-06-15T08:49:19.965991+00:00] amazon.DEBUG: Amazon Selling Partner API pre request {"api":"ListingsItems","operation":"getListingsItem","request_correlation_id":"86975203-3ed0-485a-a895-4ddbf92df76c","request_body":"","request_headers":{"content-type":["applica
tion/json"],"accept":["application/json"],"host":["sellingpartnerapi-eu.amazon.com"],"user-agent":["Library amazon-php/sp-api-php (language=PHP 7.4.29; Platform=Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)"],"x-amz-date":["20220615T084914Z"]},"request_uri":"https://se
llingpartnerapi-eu.amazon.com/listings/2021-08-01/items/ASUBR/90NB0SL1-M10530?marketplaceIds=A1RKKUPIHCS9HS&includedData=summaries%2Cattributes%2Cissues%2Coffers%2CfulfillmentAvailability%2Cprocurement"}

The request is successful, I see in logs that the response contains product data, but SDK fails on deserializing:

[2022-06-15T08:49:46.547226+00:00] app.CRITICAL: TypeError: Argument 1 passed to AmazonPHP\SellingPartner\Model\ListingsItems\Item::setAttributes() must be an object or null, array given, called in /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php on line 381 (/var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/ListingsItems/Item.php, line 308) {"trace":"
#0 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php(381): AmazonPHP\\SellingPartner\\Model\\ListingsItems\\Item->setAttributes()
#1 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Api/ListingsApi/ListingsItemsSDK.php(392): AmazonPHP\\SellingPartner\\ObjectSerializer::deserialize()

... below stack trace is on files that are not related to the library ...

If I remove attributes from includedData in the query - the issue disappears.

[Listings Items - patchListingsItem] - InvalidInput : Request has missing or invalid parameters and cannot be parsed

Hello !

Calling patchListingsItem() function return an error : InvalidInput : Request has missing or invalid parameters and cannot be parsed

Maybe the body is not correctly implemented
I noticed that json_encode() adds "" in the "patches" property, which is not present in the exemple given in this documentation : [https://spapi.cyou/en/use-case/listings-items-api-use-case-guide_2021-08-01.html#step-1-submit-listings-item-patch-request]

I've tried to delete them but I've the same issue.

You can see attachment for more detail.
patchListingsItem.docx

Thank you :)

Replace the internal STS client with the official one

The internal STS client is missing most of the functionality of the official Amazon SDK's STS client. The official client, or an update to the internal one, will be needed to use EC2 Instance Profile roles and local SSO credentials with this library.

BUG | Small & Light | Status

Hi, first of all, thanks for this great sdk.
When I use the putSmallAndLightEnrollmentBySellerSKU method, an unexpected exception is thrown.

/usr/share/magora/mgbase-dev/modules/pandarizer/backend/classes/platform/platform_amazonrest.php:356:
object(TypeError)[862]
  protected 'message' => string 'AmazonPHP\SellingPartner\Model\FBASmallAndLight\SmallAndLightEnrollment::setStatus(): Argument #1 ($status) must be of type AmazonPHP\SellingPartner\Model\FBASmallAndLight\SmallAndLightEnrollmentStatus, string given, called in /usr/share/magora/mgbase-dev/modules/pandarizer/backend/libs/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php on line 376' (length=378)
  private 'string' (Error) => string '' (length=0)
  protected 'code' => int 0
  protected 'file' => string '/usr/share/magora/mgbase-dev/modules/pandarizer/backend/libs/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/FBASmallAndLight/SmallAndLightEnrollment.php' (length=169)
  protected 'line' => int 289

Implementation

$smlEnrollmentResponse = $this->sdk->fbaSmallAndLight()->putSmallAndLightEnrollmentBySellerSKU(
                $this->accessToken,
                Regions::EUROPE,
                $sku,
                [$this->marketplaceId]
            );

Raw response body

{"marketplaceId":"A1PA6795UKMFR9","sellerSKU":"PD-947154-SML","status":"ENROLLED"}

FeeEstimateByIdRequest expects id_type to be of type IdType, IdType always returns string

I've been working with the getMyFeesEstimate function and have been receiving a type error for the id_type parameter. My request looks like:

$body1 =
new FeesEstimateByIdRequest([
        'fees_estimate_request' => new FeesEstimateRequest([
            "marketplace_id" => Marketplace::US()->id(),
            "is_amazon_fulfilled" => false,
            "price_to_estimate_fees" => new PriceToEstimateFees([
                'listing_price' => new MoneyType([
                    "currency_code" => "USD",
                    "amount" => 559
                ])
            ]),
            'identifier' => uniqid("TR-", true)
        ]),
        'id_type' => IdType::ASIN,
        'id_value' => 'B09CXSW9XL'
    ]);

When run, I receive the error:

PHP Fatal error: Uncaught TypeError: AmazonPHP\SellingPartner\Model\ProductFees\FeesEstimateByIdRequest::getIdType(): Return value must be of type AmazonPHP\SellingPartner\Model\ProductFees\IdType, string returned in \vendor\amazon-php\sp-api-sdk\src\AmazonPHP\SellingPartner\Model\ProductFees\FeesEstimateByIdRequest.php:222

The issue is that IdType has no constructor nor getter/setter functions so the only way to use it correctly is to statically refer to the the ASIN enum via IdType::ASIN. This will always return a string however, thus meaning it's impossible to correctly call this function.

I corrected it by editing the getIdType and setIdType functions in FeeEstimateByIdRequest.php to:

    public function getIdType() : string
    {
        return $this->container['id_type'];
    }

    public function setIdType(string $id_type) : self
    {
        $this->container['id_type'] = $id_type;

        return $this;
    }

incompatibility with symfony 6.2 exactly psr/log 3

Hi hey,
I try to Test this sdk in with Symfony 6.2 application and composer return this error:

composer require amazon-php/sp-api-sdk -w

return

`Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires amazon-php/sp-api-sdk ^5.0 -> satisfiable by amazon-php/sp-api-sdk[5.0.0, 5.0.1].
- amazon-php/sp-api-sdk[5.0.0, ..., 5.0.1] require psr/log ^1.1 -> found psr/log[1.1.0, ..., 1.1.4] but these were not loaded, likely because it conflicts with another require.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require amazon-php/sp-api-sdk:*" to figure out if any version is installable, or "composer require amazon-php/sp-api-sdk:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
can you please change the composer.josn to allowpsr/log` version greated than 1.1? Please.

pageSize needs to be nullable for getfeeds nextToken

When retrieving the next page for the getFeeds endpoint we need to be able to put in a null pageSize

{\n
  "errors": [\n
    {\n
      "code": "InvalidInput",\n
      "message": "NextToken cannot be specified with other input parameters",\n
      "details": "pageSize;"\n
    }\n
  ]\n
}

on url /feeds/2021-06-30/feeds?pageSize=10&nextToken=******

Sandbox Mode Integration

Hi, we have a problem with integrating the sandbox API.
We're using Guzzle as Client, using middlewares I managed to call the sandbox endpoints manually, but got
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been... as an response, so I figured out there was some kind of problem with singing the request.
I think it is a pretty much necessary feature, so I wondered whether you will implement it in your sdk , or is there some kind of battle-tested workaround of this problem.

Thanks, Patrick

Mark overridden methods from native classes with ReturnTypeWillChange attribute

Initial issue: #230

While working with this library on a project using PHP 8.1 we got the next error:

Uncaught yii\base\ErrorException: Return type of AmazonPHP\SellingPartner\Model\ProductTypesDefinitions\ProductTypeList::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/ProductTypesDefinitions/ProductTypeList.php:219

When PHP is configured to strict error reporting it will trigger error exceptions on deprecation notices and this may affect many projects with similar settings that are using this good library.

To avoid such problems, PHP suggests writing #[\ReturnTypeWillChange] attribute before overridden method names.

It will not affect code for PHP < 8.0, because # symbol will be parsed as comment in these versions.

Example: official AWS SDK library that supports PHP >= 5.5 and uses this attribute in several classes like this: https://github.com/aws/aws-sdk-php/blob/master/src/Api/AbstractModel.php

Error 403 - Error connecting to the API --> AccessDeniedException

Hello,

I'm a new user of Amazon SP-API, and I can't execute any API function because of a 403 error - AccessDeniedException

Example while trying to execute the example given in README.md (getCatalogItem)
[403] Error connecting to the API (https://sellingpartnerapi-eu.amazon.com/catalog/2020-12-01/items/A13V1IB3VIYZZH?marketplaceIds=B00SG7KRRU)"

Access token ($accessToken) is correctly returned by exchangeRefreshToken('REFRESH TOKEN') function

I have created a new user in AWS with these policy given in the README.md, but also with these following policies :

  • AWSMarketplaceFullAccess
  • AdministratorAccess
  • AWSPrivateMarketplaceAdminFullAccess
  • AdministratorAccess-Amplify
  • AWSMarketplaceSellerFullAccess

In the Amazon Seller, I've created an application and I've add my AWS user with IAM identifier

I've also tryied to authorise new developer in the SellerCentral page, but I've this error : MD9000
Sans titre2

I don't know what I've missed ?????
Thanks for your help

Sans titre

During inheritance of ArrayAccess. Uncaught Return type (ObjectSerializer) PHP 8.1

Hi

I have a problem with ObjectSerializer on PHP Version 8.1.7

During inheritance of ArrayAccess: Uncaught yii\base\ErrorException: Return type of AmazonPHP\SellingPartner\Model\ProductTypesDefinitions\ProductTypeList::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/ProductTypesDefinitions/ProductTypeList.php:219
Stack trace:

0 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/ProductTypesDefinitions/ProductTypeList.php(17): Gepard\Log\Components\ConsoleErrorHandler->handleError(code: '...', message: '...', file: '...', line: '...')

1 /var/www/html/vendor/composer/ClassLoader.php(571): ::unknown()

2 /var/www/html/vendor/composer/ClassLoader.php(428): ::Composer\Autoload\includeFile(file: '...')

3 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php(360): Composer\Autoload\ClassLoader->loadClass(class: '...')

4 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php(360): ::method_exists(object_or_class: '...', method: '...')

5 /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Api/DefinitionsApi/ProductTypesDefinitionsSDK.php(396): AmazonPHP\SellingPartner\ObjectSerializer::deserialize(configuration: '...', data: '...', class: '...', httpHeaders: '...')
AmazonPHP\SellingPartner\Api\DefinitionsApi\ProductTypesDefinitionsSDK->searchDefinitionsProductTypes(accessToken: '...', region: '...', marketplace_ids: '...', keywords: '...')

6 {main} in /var/www/html/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/ProductTypesDefinitions/ProductTypeList.php on line 17

VendorSDK and Purchase Orders

Hi everyone,

I've recently installed your SDK. It's amazing and very useful, I just can't imagine how much time I would have spent generating and adapting SP API via Swagger-codegen.

There is something I just saw when trying to use the Vendors OrderSDK.

private VendorDirectFulfillmentOrdersSDK $ordersSDK;

Shouldn't this be a property of class OrdersSDK?

Thanks in advance.

Return value of AmazonPHP\SellingPartner\Model\Orders\Address::getName() must be of the type string, null returned

V: amazon-php/sp-api-sdk 4.0.12 Amazon Selling Partner API - PHP SDK
PHP V ~7.4

Some address is null so on jsonSerialize() I get this error... seems the data has a null and wants a string.

TypeError

Return value of AmazonPHP\SellingPartner\Model\Orders\Address::getName() must be of the type string, null returned

at vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/Orders/Address.php:282
278β–• * Gets name.
279β–• /
280β–• public function getName() : string
281β–• {
➜ 282β–• return $this->container['name'];
283β–• }
284β–•
285β–• /
*
286β–• * Sets name.

  +6 vendor frames

7 app/Console/Commands/AmazonCommands.php:660
AmazonPHP\SellingPartner\Model\Orders\GetOrdersResponse::jsonSerialize()

Map all headers back to original headers

While converting over from MWS to the new SP-API
I'm using the library and calling getOrders(), which returns the orders list.
However it looks like you are converting all the headers over to your own headers.

Example: AmazonOrderId => amazon_order_id

I would like these to stay the same as they are originally from Amazon, which is the camel case.
This way when I retrieve data, I don't have to go through and change all the headers over, or change all of my code to look for the new headers.

Not sure why this is mapped this way, however there should be a way to revert it.

SP-API getPackageTrackingDetails does not respond correctly when an unknown event code is responded.

Hi, I am currently developing an application using this library.
Thank you very much.

Now, when we run getPackageTrackingDetails from this library, if an unknown event code is responded by Amazon, it will result in an exception.

log

Type: InvalidArgumentException

Message: Invalid value for enum '\AmazonPHP\SellingPartner\Model\FulfillmentOutbound\EventCode', must be one of: 'EVENT_101', 'EVENT_102', 'EVENT_201', 'EVENT_202', 'EVENT_203', 'EVENT_204', 'EVENT_205', 'EVENT_206', 'EVENT_301', 'EVENT_302', 'EVENT_304', 'EVENT_306', 'EVENT_307', 'EVENT_308', 'EVENT_309', 'EVENT_401', 'EVENT_402', 'EVENT_403', 'EVENT_404', 'EVENT_405', 'EVENT_406', 'EVENT_407', 'EVENT_408', 'EVENT_409', 'EVENT_411', 'EVENT_412', 'EVENT_413', 'EVENT_414', 'EVENT_415', 'EVENT_416', 'EVENT_417', 'EVENT_418', 'EVENT_419'

Filename: /var/www/html/app/ebisu/application/vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/ObjectSerializer.php

Line Number: 348

The event codes we detected are the following event codes (we asked Amazon what the event codes mean).

  1. EVENT_438 : Customer has requested delivery appointment to be rescheduled. Delivery may be delayed due to the customer request.
  2. EVENT_444 : Customer has requested the package to be forwarded to a different address. The request will be processed shortly.

Also, Amazon has informed us that event codes will continue to be added or changed due to changes in the delivery system.
Therefore, we would appreciate it if the library could return the value as it is even if an unknown event code is responded to.
Is it possible to request a correction?

Issue in creating new Destination by Notifications API

Hi,
I am using your extension in laravel project to integrate Amazon SP API, Its working for products, Feeds API correctly, But when I am trying it for Notifications API to create Destinations for my store, Its giving below error.

[403] Error connecting to the API (https://sellingpartnerapi-eu.amazon.com/notifications/v1/destinations)

I had setup the SQS queue in my amazon account as per the API documentation below. But its not working for me, Can you please help me what wrong I am doing there, I also sending my code here to review.

$createDestinationRequest = new CreateDestinationRequest(); $destinationResourceSpecification = new DestinationResourceSpecification(); $SqsResource = new SqsResource(); $SqsResource->setArn('MyQUEUEARNNUMBERHERE');
            $destinationResourceSpecification->setSqs($SqsResource);

            $createDestinationRequest->setResourceSpecification($destinationResourceSpecification);
            $createDestinationRequest->setName("Zayron");
           
            
           // $getDestination                 = $this->service->notifications()->getDestinations($accessToken,$region);
            
            $createDestination              = $this->service->notifications()->createDestination($accessToken,$region,$createDestinationRequest);
            echo "<pre>";
            print_r($accessToken);
            die();

/*
Step 1. Grant Selling Partner API permission to write to your SQS queue

To receive notifications you must grant Selling Partner API permission to write to your SQS queue.

Open the [AWS Management Console](https://console.aws.amazon.com/console) and sign in with your AWS credentials.

From the console, open Amazon Simple Queue Service.

Select the Standard queue where you want to receive notifications.

Choose the Access Policy tab.

From the Access policy (Permissions) section, select Edit. The Edit Test Queue page opens.

Scroll down to Access policy, then select the Policy generator link. The AWS Policy Generator opens in a new tab.

In Step 1 of the policy generator, select SQS Queue Policy.

In Step 2 of the policy generator:

Set Effect to Allow.
Set Principal to 437568002678.
Set Actions to SendMessage and GetQueueAttributes.
Enter the SQS ARN value in Amazon Resource Name (ARN).
Choose Add Statement and verify the details.

In Step 3 of the policy generator, select Generate Policy. A dialog box with the new policy opens.

Copy the policy.

Navigate back to the Amazon SQS queue, open the Access policy tab, then paste the policy into the Access Policy (Permissions) section.

Save the changes.

Reference the queue's Details section and note the ARN for this queue. You will pass this value using the arn parameter when you call the createDestination operation in [Step 2. Create a destination](https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide#step-2-create-a-destination).

*/

Test custom rector rules

Due to broken definitions of amazon sp API models we need to adjust some arguments/return types in this SDK.
This operation is done through rector however sometimes while generating new model rector is not adjusting the code.

Would be good to have a test case that would iterate over all of those custom definitions (we can move them somewhere outside rector config file) and using reflection confirm that method definitions are matching expectations.

Miss Currency code EUR

In the inbound shipment plan creation, the currency code EUR is missing AmazonPHP\SellingPartner\Model\FulfillmentInbound\Currency
"api" => "FulfillmentInbound",
"operation" => "createInboundShipmentPlan",

We got the response In ObjectSerializer.php line 347:
[InvalidArgumentException]
Invalid value for enum '\AmazonPHP\SellingPartner\Model\FulfillmentInbound\CurrencyCode', must be one of: 'USD', 'GBP'

Seems like grantless operations does not work

Hi, I'm not able to create a destination for notifications

`
$notifications = $this->sdk->notifications();
$accessToken = $this->sdk->oAuth()->clientCredentials('sellingpartnerapi::notifications');

$destination = $notifications->createDestination($accessToken, $region, new CreateDestinationRequest([
'resource_specification' => new DestinationResourceSpecification([
'sqs' => new SqsResource([
'arn' => 'arn:aws:sqs:region:id...'
]),
]),
'name' => 'Test name',
]));`

Response:
In NotificationsSDK.php line 149:
[409] Error connecting to the API (https://sellingpartnerapi-eu.amazon.com/notifications/v1/destinations)

Any thoughts? What am I doing in a wrong way?

ArgumentError OAuth

KΓΆnnt ihr mir bitte helfen:

include('./vendor/autoload.php');

use AmazonPHP\SellingPartner\OAuth;
use AmazonPHP\SellingPartner\Configuration;
use AmazonPHP\SellingPartner\HttpFactory;
use Buzz\Client\Curl;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Log\NullLogger;

$factory = new Psr17Factory();
$client = new Curl($factory);

$oauth = new OAuth(
    $client,
    $httpFactory = new HttpFactory($factory, $factory),
    $config = Configuration::forIAMUser(
        '....',
        '...',
        '...',
        '...'
    ),
    new NullLogger()
);

$accessToken = $oauth->exchangeRefreshToken('...');

Error: ...OAuth::__construct(): Argument #1 ($client) must be of type Psr\Http\Client\ClientInterface, Buzz\Client\Curl given, called in ...

pageSize needs to be nullable for getReports nextToken

Hello,

I encountered a new issue while trying to use ReportsSDK::getReports() with the specified next_token parameter for GET /reports/2021-06-30/reports. Upon running the code, I received the following error from Amazon:

{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "NextToken cannot be specified with other input parameters",
      "details": "pageSize;"
    }
  ]
}

After examining the source code, I noticed that pageSize is fixed as an integer type and does not allow null values, which prevents queries using next_token from functioning properly.

Reference:
https://developer-docs.amazon.com/sp-api/docs/reports-api-v2021-06-30-reference#get-reports2021-06-30reports

Thank you.

Error DateTime type hint

I think there is an error regarding the way some parameters for the functions have not the good types.

The error I have found is in the financial SDK part in the class https://github.com/amazon-php/sp-api-sdk/blob/3.x/src/AmazonPHP/SellingPartner/Api/DefaultApi/FinancesSDK.php

If we check the api https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/finances-api-model/financesV0.json
especially the line regardring the method "/finances/v0/financialEvents

One of the parameters is PostedAfter

      { "name": "PostedAfter",
      "in": "query",
      "description": "A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format.",
      "required": false,
      "type": "string",
      "format": "date-time"}

The method autogenerated becomes

/**
     * Operation listFinancialEvents.
     *
     * @param AccessToken $accessToken
     * @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
     * @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
     * @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
     * @param string $next_token A string token returned in the response of your previous request. (optional)
     *
     * @throws \AmazonPHP\SellingPartner\Exception\ApiException on non-2xx response
     * @throws \AmazonPHP\SellingPartner\Exception\InvalidArgumentException
     */
    public function listFinancialEvents(AccessToken $accessToken, string $region, int $max_results_per_page = 100, \DateTime $posted_after = null, \DateTime $posted_before = null, string $next_token = null) : \AmazonPHP\SellingPartner\Model\Finances\ListFinancialEventsResponse
    { 
 

The request that will be geberated won't transform as a parameter of the request to fit with the ISO 8601 requirements.

I think that all of this DateTime parameters should hint as a string.

Problem with jsonSerialize function

Using the OrdersSDK the function jsonSerialize, sometimes have an exception.

"AmazonPHP\SellingPartner\Model\Orders\Address::getName(): Return value must be of type string, null returned"

The strange part is, if I try to collect the name using getOrderAddress, getShippingAddress and finally the getName, I
retrieve the name without any problem.

Debugging I found that the $this->container seems to be empty for most of attributes.

I tried both version 4 and 5.

Order shipmentConfirmation returns null

I am setting up our system to use the shipmentConfirmation call.
I've tested this using the sandbox, however on a successful call, it returns "null"

I think this should return some data such as the status code, error etc.
I do not think it should just fail, as we can then use this returned info to send emails with info to our system.

Feature request: add vendor apis

Hello,

I've been tinkering with this library and it feels great, thanks!

My question... Do you have any plans to add vendor apis?

https://github.com/amzn/selling-partner-api-models/tree/main/models:

  • vendor-direct-fulfillment-inventory-api-model
  • vendor-direct-fulfillment-orders-api-model
  • vendor-direct-fulfillment-payments-api-model
  • vendor-direct-fulfillment-shipping-api-model
  • vendor-direct-fulfillment-transactions-api-model
  • vendor-invoices-api-model
  • vendor-orders-api-model
  • vendor-shipments-api-model
  • vendor-transaction-status-api-model

I would like to help with this, but I'm totally lost with client api generators. Maybe you could give some guidelines and I can try to add it.

FBAInventorySDK getInventorySummaries method not serializing boolean $details param as string

The FBAInventorySDK getInventorySummaries method has an optional boolean parameter $details with a default boolean false value. When serializing to string value for use in the API call the value becomes 0 or 1. The API call expects string values of true and false.

This following incorrect URI is created with the library:

https://sellingpartnerapi-na.amazon.com/fba/inventory/v1/summaries?details=1&granularityType=Marketplace&granularityId=ATVPDKIKX0DER&marketplaceIds=ATVPDKIKX0DER

The following is the expected URI:

https://sellingpartnerapi-na.amazon.com/fba/inventory/v1/summaries?details=true&granularityType=Marketplace&granularityId=ATVPDKIKX0DER&marketplaceIds=ATVPDKIKX0DER

The following response body is returned with a 400 error code:

{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "Invalid Input",
      "details": ""
    }
  ]
}

While this is not entirely helpful I was able to determine the cause thru trial and error, manually creating the variations on the URI.

I would suspect that the same is true of any calls that have boolean values as params.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.