Skip to content

Commit

Permalink
Add PaymentStatuses filter parameter for Get-HaloInvoice.
Browse files Browse the repository at this point in the history
  • Loading branch information
homotechsual committed Jan 4, 2024
1 parent 5abece4 commit 10f8b3d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Public/Get/Get-HaloInvoice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ function Get-HaloInvoice {
[switch]$PostedOnly,
# Filter for non-posted invoices only.
[Parameter( ParameterSetName = 'Multi' )]
[switch]$NotPostedOnly
[switch]$NotPostedOnly,
# Filter by payment status. Provide an array of status ids.
[Parameter( ParameterSetName = 'Multi' )]
[object]$PaymentStatuses
)
Invoke-HaloPreFlightCheck
$CommandName = $MyInvocation.MyCommand.Name
Expand All @@ -93,6 +96,14 @@ function Get-HaloInvoice {
if ($InvoiceID) {
$Parameters.Remove('InvoiceID') | Out-Null
}
# Transform the payment statuses parameter to a HTML encoded string.
$PaymentStatuses = if ($PaymentStatuses -isnot [string]) {
if ($PaymentStatuses -is [int64[]]) {
return [System.Net.WebUtility]::UrlEncode($PaymentStatuses -join ',')
} else {
return [string]$PaymentStatuses
}
}
try {
if ($InvoiceID) {
Write-Verbose "Running in single-invoice mode because '-InvoiceID' was provided."
Expand Down

0 comments on commit 10f8b3d

Please sign in to comment.