$method, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 45 ]); $body = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($body === false || $status < 200 || $status >= 300) { throw new RuntimeException('HTTP ' . $status . ': ' . curl_error($ch) . ' ' . $body); } curl_close($ch); return $body; } $identityUrl = getenv('DECISIOQ_IDENTITY_URL') ?: 'https://identity.vinquery.com/connect/token'; $catalogUrl = rtrim(getenv('DECISIOQ_DKS_URL') ?: 'https://dks.vinquery.com', '/'); $decisionServiceUrl = rtrim(getenv('DECISIOQ_DDE_URL') ?: 'https://dde.vinquery.com', '/'); $correlationId = 'auto-ins-011-php-' . date('YmdHis'); $tokenJson = request_json('POST', $identityUrl, [ "clientId" => required_env("DECISIOQ_CLIENT_ID"), "clientSecret" => required_env("DECISIOQ_CLIENT_SECRET"), 'audience' => getenv('DECISIOQ_AUDIENCE') ?: 'vinquery:api:decisioq' ]); $token = json_decode($tokenJson, true)['jwtToken']; request_json('GET', $catalogUrl . '/decisioncatalog/decisions/AUTO-INS-011', null, $token, $correlationId); $request = [ 'decisionId' => 'AUTO-INS-011', 'profileId' => 'balanced', 'scenarioId' => 'standard', 'algorithm' => 'TOPSIS', 'weightStrategy' => 'Expert', 'runSensitivity' => false, 'requestContext' => ['correlationId' => $correlationId], 'options' => [ ['optionId' => 'CLAIM-011-01', 'name' => 'Claim CASE-001', 'values' => [ 'claim_severity_score' => 83, 'customer_impact_score' => 83, 'coverage_clarity_score' => 83, 'fraud_risk_score' => 78, 'estimated_loss_amount' => 62500 ]], ['optionId' => 'CLAIM-011-02', 'name' => 'Claim CASE-002', 'values' => [ 'claim_severity_score' => 75, 'customer_impact_score' => 75, 'coverage_clarity_score' => 75, 'fraud_risk_score' => 70, 'estimated_loss_amount' => 107500 ]] ] ]; echo request_json('POST', $decisionServiceUrl . '/api/v1/decide', $request, $token, $correlationId);