Log successful license validation responses

This commit is contained in:
Beingpax 2025-08-22 10:00:39 +05:45
parent d39c660bca
commit 881957793f

View File

@ -93,6 +93,11 @@ class PolarService {
}
}
// Log successful response
let rawResponse = String(data: data, encoding: .utf8) ?? "Unable to decode response"
let statusCode = (httpResponse as? HTTPURLResponse)?.statusCode ?? 0
logger.notice("🔑 License validation success [HTTP \(statusCode)]: \(rawResponse, privacy: .public)")
let validationResponse = try JSONDecoder().decode(LicenseValidationResponse.self, from: data)
let isValid = validationResponse.status == "granted"
@ -139,6 +144,11 @@ class PolarService {
}
}
// Log successful response
let rawResponse = String(data: data, encoding: .utf8) ?? "Unable to decode response"
let statusCode = (httpResponse as? HTTPURLResponse)?.statusCode ?? 0
logger.notice("🔑 License activation success [HTTP \(statusCode)]: \(rawResponse, privacy: .public)")
let activationResult = try JSONDecoder().decode(ActivationResult.self, from: data)
return (activationId: activationResult.id, activationsLimit: activationResult.license_key.limit_activations)
@ -169,6 +179,11 @@ class PolarService {
}
}
// Log successful response
let rawResponse = String(data: data, encoding: .utf8) ?? "Unable to decode response"
let statusCode = (httpResponse as? HTTPURLResponse)?.statusCode ?? 0
logger.notice("🔑 License validation with activation success [HTTP \(statusCode)]: \(rawResponse, privacy: .public)")
let validationResponse = try JSONDecoder().decode(LicenseValidationResponse.self, from: data)
return validationResponse.status == "granted"