true, 'message' => get_string('registration_activated', 'meetletacbmarketplace'), 'summary' => manager::status_summary(), ]); exit; } if ($action === 'recheck' || $action === 'refresh' || $action === 'validate') { manager::recheck(true); echo json_encode([ 'success' => true, 'message' => get_string('registration_rechecked', 'meetletacbmarketplace'), 'summary' => manager::status_summary(), ]); exit; } if ($action === 'deactivate') { manager::deactivate(); echo json_encode([ 'success' => true, 'message' => get_string('registration_deactivated', 'meetletacbmarketplace'), 'summary' => manager::status_summary(), ]); exit; } if ($action === 'status') { echo json_encode([ 'success' => true, 'summary' => manager::status_summary(), ]); exit; } throw new moodle_exception('invalidparameter'); } catch (Throwable $e) { $ex = registration_exception::from_throwable($e); $mapped = error_mapper::from_exception($ex); echo json_encode([ 'success' => false, 'error' => $mapped['message'] ?? $ex->get_api_message(), 'error_code' => $ex->get_error_code(), 'request_id' => $ex->get_request_id(), 'summary' => manager::status_summary(), ]); }