Skip to content

Commit 9a2344e

Browse files
committed
Make GetFulfillmentOrder response error an array of Error DTOs (#872)
1 parent 09db0d2 commit 9a2344e

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

resources/metadata/modifications.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848
"status",
4949
"statusChangedDate"
5050
]
51+
},
52+
{
53+
"comment": "Error Response from Amazon for GetFulfillmentOrder is an array",
54+
"action": "replace",
55+
"path": "components.schemas.GetFulfillmentOrderResponse.properties.errors",
56+
"value": {
57+
"type": "array",
58+
"description": "A list of error responses returned when a request is unsuccessful.",
59+
"items": {
60+
"$ref": "#/components/schemas/Error"
61+
}
62+
}
5163
}
5264
]
5365
},
@@ -179,12 +191,12 @@
179191
}
180192
},
181193
{
182-
"comment": "Remove unneded objects from ErrorList",
194+
"comment": "Remove unneeded objects from ErrorList",
183195
"action": "delete",
184196
"path": "components.schemas.ErrorList.properties"
185197
},
186198
{
187-
"comment": "Remove unneded objects from ErrorList",
199+
"comment": "Remove unneeded objects from ErrorList",
188200
"action": "delete",
189201
"path": "components.schemas.ErrorList.required"
190202
}

resources/models/seller/fba-outbound/v2020-07-01.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3823,7 +3823,11 @@
38233823
"$ref": "#/components/schemas/GetFulfillmentOrderResult"
38243824
},
38253825
"errors": {
3826-
"$ref": "#/components/schemas/ErrorList"
3826+
"type": "array",
3827+
"description": "A list of error responses returned when a request is unsuccessful.",
3828+
"items": {
3829+
"$ref": "#/components/schemas/Error"
3830+
}
38273831
}
38283832
},
38293833
"description": "The response schema for the `getFulfillmentOrder` operation."

src/Seller/FBAOutboundV20200701/Responses/GetFulfillmentOrderResponse.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
namespace SellingPartnerApi\Seller\FBAOutboundV20200701\Responses;
1212

1313
use SellingPartnerApi\Response;
14-
use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\ErrorList;
14+
use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\Error;
1515
use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\GetFulfillmentOrderResult;
1616

1717
final class GetFulfillmentOrderResponse extends Response
1818
{
19+
protected static array $complexArrayTypes = ['errors' => Error::class];
20+
1921
/**
2022
* @param ?GetFulfillmentOrderResult $payload The request for the getFulfillmentOrder operation.
21-
* @param ?ErrorList $errors A list of error responses returned when a request is unsuccessful.
23+
* @param Error[]|null $errors A list of error responses returned when a request is unsuccessful.
2224
*/
2325
public function __construct(
2426
public readonly ?GetFulfillmentOrderResult $payload = null,
25-
public readonly ?ErrorList $errors = null,
27+
public readonly ?array $errors = null,
2628
) {}
2729
}

tests/Seller/OrdersV0/Responses/GetOrdersTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ public function test_deserialize_string_boolean(): void
2323
'ShipServiceLevel' => 'Std US D2D Dom',
2424
'OrderTotal' => [
2525
'CurrencyCode' => 'USD',
26-
'Amount' => '11.01'
26+
'Amount' => '11.01',
2727
],
2828
'NumberOfItemsShipped' => 0,
2929
'NumberOfItemsUnshipped' => 1,
3030
'PaymentMethod' => 'Other',
3131
'PaymentMethodDetails' => [
32-
'Standard'
32+
'Standard',
3333
],
3434
'IsReplacementOrder' => 'false',
3535
'MarketplaceId' => 'ATVPDKIKX0DER',
@@ -53,21 +53,21 @@ public function test_deserialize_string_boolean(): void
5353
'PostalCode' => '98121-2778',
5454
'CountryCode' => 'US',
5555
'Phone' => '+1 480-386-0930 ext. 73824',
56-
'AddressType' => 'Commercial'
56+
'AddressType' => 'Commercial',
5757
],
5858
'FulfillmentInstruction' => [
59-
'FulfillmentSupplySourceId' => 'sampleSupplySourceId'
59+
'FulfillmentSupplySourceId' => 'sampleSupplySourceId',
6060
],
6161
'IsISPU' => false,
6262
'IsAccessPointOrder' => false,
6363
'AutomatedShippingSettings' => [
64-
'HasAutomatedShippingSettings' => false
64+
'HasAutomatedShippingSettings' => false,
6565
],
6666
'EasyShipShipmentStatus' => 'PendingPickUp',
67-
'ElectronicInvoiceStatus' => 'NotRequired'
68-
]
69-
]
70-
]
67+
'ElectronicInvoiceStatus' => 'NotRequired',
68+
],
69+
],
70+
],
7171
]);
7272

7373
$this->assertEquals($result->payload->orders[0]->isReplacementOrder, false);

0 commit comments

Comments
 (0)