validated(); $transaction = $this->service->create($payload); return response()->json([ 'ok' => true, 'transaction' => new PaymentTransactionResource($transaction->toArray()), ], 201); } public function byPayment(int $paymentId): JsonResponse { $transactions = $this->service->getByPayment($paymentId); return response()->json([ 'ok' => true, 'transactions' => PaymentTransactionResource::collection($transactions), ]); } public function updateStatus(PaymentTransactionStatusRequest $request, string $transactionId): JsonResponse { $payload = $request->validated(); $updated = $this->service->updateStatus($transactionId, $payload['status']); if (!$updated) { return response()->json(['ok' => false, 'message' => 'Transaction not found.'], 404); } return response()->json(['ok' => true]); } }