add controllers, servoices
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Finance;
|
||||
|
||||
use App\Http\Controllers\Api\BaseApiController;
|
||||
use App\Http\Requests\Payments\PaymentNotificationListRequest;
|
||||
use App\Http\Requests\Payments\PaymentNotificationSendRequest;
|
||||
use App\Http\Resources\Payments\PaymentNotificationLogResource;
|
||||
use App\Services\Payments\PaymentNotificationService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class PaymentNotificationController extends BaseApiController
|
||||
{
|
||||
public function __construct(private PaymentNotificationService $service)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index(PaymentNotificationListRequest $request): JsonResponse
|
||||
{
|
||||
$payload = $request->validated();
|
||||
$logs = $this->service->listLogs(
|
||||
$payload['from'] ?? null,
|
||||
$payload['to'] ?? null,
|
||||
$payload['type'] ?? null
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'ok' => true,
|
||||
'logs' => PaymentNotificationLogResource::collection($logs),
|
||||
]);
|
||||
}
|
||||
|
||||
public function send(PaymentNotificationSendRequest $request): JsonResponse
|
||||
{
|
||||
$payload = $request->validated();
|
||||
$result = $this->service->send($payload);
|
||||
|
||||
return response()->json(['ok' => true] + $result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user