diff --git a/resources/models/seller/orders/v0.json b/resources/models/seller/orders/v0.json index 258c18103..b9818568d 100644 --- a/resources/models/seller/orders/v0.json +++ b/resources/models/seller/orders/v0.json @@ -5232,4 +5232,4 @@ } }, "x-original-swagger-version": "2.0" -} +} \ No newline at end of file diff --git a/src/Generator/Generators/RequestGenerator.php b/src/Generator/Generators/RequestGenerator.php index 2ae0a8d90..851792f2a 100644 --- a/src/Generator/Generators/RequestGenerator.php +++ b/src/Generator/Generators/RequestGenerator.php @@ -37,8 +37,7 @@ protected function generateRequestClass(Endpoint $endpoint): PhpFile $classType->setExtends($baseRequestClass) ->setComment($endpoint->name); - // TODO: We assume JSON body if post/patch, make these assumptions configurable in the future. - if ($endpoint->method->isPost() || $endpoint->method->isPatch()) { + if ($endpoint->bodySchema?->bodyContentType === 'application/json' && ($endpoint->method->isPut() || $endpoint->method->isPost() || $endpoint->method->isPatch())) { $classType ->addImplement(HasBody::class) ->addTrait(HasJsonBody::class); diff --git a/src/Seller/APlusContentV20201101/Requests/PostContentDocumentApprovalSubmission.php b/src/Seller/APlusContentV20201101/Requests/PostContentDocumentApprovalSubmission.php index 47de354ad..af06e8118 100644 --- a/src/Seller/APlusContentV20201101/Requests/PostContentDocumentApprovalSubmission.php +++ b/src/Seller/APlusContentV20201101/Requests/PostContentDocumentApprovalSubmission.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\APlusContentV20201101\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\APlusContentV20201101\Responses\ErrorList; use SellingPartnerApi\Seller\APlusContentV20201101\Responses\PostContentDocumentApprovalSubmissionResponse; @@ -16,10 +14,8 @@ /** * postContentDocumentApprovalSubmission */ -class PostContentDocumentApprovalSubmission extends Request implements HasBody +class PostContentDocumentApprovalSubmission extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/APlusContentV20201101/Requests/PostContentDocumentSuspendSubmission.php b/src/Seller/APlusContentV20201101/Requests/PostContentDocumentSuspendSubmission.php index d338e8942..231177b21 100644 --- a/src/Seller/APlusContentV20201101/Requests/PostContentDocumentSuspendSubmission.php +++ b/src/Seller/APlusContentV20201101/Requests/PostContentDocumentSuspendSubmission.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\APlusContentV20201101\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\APlusContentV20201101\Responses\ErrorList; use SellingPartnerApi\Seller\APlusContentV20201101\Responses\PostContentDocumentSuspendSubmissionResponse; @@ -16,10 +14,8 @@ /** * postContentDocumentSuspendSubmission */ -class PostContentDocumentSuspendSubmission extends Request implements HasBody +class PostContentDocumentSuspendSubmission extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/ApplicationManagementV20231130/Requests/RotateApplicationClientSecret.php b/src/Seller/ApplicationManagementV20231130/Requests/RotateApplicationClientSecret.php index 7c75a1e33..1a2191668 100644 --- a/src/Seller/ApplicationManagementV20231130/Requests/RotateApplicationClientSecret.php +++ b/src/Seller/ApplicationManagementV20231130/Requests/RotateApplicationClientSecret.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\ApplicationManagementV20231130\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ApplicationManagementV20231130\Responses\ErrorList; @@ -16,10 +14,8 @@ /** * rotateApplicationClientSecret */ -class RotateApplicationClientSecret extends Request implements HasBody +class RotateApplicationClientSecret extends Request { - use HasJsonBody; - protected Method $method = Method::POST; public function resolveEndpoint(): string diff --git a/src/Seller/FBAInboundV0/Requests/ConfirmTransport.php b/src/Seller/FBAInboundV0/Requests/ConfirmTransport.php index 31a31e7f0..08f827edc 100644 --- a/src/Seller/FBAInboundV0/Requests/ConfirmTransport.php +++ b/src/Seller/FBAInboundV0/Requests/ConfirmTransport.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\FBAInboundV0\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV0\Responses\ConfirmTransportResponse; /** * confirmTransport */ -class ConfirmTransport extends Request implements HasBody +class ConfirmTransport extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV0/Requests/EstimateTransport.php b/src/Seller/FBAInboundV0/Requests/EstimateTransport.php index 8e5776440..836ebdfa3 100644 --- a/src/Seller/FBAInboundV0/Requests/EstimateTransport.php +++ b/src/Seller/FBAInboundV0/Requests/EstimateTransport.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\FBAInboundV0\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV0\Responses\EstimateTransportResponse; /** * estimateTransport */ -class EstimateTransport extends Request implements HasBody +class EstimateTransport extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV0/Requests/PutTransportDetails.php b/src/Seller/FBAInboundV0/Requests/PutTransportDetails.php index 65ea5c26b..39bb618a0 100644 --- a/src/Seller/FBAInboundV0/Requests/PutTransportDetails.php +++ b/src/Seller/FBAInboundV0/Requests/PutTransportDetails.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV0\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV0\Dto\PutTransportDetailsRequest; use SellingPartnerApi\Seller\FBAInboundV0\Responses\PutTransportDetailsResponse; @@ -14,8 +16,10 @@ /** * putTransportDetails */ -class PutTransportDetails extends Request +class PutTransportDetails extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV0/Requests/UpdateInboundShipment.php b/src/Seller/FBAInboundV0/Requests/UpdateInboundShipment.php index b86e2551b..27a3cda61 100644 --- a/src/Seller/FBAInboundV0/Requests/UpdateInboundShipment.php +++ b/src/Seller/FBAInboundV0/Requests/UpdateInboundShipment.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV0\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV0\Dto\InboundShipmentRequest; use SellingPartnerApi\Seller\FBAInboundV0\Responses\InboundShipmentResponse; @@ -14,8 +16,10 @@ /** * updateInboundShipment */ -class UpdateInboundShipment extends Request +class UpdateInboundShipment extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV0/Requests/VoidTransport.php b/src/Seller/FBAInboundV0/Requests/VoidTransport.php index dfae09607..58a9a16f3 100644 --- a/src/Seller/FBAInboundV0/Requests/VoidTransport.php +++ b/src/Seller/FBAInboundV0/Requests/VoidTransport.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\FBAInboundV0\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV0\Responses\VoidTransportResponse; /** * voidTransport */ -class VoidTransport extends Request implements HasBody +class VoidTransport extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/CancelSelfShipAppointment.php b/src/Seller/FBAInboundV20240320/Requests/CancelSelfShipAppointment.php index 7d00a5051..4b2b9ab3a 100644 --- a/src/Seller/FBAInboundV20240320/Requests/CancelSelfShipAppointment.php +++ b/src/Seller/FBAInboundV20240320/Requests/CancelSelfShipAppointment.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\CancelSelfShipAppointmentRequest; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\CancelSelfShipAppointmentResponse; @@ -15,8 +17,10 @@ /** * cancelSelfShipAppointment */ -class CancelSelfShipAppointment extends Request +class CancelSelfShipAppointment extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/ConfirmDeliveryWindowOptions.php b/src/Seller/FBAInboundV20240320/Requests/ConfirmDeliveryWindowOptions.php index 57806d5de..fa9c1260a 100644 --- a/src/Seller/FBAInboundV20240320/Requests/ConfirmDeliveryWindowOptions.php +++ b/src/Seller/FBAInboundV20240320/Requests/ConfirmDeliveryWindowOptions.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ConfirmDeliveryWindowOptionsResponse; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -16,10 +14,8 @@ /** * confirmDeliveryWindowOptions */ -class ConfirmDeliveryWindowOptions extends Request implements HasBody +class ConfirmDeliveryWindowOptions extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/ConfirmPackingOption.php b/src/Seller/FBAInboundV20240320/Requests/ConfirmPackingOption.php index bcbde6634..3a8b57236 100644 --- a/src/Seller/FBAInboundV20240320/Requests/ConfirmPackingOption.php +++ b/src/Seller/FBAInboundV20240320/Requests/ConfirmPackingOption.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ConfirmPackingOptionResponse; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -16,10 +14,8 @@ /** * confirmPackingOption */ -class ConfirmPackingOption extends Request implements HasBody +class ConfirmPackingOption extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/ConfirmPlacementOption.php b/src/Seller/FBAInboundV20240320/Requests/ConfirmPlacementOption.php index 084854b65..af5ce9658 100644 --- a/src/Seller/FBAInboundV20240320/Requests/ConfirmPlacementOption.php +++ b/src/Seller/FBAInboundV20240320/Requests/ConfirmPlacementOption.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ConfirmPlacementOptionResponse; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -16,10 +14,8 @@ /** * confirmPlacementOption */ -class ConfirmPlacementOption extends Request implements HasBody +class ConfirmPlacementOption extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/ConfirmShipmentContentUpdatePreview.php b/src/Seller/FBAInboundV20240320/Requests/ConfirmShipmentContentUpdatePreview.php index dcfba9720..496caa321 100644 --- a/src/Seller/FBAInboundV20240320/Requests/ConfirmShipmentContentUpdatePreview.php +++ b/src/Seller/FBAInboundV20240320/Requests/ConfirmShipmentContentUpdatePreview.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ConfirmShipmentContentUpdatePreviewResponse; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -16,10 +14,8 @@ /** * confirmShipmentContentUpdatePreview */ -class ConfirmShipmentContentUpdatePreview extends Request implements HasBody +class ConfirmShipmentContentUpdatePreview extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/GenerateDeliveryWindowOptions.php b/src/Seller/FBAInboundV20240320/Requests/GenerateDeliveryWindowOptions.php index 4de4ea647..5b53aae3e 100644 --- a/src/Seller/FBAInboundV20240320/Requests/GenerateDeliveryWindowOptions.php +++ b/src/Seller/FBAInboundV20240320/Requests/GenerateDeliveryWindowOptions.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\GenerateDeliveryWindowOptionsResponse; @@ -16,10 +14,8 @@ /** * generateDeliveryWindowOptions */ -class GenerateDeliveryWindowOptions extends Request implements HasBody +class GenerateDeliveryWindowOptions extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/GeneratePackingOptions.php b/src/Seller/FBAInboundV20240320/Requests/GeneratePackingOptions.php index defcd351d..354366a44 100644 --- a/src/Seller/FBAInboundV20240320/Requests/GeneratePackingOptions.php +++ b/src/Seller/FBAInboundV20240320/Requests/GeneratePackingOptions.php @@ -5,10 +5,8 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\GeneratePackingOptionsResponse; @@ -16,10 +14,8 @@ /** * generatePackingOptions */ -class GeneratePackingOptions extends Request implements HasBody +class GeneratePackingOptions extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/UpdateInboundPlanName.php b/src/Seller/FBAInboundV20240320/Requests/UpdateInboundPlanName.php index d882b573b..f4d464ec3 100644 --- a/src/Seller/FBAInboundV20240320/Requests/UpdateInboundPlanName.php +++ b/src/Seller/FBAInboundV20240320/Requests/UpdateInboundPlanName.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\UpdateInboundPlanNameRequest; @@ -15,8 +17,10 @@ /** * updateInboundPlanName */ -class UpdateInboundPlanName extends Request +class UpdateInboundPlanName extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/UpdateItemComplianceDetails.php b/src/Seller/FBAInboundV20240320/Requests/UpdateItemComplianceDetails.php index c5f9b426d..10ead10d9 100644 --- a/src/Seller/FBAInboundV20240320/Requests/UpdateItemComplianceDetails.php +++ b/src/Seller/FBAInboundV20240320/Requests/UpdateItemComplianceDetails.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\UpdateItemComplianceDetailsRequest; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -15,8 +17,10 @@ /** * updateItemComplianceDetails */ -class UpdateItemComplianceDetails extends Request +class UpdateItemComplianceDetails extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentName.php b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentName.php index be9df3b9b..34a243351 100644 --- a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentName.php +++ b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentName.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\UpdateShipmentNameRequest; @@ -15,8 +17,10 @@ /** * updateShipmentName */ -class UpdateShipmentName extends Request +class UpdateShipmentName extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentSourceAddress.php b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentSourceAddress.php index 83a549761..3e36f24b4 100644 --- a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentSourceAddress.php +++ b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentSourceAddress.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\UpdateShipmentSourceAddressRequest; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -15,8 +17,10 @@ /** * updateShipmentSourceAddress */ -class UpdateShipmentSourceAddress extends Request +class UpdateShipmentSourceAddress extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentTrackingDetails.php b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentTrackingDetails.php index ff33092aa..934d43c8f 100644 --- a/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentTrackingDetails.php +++ b/src/Seller/FBAInboundV20240320/Requests/UpdateShipmentTrackingDetails.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAInboundV20240320\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAInboundV20240320\Dto\UpdateShipmentTrackingDetailsRequest; use SellingPartnerApi\Seller\FBAInboundV20240320\Responses\ErrorList; @@ -15,8 +17,10 @@ /** * updateShipmentTrackingDetails */ -class UpdateShipmentTrackingDetails extends Request +class UpdateShipmentTrackingDetails extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAOutboundV20200701/Requests/CreateFulfillmentReturn.php b/src/Seller/FBAOutboundV20200701/Requests/CreateFulfillmentReturn.php index 72a9c1de6..9b6a2a312 100644 --- a/src/Seller/FBAOutboundV20200701/Requests/CreateFulfillmentReturn.php +++ b/src/Seller/FBAOutboundV20200701/Requests/CreateFulfillmentReturn.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAOutboundV20200701\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\CreateFulfillmentReturnRequest; use SellingPartnerApi\Seller\FBAOutboundV20200701\Responses\CreateFulfillmentReturnResponse; @@ -14,8 +16,10 @@ /** * createFulfillmentReturn */ -class CreateFulfillmentReturn extends Request +class CreateFulfillmentReturn extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAOutboundV20200701/Requests/SubmitFulfillmentOrderStatusUpdate.php b/src/Seller/FBAOutboundV20200701/Requests/SubmitFulfillmentOrderStatusUpdate.php index 7819eff69..3f982fd98 100644 --- a/src/Seller/FBAOutboundV20200701/Requests/SubmitFulfillmentOrderStatusUpdate.php +++ b/src/Seller/FBAOutboundV20200701/Requests/SubmitFulfillmentOrderStatusUpdate.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAOutboundV20200701\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\SubmitFulfillmentOrderStatusUpdateRequest; use SellingPartnerApi\Seller\FBAOutboundV20200701\Responses\SubmitFulfillmentOrderStatusUpdateResponse; @@ -14,8 +16,10 @@ /** * submitFulfillmentOrderStatusUpdate */ -class SubmitFulfillmentOrderStatusUpdate extends Request +class SubmitFulfillmentOrderStatusUpdate extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/FBAOutboundV20200701/Requests/UpdateFulfillmentOrder.php b/src/Seller/FBAOutboundV20200701/Requests/UpdateFulfillmentOrder.php index 1c7622262..20d5e763f 100644 --- a/src/Seller/FBAOutboundV20200701/Requests/UpdateFulfillmentOrder.php +++ b/src/Seller/FBAOutboundV20200701/Requests/UpdateFulfillmentOrder.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\FBAOutboundV20200701\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\FBAOutboundV20200701\Dto\UpdateFulfillmentOrderRequest; use SellingPartnerApi\Seller\FBAOutboundV20200701\Responses\UpdateFulfillmentOrderResponse; @@ -14,8 +16,10 @@ /** * updateFulfillmentOrder */ -class UpdateFulfillmentOrder extends Request +class UpdateFulfillmentOrder extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ListingsItemsV20200901/Requests/PutListingsItem.php b/src/Seller/ListingsItemsV20200901/Requests/PutListingsItem.php index 5a78cb4d9..22959a6ff 100644 --- a/src/Seller/ListingsItemsV20200901/Requests/PutListingsItem.php +++ b/src/Seller/ListingsItemsV20200901/Requests/PutListingsItem.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ListingsItemsV20200901\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ListingsItemsV20200901\Dto\ListingsItemPutRequest; use SellingPartnerApi\Seller\ListingsItemsV20200901\Responses\ErrorList; @@ -15,8 +17,10 @@ /** * putListingsItem */ -class PutListingsItem extends Request +class PutListingsItem extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ListingsItemsV20210801/Requests/PutListingsItem.php b/src/Seller/ListingsItemsV20210801/Requests/PutListingsItem.php index bbf3129ba..c6f7220fe 100644 --- a/src/Seller/ListingsItemsV20210801/Requests/PutListingsItem.php +++ b/src/Seller/ListingsItemsV20210801/Requests/PutListingsItem.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ListingsItemsV20210801\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ListingsItemsV20210801\Dto\ListingsItemPutRequest; use SellingPartnerApi\Seller\ListingsItemsV20210801\Responses\ErrorList; @@ -15,8 +17,10 @@ /** * putListingsItem */ -class PutListingsItem extends Request +class PutListingsItem extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/MessagingV1/Requests/CreateNegativeFeedbackRemoval.php b/src/Seller/MessagingV1/Requests/CreateNegativeFeedbackRemoval.php index 2afd02b77..f9fbcb221 100644 --- a/src/Seller/MessagingV1/Requests/CreateNegativeFeedbackRemoval.php +++ b/src/Seller/MessagingV1/Requests/CreateNegativeFeedbackRemoval.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\MessagingV1\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\MessagingV1\Responses\CreateNegativeFeedbackRemovalResponse; /** * createNegativeFeedbackRemoval */ -class CreateNegativeFeedbackRemoval extends Request implements HasBody +class CreateNegativeFeedbackRemoval extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/ServicesV1/Requests/AssignAppointmentResources.php b/src/Seller/ServicesV1/Requests/AssignAppointmentResources.php index b3cb51c5d..349f004d7 100644 --- a/src/Seller/ServicesV1/Requests/AssignAppointmentResources.php +++ b/src/Seller/ServicesV1/Requests/AssignAppointmentResources.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ServicesV1\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ServicesV1\Dto\AssignAppointmentResourcesRequest; use SellingPartnerApi\Seller\ServicesV1\Responses\AssignAppointmentResourcesResponse; @@ -14,8 +16,10 @@ /** * assignAppointmentResources */ -class AssignAppointmentResources extends Request +class AssignAppointmentResources extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ServicesV1/Requests/SetAppointmentFulfillmentData.php b/src/Seller/ServicesV1/Requests/SetAppointmentFulfillmentData.php index 2ca3088cf..83cf7d78f 100644 --- a/src/Seller/ServicesV1/Requests/SetAppointmentFulfillmentData.php +++ b/src/Seller/ServicesV1/Requests/SetAppointmentFulfillmentData.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ServicesV1\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ServicesV1\Dto\SetAppointmentFulfillmentDataRequest; @@ -15,8 +17,10 @@ /** * setAppointmentFulfillmentData */ -class SetAppointmentFulfillmentData extends Request +class SetAppointmentFulfillmentData extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ServicesV1/Requests/UpdateReservation.php b/src/Seller/ServicesV1/Requests/UpdateReservation.php index adba244b8..db0ac3922 100644 --- a/src/Seller/ServicesV1/Requests/UpdateReservation.php +++ b/src/Seller/ServicesV1/Requests/UpdateReservation.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ServicesV1\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ServicesV1\Dto\UpdateReservationRequest; use SellingPartnerApi\Seller\ServicesV1\Responses\UpdateReservationResponse; @@ -14,8 +16,10 @@ /** * updateReservation */ -class UpdateReservation extends Request +class UpdateReservation extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ServicesV1/Requests/UpdateSchedule.php b/src/Seller/ServicesV1/Requests/UpdateSchedule.php index ed499eb80..79fdb0e0b 100644 --- a/src/Seller/ServicesV1/Requests/UpdateSchedule.php +++ b/src/Seller/ServicesV1/Requests/UpdateSchedule.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\ServicesV1\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ServicesV1\Dto\UpdateScheduleRequest; use SellingPartnerApi\Seller\ServicesV1\Responses\UpdateScheduleResponse; @@ -14,8 +16,10 @@ /** * updateSchedule */ -class UpdateSchedule extends Request +class UpdateSchedule extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/ShippingV1/Requests/CancelShipment.php b/src/Seller/ShippingV1/Requests/CancelShipment.php index 053cc0ad6..5114a119d 100644 --- a/src/Seller/ShippingV1/Requests/CancelShipment.php +++ b/src/Seller/ShippingV1/Requests/CancelShipment.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\ShippingV1\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\ShippingV1\Responses\CancelShipmentResponse; /** * cancelShipment */ -class CancelShipment extends Request implements HasBody +class CancelShipment extends Request { - use HasJsonBody; - protected Method $method = Method::POST; public function __construct( diff --git a/src/Seller/SolicitationsV1/Requests/CreateProductReviewAndSellerFeedbackSolicitation.php b/src/Seller/SolicitationsV1/Requests/CreateProductReviewAndSellerFeedbackSolicitation.php index 7a2403da2..85b91c86e 100644 --- a/src/Seller/SolicitationsV1/Requests/CreateProductReviewAndSellerFeedbackSolicitation.php +++ b/src/Seller/SolicitationsV1/Requests/CreateProductReviewAndSellerFeedbackSolicitation.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\SolicitationsV1\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\SolicitationsV1\Responses\CreateProductReviewAndSellerFeedbackSolicitationResponse; /** * createProductReviewAndSellerFeedbackSolicitation */ -class CreateProductReviewAndSellerFeedbackSolicitation extends Request implements HasBody +class CreateProductReviewAndSellerFeedbackSolicitation extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySource.php b/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySource.php index 9a1c18012..407acd32b 100644 --- a/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySource.php +++ b/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySource.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\SupplySourcesV20200701\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\SupplySourcesV20200701\Dto\UpdateSupplySourceRequest; @@ -15,8 +17,10 @@ /** * updateSupplySource */ -class UpdateSupplySource extends Request +class UpdateSupplySource extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySourceStatus.php b/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySourceStatus.php index a43c39581..c3188fb7a 100644 --- a/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySourceStatus.php +++ b/src/Seller/SupplySourcesV20200701/Requests/UpdateSupplySourceStatus.php @@ -5,8 +5,10 @@ namespace SellingPartnerApi\Seller\SupplySourcesV20200701\Requests; use Exception; +use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; +use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\EmptyResponse; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\SupplySourcesV20200701\Dto\UpdateSupplySourceStatusRequest; @@ -15,8 +17,10 @@ /** * updateSupplySourceStatus */ -class UpdateSupplySourceStatus extends Request +class UpdateSupplySourceStatus extends Request implements HasBody { + use HasJsonBody; + protected Method $method = Method::PUT; /** diff --git a/src/Seller/UploadsV20201101/Requests/CreateUploadDestinationForResource.php b/src/Seller/UploadsV20201101/Requests/CreateUploadDestinationForResource.php index bd0ca8136..dea4d1750 100644 --- a/src/Seller/UploadsV20201101/Requests/CreateUploadDestinationForResource.php +++ b/src/Seller/UploadsV20201101/Requests/CreateUploadDestinationForResource.php @@ -5,20 +5,16 @@ namespace SellingPartnerApi\Seller\UploadsV20201101\Requests; use Exception; -use Saloon\Contracts\Body\HasBody; use Saloon\Enums\Method; use Saloon\Http\Response; -use Saloon\Traits\Body\HasJsonBody; use SellingPartnerApi\Request; use SellingPartnerApi\Seller\UploadsV20201101\Responses\CreateUploadDestinationResponse; /** * createUploadDestinationForResource */ -class CreateUploadDestinationForResource extends Request implements HasBody +class CreateUploadDestinationForResource extends Request { - use HasJsonBody; - protected Method $method = Method::POST; /** diff --git a/tests/Seller/FBAInboundV0/Requests/UpdateInboundShipmentTest.php b/tests/Seller/FBAInboundV0/Requests/UpdateInboundShipmentTest.php new file mode 100644 index 000000000..8d9949f3d --- /dev/null +++ b/tests/Seller/FBAInboundV0/Requests/UpdateInboundShipmentTest.php @@ -0,0 +1,103 @@ + fn () => MockResponse::make([ + 'access_token' => 'access-token', + 'token_type' => 'bearer', + 'expires_in' => 3600, + 'refresh_token' => 'refresh-token', + ]), + '/fba/inbound/v0/shipments/*' => function (PendingRequest $pendingRequest) { + $this->assertSame(Method::PUT, $pendingRequest->getMethod()); + $this->assertSame($pendingRequest->getUri()->getPath(), '/fba/inbound/v0/shipments/123456'); + $this->assertSame($pendingRequest->headers()->get('Content-Type'), 'application/json'); + $this->assertTrue($pendingRequest->body()?->isNotEmpty()); + + return MockResponse::make( + body: [ + 'payload' => [ + 'ShipmentId' => 'FBA15DJCQ1ZF', + ], + ], + headers: ['Content-Type' => 'application/json'], + ); + }, + ]); + + $connector = SellingPartnerApi::seller( + clientId: 'client-id', + clientSecret: 'client-secret', + refreshToken: 'refresh-token', + endpoint: Endpoint::NA_SANDBOX, + ); + $connector->withMockClient($mockClient); + + $dto = $connector->fbaInboundV0()->updateInboundShipment(123456, new InboundShipmentRequest( + inboundShipmentHeader: new InboundShipmentHeader( + shipmentName: 'shipment-name', + shipFromAddress: new Address( + name: 'name', + addressLine1: 'address-line-1', + city: 'city', + stateOrProvinceCode: 'state-or-province-code', + countryCode: 'country-code', + postalCode: 'postal-code', + ), + destinationFulfillmentCenterId: 'destination-fulfillment-center-id', + shipmentStatus: 'WORKING', + labelPrepPreference: 'SELLER_LABEL', + ), + inboundShipmentItems: [ + new InboundShipmentItem( + sellerSku: 'seller-sku', + quantityShipped: 1, + shipmentId: 'shipment-id', + quantityReceived: 1, + quantityInCase: 1, + releaseDate: new DateTime(), + prepDetailsList: [ + new PrepDetails( + prepInstruction: 'prep-instruction', + prepOwner: 'prep-owner', + ), + ], + ), + ], + marketplaceId: 'marketplace-id', + ))->dtoOrFail(); + + $this->assertInstanceOf(InboundShipmentResponse::class, $dto); + $this->assertSame('FBA15DJCQ1ZF', $dto->payload->shipmentId); + $mockClient->assertSent(UpdateInboundShipment::class); + } +}