Public/TaxJurisdictions/Update-AspireTaxJurisdictions.ps1

<#
.SYNOPSIS
    Updates an existing tax jurisdiction in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a PUT request to the /TaxJurisdictions endpoint.
.PARAMETER TaxJurisdictionID
    The ID of the tax jurisdiction to update (required).
.PARAMETER TaxJurisdictionName
    The name of the tax jurisdiction (required).
.PARAMETER FederalTaxPercent
    The federal tax percentage (optional).
.PARAMETER Active
    Whether the tax jurisdiction is active (required).
.PARAMETER TaxEntityJurisdictions
    Array of tax entity jurisdiction IDs (optional).
.OUTPUTS
    The response from the API containing the result.
.EXAMPLE
    Update-AspireTaxJurisdictions -TaxJurisdictionID 1 -TaxJurisdictionName "Updated CA" -Active $true
#>

function Update-AspireTaxJurisdictions {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$TaxJurisdictionID,
        [Parameter(Mandatory = $true)]
        [string]$TaxJurisdictionName,
        [decimal]$FederalTaxPercent = $null,
        [Parameter(Mandatory = $true)]
        [bool]$Active,
        [int[]]$TaxEntityJurisdictions = $null
    )

    $body = @{
        TaxJurisdictionID = $TaxJurisdictionID
        TaxJurisdictionName = $TaxJurisdictionName
        Active = $Active
    }

    if ($FederalTaxPercent -ne $null) {
        $body.FederalTaxPercent = $FederalTaxPercent
    }
    if ($TaxEntityJurisdictions) {
        $body.TaxEntityJurisdictions = $TaxEntityJurisdictions
    }

    return Invoke-AspireRequest -Method PUT -Path "/TaxJurisdictions" -Body $body
}