Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 3da96db

Browse files
author
Isaiah Williams
authored
Invoice feature update (#243)
1 parent f179c9e commit 3da96db

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

docs/help/Get-PartnerUnbilledInvoiceLineItem.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ Gets reconciliation line items for the current billing period that have not been
3333

3434
### Example 2
3535
```powershell
36-
PS C:\> Get-PartnerUnbilledInvoiceLineItem -CurrencyCode USD -LineItemType BillingLineItems -Period Pervious
36+
PS C:\> Get-PartnerUnbilledInvoiceLineItem -CurrencyCode USD -LineItemType BillingLineItems -Period Previous
3737
```
3838

39-
Gets reconciliation line items for the pervious billing period that have not been billed. The pervious billing period is defined as the pervious month.
39+
Gets reconciliation line items for the previous billing period that have not been billed. The previous billing period is defined as the previous month.
4040

4141
### Example 3
4242
```powershell
@@ -47,10 +47,10 @@ Gets consumption line items for the current billing period that have not been bi
4747

4848
### Example 4
4949
```powershell
50-
PS C:\> Get-PartnerUnbilledInvoiceLineItem -CurrencyCode USD -LineItemType UsageLineItems -Period Pervious
50+
PS C:\> Get-PartnerUnbilledInvoiceLineItem -CurrencyCode USD -LineItemType UsageLineItems -Period Previous
5151
```
5252

53-
Gets consumption line items for the pervious billing period that have not been billed. The pervious billing period is defined as the pervious month.
53+
Gets consumption line items for the previous billing period that have not been billed. The previous billing period is defined as the previous month.
5454

5555
## PARAMETERS
5656

src/PowerShell/Commands/GetPartnerInvoiceLineItem.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public class GetPartnerInvoiceLineItem : PartnerAsyncCmdlet
2727
/// Gets or sets the billing provider.
2828
/// </summary>
2929
[Parameter(HelpMessage = "The billing provide for the line items.", Mandatory = true)]
30-
[ValidateSet(nameof(BillingProvider.All), nameof(BillingProvider.Azure), nameof(BillingProvider.Office), nameof(BillingProvider.OneTime), nameof(BillingProvider.Marketplace))]
30+
[ValidateSet(nameof(BillingProvider.All), nameof(BillingProvider.Azure), nameof(BillingProvider.Marketplace), nameof(BillingProvider.Office), nameof(BillingProvider.OneTime))]
3131
public BillingProvider BillingProvider { get; set; }
3232

3333
/// <summary>
3434
/// Gets or sets the currenty code.
3535
/// </summary>
36-
[Parameter(HelpMessage = "The currency code for the unbilled line items.", Mandatory = false)]
36+
[Parameter(HelpMessage = "The currency code for the line items.", Mandatory = false)]
3737
[ValidateNotNull]
3838
public string CurrencyCode { get; set; }
3939

@@ -63,15 +63,22 @@ public override void ExecuteCmdlet()
6363
List<InvoiceLineItem> items;
6464
ResourceCollection<InvoiceLineItem> lineItems;
6565

66-
lineItems = await partner.Invoices[InvoiceId].By(BillingProvider, LineItemType).GetAsync().ConfigureAwait(false);
66+
if (BillingProvider == BillingProvider.OneTime || BillingProvider == BillingProvider.Marketplace)
67+
{
68+
lineItems = await partner.Invoices[InvoiceId].By(BillingProvider, LineItemType, CurrencyCode, BillingPeriod.Current).GetAsync(CancellationToken).ConfigureAwait(false);
69+
}
70+
else
71+
{
72+
lineItems = await partner.Invoices[InvoiceId].By(BillingProvider, LineItemType).GetAsync(CancellationToken).ConfigureAwait(false);
73+
}
6774

6875
enumerator = partner.Enumerators.InvoiceLineItems.Create(lineItems);
6976
items = new List<InvoiceLineItem>();
7077

7178
while (enumerator.HasValue)
7279
{
7380
items.AddRange(enumerator.Current.Items);
74-
await enumerator.NextAsync().ConfigureAwait(false);
81+
await enumerator.NextAsync(null, CancellationToken).ConfigureAwait(false);
7582
}
7683

7784
if (LineItemType == InvoiceLineItemType.BillingLineItems)

src/PowerShell/Network/SingleMessageTcpListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private Uri ExtractUriFromHttpRequest(string httpRequest)
150150

151151
if (!match.Success)
152152
{
153-
throw new InvalidOperationException("Not a GET query");
153+
throw new InvalidOperationException("Not a GET query.");
154154
}
155155

156156
getQuery = match.Groups[1].Value;

0 commit comments

Comments
 (0)