Automate XL-Vask invoice-period resolution (#340)
Deploy the revision-aware XL-Vask import and guarded autopilot infrastructure. Automatic actions remain fail-closed pending production readiness, calibration, dry-run, and canary gates.
This commit is contained in:
@@ -28,10 +28,12 @@ class xlvask_request implements xlvask_request_i
|
||||
};
|
||||
// Set the headers
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
// Set options to return the response and handle SSL
|
||||
// Verify the upstream certificate and keep requests bounded.
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
||||
// Execute the request
|
||||
$response = curl_exec($ch);
|
||||
// Check for errors
|
||||
@@ -45,9 +47,12 @@ class xlvask_request implements xlvask_request_i
|
||||
// Check if the response is successful
|
||||
if ($httpCode < 200 || $httpCode >= 300) {
|
||||
$slack = new slack();
|
||||
$urlParts = parse_url($url);
|
||||
$safeEndpoint = (string)($urlParts['host'] ?? 'unknown-host') . (string)($urlParts['path'] ?? '');
|
||||
$slack->send_message(
|
||||
'XLVask API Request Failed',
|
||||
"URL: $url\nMethod: $method\nData: " . json_encode($data) . "\nHeaders: " . implode(', ', $headers) . "\nHTTP Code: $httpCode\nResponse: $response"
|
||||
"Endpoint: {$safeEndpoint}\nMethod: {$method}\nHTTP Code: {$httpCode}\n"
|
||||
. 'Request fields: ' . count($data) . "\nResponse bytes: " . strlen((string)$response)
|
||||
);
|
||||
throw new \Exception('Request failed with status code ' . $httpCode);
|
||||
}
|
||||
@@ -71,4 +76,4 @@ class xlvask_request implements xlvask_request_i
|
||||
{
|
||||
return 'Authorization: Basic ' . base64_encode($username . ':' . $password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user