
function Test-SectigoCertificateRequest {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param (
        [string]$FilePath,
        [string]$csr
    )

if ($FilePath) {
   [string]$csr = (Get-Content -Path $FilePath -Raw)
}

    [string]$dcvUrl = "https://certificates.nd.gov/api/csr/validate/string"


    $headers = @{
        "accept" = "application/json"
        "Content-Type" = "application/json"  # <-- Cleaned up syntax
    }

   $Body = @{
        "csr" = $csr
    }

$jsonBody = $body | ConvertTo-Json

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    # --- API Call ---
    Write-Verbose "Attempting to retrieve certificate for Order ID: $OrderId"

    try {
        $response = Invoke-RestMethod -Uri $dcvUrl -Method Post -Headers $headers -Body $jsonBody
         $response
    } catch {
       Write-Error "API Request Failed: $($_.Exception.Message)"|convertfrom-json
        return $null
    }

}