forked from apoloz/alfa-bank-sdk
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 88760ed127 | |||
|
|
be2aa4b8d3 | ||
| da3ea113ef |
@@ -4,17 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Payouts;
|
||||
|
||||
use Apoloz\AlfaBank\Data\Shared\ResultResponseData;
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\PayoffResponseData;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class PayoffAcceptRequest extends Request implements HasBody
|
||||
class PayoffAcceptRequest extends Request
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::PATCH;
|
||||
|
||||
public function __construct(
|
||||
@@ -24,18 +20,13 @@ class PayoffAcceptRequest extends Request implements HasBody
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return "/api/na/jp/v1/payoffs/{$this->payoffId}/accept";
|
||||
$query = http_build_query(['accept' => $this->accept ? 'true' : 'false']);
|
||||
|
||||
return "/api/na/jp/v1/payoffs/{$this->payoffId}/accept?{$query}";
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): ResultResponseData
|
||||
public function createDtoFromResponse(Response $response): PayoffResponseData
|
||||
{
|
||||
return ResultResponseData::from($response->json());
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
return [
|
||||
'accept' => $this->accept,
|
||||
];
|
||||
return PayoffResponseData::from($response->json());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
|
||||
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
|
||||
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides DTO benefits.">
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\Attributes\MapName;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
@@ -36,6 +37,7 @@ class GetQrcReversalDataResponseData extends Data
|
||||
public ?string $qrcId = null,
|
||||
public ?string $trxDT = null,
|
||||
public ?string $trxId = null,
|
||||
#[MapName('RestAmount')]
|
||||
public ?string $restAmount = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
|
||||
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
|
||||
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides DTO benefits.">
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\Attributes\MapName;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
@@ -33,6 +34,7 @@ class QrcReversalResponseData extends Data
|
||||
public ?string $trxDT = null,
|
||||
public ?string $trxId = null,
|
||||
public ?string $payrrn = null,
|
||||
#[MapName('RestAmount')]
|
||||
public ?string $restAmount = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
|
||||
Reference in New Issue
Block a user