service = $service; $this->actionRenderer = $actionRenderer; } /** * @throws BadRequest * @throws Error * @throws \Espo\Core\Exceptions\NotFound */ public function run(Request $request, Response $response): void { $id = $request->getQueryParam('id'); if (!$id) { throw new BadRequest(); } $data = $this->service->confirmOptIn($id); $action = 'optInConfirmationExpired'; if ($data['status'] === 'success') { $action = 'optInConfirmationSuccess'; } $params = new ActionRenderer\Params('controllers/lead-capture-opt-in-confirmation', $action, $data); $this->actionRenderer->write($response, $params); } }