* @brief Deactivate the current license on this machine, freeing a seat. */
| 219 | * @brief Deactivate the current license on this machine, freeing a seat. |
| 220 | */ |
| 221 | API::CommandResponse API::Handlers::LicensingHandler::deactivate(const QString& id, |
| 222 | const QJsonObject&) |
| 223 | { |
| 224 | auto& ls = Licensing::LemonSqueezy::instance(); |
| 225 | |
| 226 | if (!ls.isActivated()) { |
| 227 | return CommandResponse::makeError( |
| 228 | id, ErrorCode::ExecutionError, QStringLiteral("No active license to deactivate")); |
| 229 | } |
| 230 | |
| 231 | if (ls.busy()) { |
| 232 | return CommandResponse::makeError( |
| 233 | id, ErrorCode::ExecutionError, QStringLiteral("Licensing operation already in progress")); |
| 234 | } |
| 235 | |
| 236 | ls.deactivate(); |
| 237 | return CommandResponse::makeSuccess(id, {}); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * @brief Re-validate the active license against the LemonSqueezy server. |
nothing calls this directly
no test coverage detected