diff --git a/src/DataTransferObjects/Schemas/FulfillmentInbound/PartneredSmallParcelPackageOutputSchema.php b/src/DataTransferObjects/Schemas/FulfillmentInbound/PartneredSmallParcelPackageOutputSchema.php index bde5db28..4ecab71f 100644 --- a/src/DataTransferObjects/Schemas/FulfillmentInbound/PartneredSmallParcelPackageOutputSchema.php +++ b/src/DataTransferObjects/Schemas/FulfillmentInbound/PartneredSmallParcelPackageOutputSchema.php @@ -16,7 +16,7 @@ class PartneredSmallParcelPackageOutputSchema extends DataTransferObject public string $carrier_name; - public string $tracking_id; + public ?string $tracking_id; #[StringEnumValidator(AmazonEnums::PACKAGE_STATUSES)] public string $package_status; diff --git a/tests/Unit/Resources/FulfillmentInboundResourceTest.php b/tests/Unit/Resources/FulfillmentInboundResourceTest.php index 4ad12404..8a128596 100644 --- a/tests/Unit/Resources/FulfillmentInboundResourceTest.php +++ b/tests/Unit/Resources/FulfillmentInboundResourceTest.php @@ -263,6 +263,26 @@ public function testGetTransportDetails_Issue3_CarrierNameNull() }); } + public function testGetTransportDetails_Issue6_TrackingIDNull() + { + list($config, $http) = $this->setupConfigWithFakeHttp('fulfillment-inbound/issues/issue-6-tracking-id-null'); + + $shipment_id = Str::random(); + + $amzn = new AmznSPA($config); + $amzn = $amzn->usingMarketplace('ATVPDKIKX0DER'); + $response = $amzn->fulfillment_inbound->getTransportDetails($shipment_id); + + $this->assertInstanceOf(GetTransportDetailsResponse::class, $response); + + $http->assertSent(function (Request $request) use ($shipment_id) { + $this->assertEquals('GET', $request->method()); + $this->assertEquals('https://sellingpartnerapi-na.amazon.com/fba/inbound/v0/shipments/'.$shipment_id.'/transport', urldecode($request->url())); + + return true; + }); + } + public function testPutTransportDetails() { list($config, $http) = $this->setupConfigWithFakeHttp('fulfillment-inbound/put-transport-details'); diff --git a/tests/stubs/fulfillment-inbound/issues/issue-6-tracking-id-null.json b/tests/stubs/fulfillment-inbound/issues/issue-6-tracking-id-null.json new file mode 100644 index 00000000..5f84af96 --- /dev/null +++ b/tests/stubs/fulfillment-inbound/issues/issue-6-tracking-id-null.json @@ -0,0 +1,35 @@ +{ + "payload": { + "TransportContent": { + "TransportHeader": { + "SellerId": "AABBCC", + "ShipmentId": "FBAAABBCC", + "IsPartnered": true, + "ShipmentType": "SP" + }, + "TransportDetails": { + "PartneredSmallParcelData": { + "PackageList": [ + { + "Dimensions": { + "Length": "5", + "Width": "5", + "Height": "5", + "Unit": "CM" + }, + "Weight": { + "Value": "5", + "Unit": "kilograms" + }, + "CarrierName": "UNITED_PARCEL_SERVICE_INC", + "PackageStatus": "SHIPPED" + } + ] + } + }, + "TransportResult": { + "TransportStatus": "ERROR_ON_ESTIMATING" + } + } + } +} \ No newline at end of file