forked from apoloz/alfa-bank-sdk
fix(formating)
This commit is contained in:
@@ -18,6 +18,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 activate a CashLink QR Code.">
|
||||
@@ -45,6 +46,14 @@ class ActivateCashQrRequest extends Request implements HasBody
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
|
||||
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
|
||||
public function createDtoFromResponse(Response $response): array
|
||||
{
|
||||
return $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 order number, payment purpose, QR TTL, and notification URLs.">
|
||||
protected function defaultBody(): array
|
||||
@@ -57,10 +66,18 @@ class ActivateCashQrRequest extends Request implements HasBody
|
||||
'currency' => $this->data->currency,
|
||||
];
|
||||
|
||||
if ($this->data->OrderNumber !== null) $body['OrderNumber'] = $this->data->OrderNumber;
|
||||
if ($this->data->paymentPurpose !== null) $body['paymentPurpose'] = $this->data->paymentPurpose;
|
||||
if ($this->data->qrTtl !== null) $body['qrTtl'] = $this->data->qrTtl;
|
||||
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
|
||||
if ($this->data->OrderNumber !== null) {
|
||||
$body['OrderNumber'] = $this->data->OrderNumber;
|
||||
}
|
||||
if ($this->data->paymentPurpose !== null) {
|
||||
$body['paymentPurpose'] = $this->data->paymentPurpose;
|
||||
}
|
||||
if ($this->data->qrTtl !== null) {
|
||||
$body['qrTtl'] = $this->data->qrTtl;
|
||||
}
|
||||
if ($this->data->redirectUrl !== null) {
|
||||
$body['redirectUrl'] = $this->data->redirectUrl;
|
||||
}
|
||||
if ($this->data->notificationUrl !== null) {
|
||||
$body['queryData'] = ['notificationUrl' => $this->data->notificationUrl];
|
||||
}
|
||||
@@ -68,12 +85,4 @@ class ActivateCashQrRequest extends Request implements HasBody
|
||||
return $body;
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
|
||||
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
|
||||
public function createDtoFromResponse(Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user