jlevers / selling-partner-api

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

Missing model fields for the Shipping API on v6 #673

Closed bgarret closed 3 months ago

bgarret commented 5 months ago

Problem description:

Hello,

I'm implementing the Shipping V2 API and it looks like there are a few model fields missing while using the getTracking method :

Is there documentation on how to regenerate DTO classes? I'm open to fixing this, but I understood that the DTO classes are auto-generated and I couldn't find the process on how to do so.

Thanks again for all your work!

Error:

ErrorList

Warning: Unknown keys when deserializing into SellingPartnerApi\Seller\ShippingV2\Responses\ErrorList: errors

Fatal error: Uncaught ArgumentCountError: Too few arguments to function SellingPartnerApi\Seller\ShippingV2\Responses\ErrorList::__construct(), 0 passed in /var/www/vendor/highsidelabs/saloon-sdk-generator/src/Traits/Deserializes.php on line 74 and exactly 1 expected in /var/www/vendor/jlevers/selling-partner-api/src/Seller/ShippingV2/Responses/ErrorList.php:15

Event and TrackingSummary

Warning: Unknown keys when deserializing into SellingPartnerApi\Seller\ShippingV2\Dto\Event: shipmentType
Warning: Unknown keys when deserializing into SellingPartnerApi\Seller\ShippingV2\Dto\TrackingSummary: trackingDetailCodes

Code

try {
    /** @var ShippingV2\Responses\GetTrackingResponse $response */
    $response = $api->getTracking($tracking, "AMZN_FR")->dto();
} catch (\Saloon\Exceptions\Request\ClientException $e) {
    $e->getResponse()->dto();
    var_dump($e->__toString());
}
jlevers commented 3 months ago

Thanks for the offer to contribute! I didn't have good instructions until just now – they're in CONTRIBUTING.md. That said, these issues are fixed and will be released in v7 soon :)

bgarret commented 3 months ago

Thanks for your work, it's very very cool that you opened the development process. I skimmed the contribution docs and made a few changes in #730 , to hopefully make it clearer.

I saw you bumped the minimum version to PHP 8.2, is this a hard requirement? PHP 8.1 is still on security support until 31 Dec 2025, we haven't migrated to a newer version yet, this would prevent us from upgrading :disappointed:

jlevers commented 3 months ago

Released in v7.0.0.

Re: the PHP 8.2 situation – it would take a lot of dependency juggling (including on highsidelabs/saloon-sdk-generator) to get this library fully PHP 8.1 compatible. If you want to submit PRs to that repo and to this one that gets things working with PHP 8.1 I'm happy to review them, but I think I'm unlikely to do that myself anytime soon.