fix(formating)
This commit is contained in:
@@ -7,6 +7,7 @@ declare(strict_types=1);
|
||||
// INPUTS: Account number, expiration date, and a collection of digest signatures.
|
||||
// OUTPUTS: DealData (DTO) of the newly created deal.
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Deals;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import DTOs and Saloon components for a JSON body request.">
|
||||
@@ -20,6 +21,7 @@ use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define the request to create a new deal.">
|
||||
@@ -54,6 +56,14 @@ class AddDealRequest extends Request implements HasBody
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DealData DTO.">
|
||||
// <BELIEF_STATE "The API returns the newly created deal object. Casting it to a DTO provides a clean, type-safe object for the user.">
|
||||
public function createDtoFromResponse(Response $response): DealData
|
||||
{
|
||||
return DealData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
|
||||
// <BELIEF_STATE "This method maps the constructor properties to the expected JSON payload structure. The `toArray()` call on the data collection handles its serialization.">
|
||||
protected function defaultBody(): array
|
||||
@@ -65,12 +75,4 @@ class AddDealRequest extends Request implements HasBody
|
||||
];
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DealData DTO.">
|
||||
// <BELIEF_STATE "The API returns the newly created deal object. Casting it to a DTO provides a clean, type-safe object for the user.">
|
||||
public function createDtoFromResponse(Response $response): DealData
|
||||
{
|
||||
return DealData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user