Grenke Controller
GrenkeRequestController
create
show
Wenn auch beim normalen GET auf den Request direkt der Mailflow losgehen soll:
// use
use App\Services\GrenkeMissingInfoMailFlowService;
// add to __construct
public function __construct(
...
protected GrenkeMissingInfoMailFlowService $grenkeMissingInfoMailFlowService,
) {
}
// call in show()
public function show(string $financingId): JsonResponse
{
try {
$result = $this->getGrenkeRequestAction->execute($financingId);
$this->grenkeMissingInfoMailFlowService->handle($result);
return response()->json([
'success' => true,
'data' => $result->toArray(),
'meta' => $this->grenkeRequestStateService->buildStateMeta($result),
]);
} catch (Throwable $e) {
return $this->errorResponse($e);
}
}
patchRequest
patchLessee
waitForReadyToSign
Wenn du Technikertermin-Daten im Request mitgeben willst, z. B. beim Polling-Endpunkt:
public function waitForReadyToSign(Request $request, string $financingId): JsonResponse
{
try {
$result = $this->waitForGrenkeReadyToSignAction->execute(
financingId: $financingId,
maxAttempts: (int) $request->input('max_attempts', 10),
sleepMilliseconds: (int) $request->input('sleep_milliseconds', 1000),
mailContext: [
'technician_appointment_date' => $request->input('technician_appointment_date'),
'technician_appointment_time' => $request->input('technician_appointment_time'),
],
);
return response()->json([
'success' => true,
'data' => $result->toArray(),
'meta' => $this->grenkeRequestStateService->buildStateMeta($result),
]);
} catch (Throwable $e) {
return $this->errorResponse($e);
}
}