selling-partner-api icon indicating copy to clipboard operation
selling-partner-api copied to clipboard

`FBAInboundV0:` Calling `->dto()` on `getShipments` response throws `Argument #4 ($stateOrProvinceCode) not passed` exception

Open xHadie opened this issue 1 year ago • 0 comments

Problem description:

When calling the dto() function on the response of the FBAInboundV0 method, the error given below is thrown. ->json() works.

Error:

# Your error here. PLEASE make sure to redact secrets from your error log!
 ArgumentCountError 

  SellingPartnerApi\Seller\FBAInboundV0\Dto\Address::__construct(): Argument #4 ($stateOrProvinceCode) not passed

  at vendor/jlevers/selling-partner-api/src/Seller/FBAInboundV0/Dto/Address.php:34
     30▕      * If postal codes are used in your marketplace, we recommended that you include one with your request. This helps Amazon select the most appropriate Amazon fulfillment center for the inbound shipment plan.
     31▕      * @param  ?string  $addressLine2  Additional street address information, if required.
     32▕      * @param  ?string  $districtOrCounty  The district or county.
     33▕      */
  ➜  34▕     public function __construct(
     35▕         public readonly string $name,
     36▕         public readonly string $addressLine1,
     37▕         public readonly string $city,
     38▕         public readonly string $stateOrProvinceCode,

Code

// Your code here...PLEASE make sure to redact secrets from your code!
$response = $this->service->getFBAInboundApi()->getShipments(self::QUERY_TYPE, $marketplace, null, $unclosedShipmentIds)->dto();

xHadie avatar May 01 '24 12:05 xHadie