Public/TaxEntities/New-AspireTaxEntities.ps1

<#
.SYNOPSIS
    Creates a new tax entity in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a POST request to the /TaxEntities endpoint.
.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
    New-AspireTaxEntities -TaxEntityName "State Tax" -Active $true
#>

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

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

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

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