Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| RejectFundCashflowRequestAction | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __invoke | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Action\Admin; |
| 6 | |
| 7 | use App\Domain\Funds\Service\FundCashflowRequestAdminService; |
| 8 | use App\Renderer\JsonRenderer; |
| 9 | use Psr\Http\Message\ResponseInterface; |
| 10 | use Psr\Http\Message\ServerRequestInterface; |
| 11 | |
| 12 | final readonly class RejectFundCashflowRequestAction |
| 13 | { |
| 14 | public function __construct( |
| 15 | private FundCashflowRequestAdminService $service, |
| 16 | private JsonRenderer $renderer, |
| 17 | ) {} |
| 18 | |
| 19 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $args): ResponseInterface |
| 20 | { |
| 21 | $requestId = $args['id'] ?? ''; |
| 22 | $body = (array)$request->getParsedBody(); |
| 23 | $reason = isset($body['reason']) && $body['reason'] !== '' ? (string)$body['reason'] : null; |
| 24 | |
| 25 | $updated = $this->service->rejectRequest($requestId, $reason); |
| 26 | |
| 27 | return $this->renderer->json($response, [ |
| 28 | 'success' => true, |
| 29 | 'message' => 'Fund cashflow request rejected', |
| 30 | 'data' => $updated->toArray(), |
| 31 | ]); |
| 32 | } |
| 33 | } |