Public/TaxEntities/Update-AspireTaxEntities.ps1

<#
.SYNOPSIS
    Updates an existing tax entity in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a PUT request to the /TaxEntities endpoint.
.PARAMETER TaxEntityID
    The ID of the tax entity to update (required).
.PARAMETER TaxEntityName
    The name of the tax entity (required).
.PARAMETER TaxPercent
    The tax percentage (optional).
.PARAMETER Active
    Whether the tax entity is active (required).
.OUTPUTS
    The response from the API containing the result.
.EXAMPLE
    Update-AspireTaxEntities -TaxEntityID 1 -TaxEntityName "Updated Tax" -Active $true
#>

function Update-AspireTaxEntities {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$TaxEntityID,
        [Parameter(Mandatory = $true)]
        [string]$TaxEntityName,
        [decimal]$TaxPercent = $null,
        [Parameter(Mandatory = $true)]
        [bool]$Active
    )

    $body = @{
        TaxEntityID = $TaxEntityID
        TaxEntityName = $TaxEntityName
        Active = $Active
    }

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

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