fix(formating)
This commit is contained in:
@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define the request to register a CashLink QR Code.">
|
||||
@@ -46,6 +47,14 @@ class RegCashQrRequest extends Request implements HasBody
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
|
||||
// <BELIEF_STATE "Casting the response to a `RegCashQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code registration.">
|
||||
public function createDtoFromResponse(Response $response): RegCashQrResponseData
|
||||
{
|
||||
return RegCashQrResponseData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
|
||||
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields from the DTO are mapped, including conditional parameters for media type, dimensions, redirect URL, and QR Code ID.">
|
||||
protected function defaultBody(): array
|
||||
@@ -55,21 +64,23 @@ class RegCashQrRequest extends Request implements HasBody
|
||||
'TermNo' => $this->data->TermNo,
|
||||
];
|
||||
|
||||
if ($this->data->mediaType !== null) $body['mediaType'] = $this->data->mediaType;
|
||||
if ($this->data->width !== null) $body['width'] = $this->data->width;
|
||||
if ($this->data->height !== null) $body['height'] = $this->data->height;
|
||||
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
|
||||
if ($this->data->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
|
||||
if ($this->data->mediaType !== null) {
|
||||
$body['mediaType'] = $this->data->mediaType;
|
||||
}
|
||||
if ($this->data->width !== null) {
|
||||
$body['width'] = $this->data->width;
|
||||
}
|
||||
if ($this->data->height !== null) {
|
||||
$body['height'] = $this->data->height;
|
||||
}
|
||||
if ($this->data->redirectUrl !== null) {
|
||||
$body['redirectUrl'] = $this->data->redirectUrl;
|
||||
}
|
||||
if ($this->data->qrcId !== null) {
|
||||
$body['qrcId'] = $this->data->qrcId;
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
|
||||
// <BELIEF_STATE "Casting the response to a `RegCashQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code registration.">
|
||||
public function createDtoFromResponse(Response $response): RegCashQrResponseData
|
||||
{
|
||||
return RegCashQrResponseData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user