Skip to content

Commit

Permalink
Fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbrink committed Oct 11, 2021
1 parent f81a408 commit a28a253
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions tests/Unit/Resources/FulfillmentInboundResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}

0 comments on commit a28a253

Please sign in to comment.