forked from apoloz/alfa-bank-sdk
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Represents the API call to perform an action on a deal contractor.
|
|
// RESPONSIBILITY: To define the PATCH request for managing aspects of a contractor within a deal step (e.g., adding funds, setting requisites).
|
|
// INPUTS: ContractorActionRequestData DTO.
|
|
// OUTPUTS: No specific DTO, typically a 200 OK or 202 Accepted status.
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Deals\Steps;
|
|
|
|
// <SECTION name="module_imports" intent="Import DTO and Saloon components for a JSON body request.">
|
|
// <BELIEF_STATE "This PATCH request requires the `ContractorActionRequestData` DTO for its JSON body and Saloon's body-handling traits.">
|
|
use Apoloz\AlfaBank\Data\Shared\GeneralStatusData;
|
|
use Saloon\Contracts\Body\HasBody;
|
|
use Saloon\Enums\Method;
|
|
use Saloon\Http\Request;
|
|
use Saloon\Http\Response;
|
|
use Saloon\Traits\Body\HasJsonBody;
|
|
|
|
class ManageContractorRequest extends Request implements HasBody
|
|
{
|
|
use HasJsonBody;
|
|
|
|
protected Method $method = Method::POST;
|
|
|
|
public function __construct(
|
|
protected string $dealId,
|
|
protected string $stepId,
|
|
protected array $data
|
|
) {}
|
|
|
|
public function resolveEndpoint(): string
|
|
{
|
|
return "/api/na/jp/v1/deals/{$this->dealId}/steps/{$this->stepId}/contractors";
|
|
}
|
|
|
|
public function createDtoFromResponse(Response $response): GeneralStatusData
|
|
{
|
|
return GeneralStatusData::from(['success' => $response->successful()]);
|
|
}
|
|
|
|
protected function defaultBody(): array
|
|
{
|
|
return $this->data;
|
|
}
|
|
}
|