Invoice and order feature update.

This commit is contained in:
Isaiah Williams 2019-03-15 11:29:38 -05:00
Родитель 73a007a2f0
Коммит d608db5086
84 изменённых файлов: 796 добавлений и 1044 удалений

Просмотреть файл

@ -34,10 +34,13 @@
* Added the AlternateId property to the reference order object
* Invoice
* Added the ability to download the tax receipt
* Removed Azure Data Market billing provider type and models because this is no longer supported
* Orders
* Added the ability to include pricing details when requesting order information
* Addressed an issue with requesting an order by the billing cycle
* Products
* Corrected an issue with requesting products by country, target view, and target segment
* Removed the SKU download operations. No commands where impacted by this change
* Users
* Corrected an issue with performing a query for users from a customer

Просмотреть файл

@ -1,6 +1,6 @@
# Microsoft Partner Center PowerShell
![Build status](https://dev.azure.com/partnercenter/powershell/_apis/build/status/partner-center-powershell-CI) ![Deployment status](https://vsrm.dev.azure.com/partnercenter/_apis/public/Release/badge/330fa980-0fb5-4550-8242-f162a4c6d7c7/1/1)
![Build status](https://dev.azure.com/partnercenter/powershell/_apis/build/status/partner-center-powershell-CI) ![Deployment status](https://vsrm.dev.azure.com/partnercenter/_apis/public/Release/badge/330fa980-0fb5-4550-8242-f162a4c6d7c7/4/6)
[![PartnerCenter](https://img.shields.io/powershellgallery/v/PartnerCenter.svg?style=flat-square&label=PartnerCenter)](https://www.powershellgallery.com/packages/PartnerCenter/) [![GitHub issues](https://img.shields.io/github/issues/Microsoft/Partner-Center-PowerShell.svg)](https://github.com/Microsoft/Partner-Center-PowerShell/issues/) [![GitHub pull-requests](https://img.shields.io/github/issues-pr/Microsoft/Partner-Center-PowerShell.svg)](https://gitHub.com/Microsoft/Partner-Center-PowerShell/pull/)
@ -74,7 +74,7 @@ Connect-PartnerCenter -AccessToken $token.AccessToken -ApplicationId '<AAD-AppId
#### Sovereign Cloud
To log into a specific cloud (_ChinaCloud_, _GlobalCloud_, _GermanCloud_, _USGovernment_), use the `Environment` parameter:
To log into a specific cloud (_ChinaCloud_, _GlobalCloud_, _GermanCloud_, _USGovernment_, _PPE_), use the `Environment` parameter:
```powershell
# Log into a specific cloud - in this case, the German cloud

Просмотреть файл

@ -2,7 +2,7 @@
<package>
<metadata>
<id>PartnerCenter.NetCore</id>
<version>1.5.1903.1</version>
<version>1.5.1903.2</version>
<authors>Microsoft Corporation</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

Просмотреть файл

@ -2,7 +2,7 @@
<package>
<metadata>
<id>PartnerCenter</id>
<version>1.5.1903.1</version>
<version>1.5.1903.2</version>
<authors>Microsoft Corporation</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

Просмотреть файл

@ -16,17 +16,18 @@ Gets either a specific order or a list of order for the specified customer.
### ByBillingCycle
```powershell
Get-PartnerCustomerOrder -BillingCycle <BillingCycleType> -CustomerId <String> [<CommonParameters>]
Get-PartnerCustomerOrder -BillingCycle <BillingCycleType> -CustomerId <String> [-IncludePrice]
[<CommonParameters>]
```
### ByCustomerId
```powershell
Get-PartnerCustomerOrder -CustomerId <String> [<CommonParameters>]
Get-PartnerCustomerOrder -CustomerId <String> [-IncludePrice] [<CommonParameters>]
```
### ByOrderId
```powershell
Get-PartnerCustomerOrder -CustomerId <String> -OrderId <String> [<CommonParameters>]
Get-PartnerCustomerOrder -CustomerId <String> [-IncludePrice] -OrderId <String> [<CommonParameters>]
```
## DESCRIPTION
@ -81,6 +82,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -IncludePrice
A flag indicating whether to include pricing details in the order information.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -OrderId
Identifier for the order.

Просмотреть файл

@ -0,0 +1,92 @@
---
external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml
Module Name: PartnerCenter
online version:
schema: 2.0.0
---
# Get-PartnerCustomerOrderLineItemActivationLink
## SYNOPSIS
Gets the activation link for the specified order line item.
## SYNTAX
```powershell
Get-PartnerCustomerOrderLineItemActivationLink -CustomerId <String> -OrderId <String>
-OrderLineItemNumber <Int32> [<CommonParameters>]
```
## DESCRIPTION
Gets the activation link for the specified order line item.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-PartnerCustomerOrderLineItemActivationLink -CustomerId '2ca7de6c-c05c-46b5-b689-32e53573a97a' -OrderId 'kyTs4y7jRu99MyeIudk6Q1G_aeUdT_tu1' -OrderLineItemNumber 0
```
Gets the activation link for the specified order line item.
## PARAMETERS
### -CustomerId
The identifier of the customer.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -OrderId
The identifier for the order.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -OrderLineItemNumber
The order line item number.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### Microsoft.Store.PartnerCenter.Models.Orders.OrderLineItemActivationLink
## NOTES
## RELATED LINKS

Просмотреть файл

@ -15,7 +15,7 @@ Gets the line items for the specified invoice.
## SYNTAX
```powershell
Get-PartnerInvoiceLineItem -BillingProvider <BillingProvider> -InvoiceId <String>
Get-PartnerInvoiceLineItem -BillingProvider <BillingProvider> [-CurrencyCode <String>] -InvoiceId <String>
-LineItemType <InvoiceLineItemType> [<CommonParameters>]
```
@ -40,7 +40,7 @@ The billing provide for the line items.
Type: BillingProvider
Parameter Sets: (All)
Aliases:
Accepted values: Azure, AzureDataMarket, Office, OneTime
Accepted values: Azure, Office, OneTime, External
Required: True
Position: Named
@ -49,6 +49,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -CurrencyCode
The currency code for the unbilled line items.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -InvoiceId
The identifier corresponding to the invoice.

Просмотреть файл

@ -1,63 +0,0 @@
---
content_git_url: https://github.com/Microsoft/Partner-Center-PowerShell/blob/master/docs/help/Get-PartnerInvoiceUnbilledThirdPartyLineItem.md
external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml
Module Name: PartnerCenter
online version: https://docs.microsoft.com/powershell/module/partnercenter/Get-PartnerInvoiceUnbilledThirdPartyLineItem
original_content_git_url: https://github.com/Microsoft/Partner-Center-PowerShell/blob/master/docs/help/Get-PartnerInvoiceUnbilledThirdPartyLineItem.md
schema: 2.0.0
---
# Get-PartnerInvoiceUnbilledThirdPartyLineItem
## SYNOPSIS
Gets a collection of unbilled third-party consumption line item details.
## SYNTAX
```powershell
Get-PartnerInvoiceUnbilledThirdPartyLineItem -CurrencyCode <String> [<CommonParameters>]
```
## DESCRIPTION
Gets a collection of unbilled third-party consumption line item details.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-PartnerInvoiceUnbilledThirdPartyLineItem -CurrencyCode USD
```
Gets a collection of unbilled third-party consumption line item details.
## PARAMETERS
### -CurrencyCode
The currency code for the unbilled line items.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices.PSDailyRatedUsageReconLineItem
## NOTES
## RELATED LINKS

Просмотреть файл

@ -74,6 +74,9 @@ Gets the managed services for a customer.
### [Get-PartnerCustomerOrder](Get-PartnerCustomerOrder.md)
Gets either a specific order or a list of order for the specified customer.
### [Get-PartnerCustomerOrderLineItemActivationLink](Get-PartnerCustomerOrderLineItemActivationLink.md)
Gets the activation link for the specified order line item.
### [Get-PartnerCustomerQualification](Get-PartnerCustomerQualification.md)
Get the qualification assigned to the customer.
@ -143,9 +146,6 @@ Gets a summary view of the invoice.
### [Get-PartnerInvoiceTaxReceiptStatement](Get-PartnerInvoiceTaxReceiptStatement.md)
Gets the tax receipt statement for the specified invoice.
### [Get-PartnerInvoiceUnbilledThirdPartyLineItem](Get-PartnerInvoiceUnbilledThirdPartyLineItem.md)
Gets a collection of unbilled third-party consumption line item details.
### [Get-PartnerLegalProfile](Get-PartnerLegalProfile.md)
Gets the partner legal business profile from Partner Center.

Просмотреть файл

@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/Microsoft/Partner-Center-PowerShell</PackageProjectUrl>
<RepositoryUrl>https://github.com/Microsoft/Partner-Center-PowerShell.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>1.5.1903.1</Version>
<Version>1.5.1903.2</Version>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

Просмотреть файл

@ -12,7 +12,7 @@ namespace Microsoft.Store.PartnerCenter.Carts
/// <summary>
/// Encapsulates a customer cart behavior.
/// </summary>
public interface ICartCollection : IPartnerComponent<string>, IEntityCreateOperations<Cart, Cart>, IEntitySelector<ICart>
public interface ICartCollection : IPartnerComponent<string>, IEntityCreateOperations<Cart, Cart>, IEntitySelector<string, ICart>
{
}
}

Просмотреть файл

@ -363,6 +363,9 @@
"GetCustomerServiceCostLineItems": {
"Path": "customers/{0}/servicecosts/{1}/lineitems"
},
"GetActivationLinksByLineItemNumber": {
"Path": "customers/{0}/orders/{1}/lineitems/{2}/activationlinks"
},
"GetCustomerQualification": {
"Path": "customers/{0}/qualification"
},
@ -403,16 +406,23 @@
"Path": "profiles/support"
},
"GetOrders": {
"Path": "customers/{0}/orders"
"Path": "customers/{0}/orders",
"Parameters": {
"IncludePrice": "include_price"
}
},
"GetOrdersByBillingCyleType": {
"Path": "customers/{0}/orders",
"Parameters": {
"BillingType": "billingType"
"BillingType": "billingType",
"IncludePrice": "include_price"
}
},
"GetOrder": {
"Path": "customers/{0}/orders/{1}"
"Path": "customers/{0}/orders/{1}",
"Parameters": {
"IncludePrice": "include_price"
}
},
"UpdateOrder": {
"Path": "customers/{0}/orders/{1}"

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.Store.PartnerCenter.CustomerDirectoryRoles
/// <summary>
/// Represents the behavior of directory role collection.
/// </summary>
public interface IDirectoryRoleCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<DirectoryRole, ResourceCollection<DirectoryRole>>, IEntitySelector<IDirectoryRole>
public interface IDirectoryRoleCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<DirectoryRole, ResourceCollection<DirectoryRole>>, IEntitySelector<string, IDirectoryRole>
{
}
}

Просмотреть файл

@ -17,7 +17,7 @@ namespace Microsoft.Store.PartnerCenter.CustomerDirectoryRoles
/// <summary>
/// Represents the behavior of user member collection.
/// </summary>
public interface IUserMemberCollection : IPartnerComponent<Tuple<string, string>>, IEntityCreateOperations<UserMember, UserMember>, IEntireEntityCollectionRetrievalOperations<UserMember, SeekBasedResourceCollection<UserMember>>, IEntitySelector<IUserMember>
public interface IUserMemberCollection : IPartnerComponent<Tuple<string, string>>, IEntityCreateOperations<UserMember, UserMember>, IEntireEntityCollectionRetrievalOperations<UserMember, SeekBasedResourceCollection<UserMember>>, IEntitySelector<string, IUserMember>
{
/// <summary>
/// Queries the user members of a customer directory role.

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.Store.PartnerCenter.CustomerUsers
/// <summary>
/// Represents the behavior of the customers users.
/// </summary>
public interface ICustomerUserCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<CustomerUser, SeekBasedResourceCollection<CustomerUser>>, IEntityCreateOperations<CustomerUser, CustomerUser>, IEntitySelector<ICustomerUser>
public interface ICustomerUserCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<CustomerUser, SeekBasedResourceCollection<CustomerUser>>, IEntityCreateOperations<CustomerUser, CustomerUser>, IEntitySelector<string, ICustomerUser>
{
/// <summary>
/// Queries users of customer.

Просмотреть файл

@ -18,7 +18,7 @@ namespace Microsoft.Store.PartnerCenter.Customers
/// <summary>
/// Represents the behavior of the partner customers.
/// </summary>
public interface ICustomerCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Customer, SeekBasedResourceCollection<Customer>>, IEntityCreateOperations<Customer, Customer>, IEntitySelector<ICustomer>
public interface ICustomerCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Customer, SeekBasedResourceCollection<Customer>>, IEntityCreateOperations<Customer, Customer>, IEntitySelector<string, ICustomer>
{
/// <summary>
/// Gets the relationship request behavior used to relate customers into the partner.

Просмотреть файл

@ -1,63 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="CustomerSkuDownloadOptionsOperations.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Customers.Products
{
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Extensions;
using Models;
using Models.JsonConverters;
using Models.Products;
using PartnerCenter.Products;
/// <summary>
/// Implementation of customer sku download options operations.
/// </summary>
internal class CustomerSkuDownloadOptionsOperations : BasePartnerComponent<Tuple<string, string, string>>, ISkuDownloadOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="CustomerSkuDownloadOptionsOperations" /> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="customerId">The customer identifier.</param>
/// <param name="productId">The product identifier.</param>
/// <param name="skuId">The SKU identifier.</param>
public CustomerSkuDownloadOptionsOperations(
IPartner rootPartnerOperations,
string customerId,
string productId,
string skuId)
: base(rootPartnerOperations, new Tuple<string, string, string>(customerId, productId, skuId))
{
customerId.AssertNotEmpty(nameof(customerId));
productId.AssertNotEmpty(nameof(productId));
skuId.AssertNotEmpty(nameof(skuId));
}
/// <summary>
/// Gets all download options for the provided SKU.
/// </summary>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The SKU download options.</returns>
public async Task<ResourceCollection<SkuDownloadOptions>> GetAsync(CancellationToken cancellationToken = default)
{
return await Partner.ServiceClient.GetAsync<ResourceCollection<SkuDownloadOptions>>(
new Uri(
string.Format(
CultureInfo.InvariantCulture,
$"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.GetCustomerSkuDownloadOptions.Path}",
Context.Item1,
Context.Item2,
Context.Item3),
UriKind.Relative),
new ResourceCollectionConverter<SkuDownloadOptions>(),
cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -24,11 +24,6 @@ namespace Microsoft.Store.PartnerCenter.Customers.Products
/// </summary>
private readonly Lazy<IAvailabilityCollection> availabilities;
/// <summary>
/// Provides the SKU download options operations.
/// </summary>
private readonly Lazy<ISkuDownloadOptions> downloadOptions;
/// <summary>
/// Initializes a new instance of the <see cref="CustomerSkuOperations" /> class.
/// </summary>
@ -44,7 +39,6 @@ namespace Microsoft.Store.PartnerCenter.Customers.Products
skuId.AssertNotEmpty(nameof(skuId));
availabilities = new Lazy<IAvailabilityCollection>(() => new CustomerAvailabilityCollectionOperations(Partner, customerId, productId, skuId));
downloadOptions = new Lazy<ISkuDownloadOptions>(() => new CustomerSkuDownloadOptionsOperations(Partner, customerId, productId, skuId));
}
/// <summary>
@ -52,11 +46,6 @@ namespace Microsoft.Store.PartnerCenter.Customers.Products
/// </summary>
public IAvailabilityCollection Availabilities => availabilities.Value;
/// <summary>
/// Gets the operations for the current SKU's download options.
/// </summary>
public ISkuDownloadOptions DownloadOptions => downloadOptions.Value;
/// <summary>
/// Gets the SKU information.
/// </summary>

Просмотреть файл

@ -12,7 +12,7 @@ namespace Microsoft.Store.PartnerCenter.Customers.Products
/// <summary>
/// Holds operations that can be performed on products that apply to a given customer.
/// </summary>
public interface ICustomerProductCollection : IPartnerComponent<string>, IEntitySelector<IProduct>
public interface ICustomerProductCollection : IPartnerComponent<string>, IEntitySelector<string, IProduct>
{
/// <summary>
/// Gets the operations that can be applied on products in a given catalog view and that apply to a given customer.

Просмотреть файл

@ -11,7 +11,7 @@ namespace Microsoft.Store.PartnerCenter.DevicesDeployment
/// <summary>
/// Represents the operations that can be done on the partner's batch upload status collection.
/// </summary>
public interface IBatchJobStatusCollection : IPartnerComponent<string>, IEntitySelector<IBatchJobStatus>
public interface IBatchJobStatusCollection : IPartnerComponent<string>, IEntitySelector<string, IBatchJobStatus>
{
}
}

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.Store.PartnerCenter.DevicesDeployment
/// <summary>
/// Represents the operations that can be done on the partner's configuration policies.
/// </summary>
public interface IConfigurationPolicyCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<ConfigurationPolicy, ResourceCollection<ConfigurationPolicy>>, IEntityCreateOperations<ConfigurationPolicy, ConfigurationPolicy>, IEntitySelector<IConfigurationPolicy>
public interface IConfigurationPolicyCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<ConfigurationPolicy, ResourceCollection<ConfigurationPolicy>>, IEntityCreateOperations<ConfigurationPolicy, ConfigurationPolicy>, IEntitySelector<string, IConfigurationPolicy>
{
}
}

Просмотреть файл

@ -15,7 +15,7 @@ namespace Microsoft.Store.PartnerCenter.DevicesDeployment
/// <summary>
/// Represents the operations that can be done on the partner's devices.
/// </summary>
public interface IDeviceCollection : IPartnerComponent<Tuple<string, string>>, IEntireEntityCollectionRetrievalOperations<Device, ResourceCollection<Device>>, IEntityCreateOperations<IEnumerable<Device>, string>, IEntitySelector<IDevice>
public interface IDeviceCollection : IPartnerComponent<Tuple<string, string>>, IEntireEntityCollectionRetrievalOperations<Device, ResourceCollection<Device>>, IEntityCreateOperations<IEnumerable<Device>, string>, IEntitySelector<string, IDevice>
{
}
}

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.Store.PartnerCenter.DevicesDeployment
/// <summary>
/// Represents the operations that can be done on the partner's devices batches.
/// </summary>
public interface IDevicesBatchCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<DeviceBatch, ResourceCollection<DeviceBatch>>, IEntitySelector<IDevicesBatch>, IEntityCreateOperations<DeviceBatchCreationRequest, string>
public interface IDevicesBatchCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<DeviceBatch, ResourceCollection<DeviceBatch>>, IEntitySelector<string, IDevicesBatch>, IEntityCreateOperations<DeviceBatchCreationRequest, string>
{
}
}

Просмотреть файл

@ -26,7 +26,7 @@ namespace Microsoft.Store.PartnerCenter.Entitlements
/// Initializes a new instance of the <see cref="EntitlementCollectionByEntitlementTypeOperations" /> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="customerId">The customer id.</param>
/// <param name="customerId">The customer identifier.</param>
/// <param name="entitlementType">The entitlement type.</param>
public EntitlementCollectionByEntitlementTypeOperations(IPartner rootPartnerOperations, string customerId, string entitlementType)
: base(rootPartnerOperations, new Tuple<string, string>(customerId, entitlementType))

Просмотреть файл

@ -9,21 +9,22 @@ namespace Microsoft.Store.PartnerCenter.GenericOperations
/// <summary>
/// Defines operations for selecting an entity out of a collection.
/// </summary>
/// <typeparam name="TTYpe">The type of identifier.</typeparam>
/// <typeparam name="TEntity">The type of the entity behavior.</typeparam>
public interface IEntitySelector<out TEntity>
public interface IEntitySelector<TTYpe, out TEntity>
{
/// <summary>
/// Gets the behavior for an entity using the entity's identifer.
/// </summary>
/// <param name="id">The entity's ID.</param>
/// <param name="id">The entity's identifier.</param>
/// <returns>The entity's behavior.</returns>
TEntity this[string id] { get; }
TEntity this[TTYpe id] { get; }
/// <summary>
/// Retrieves the behavior for an entity using the entity's identifier.
/// </summary>
/// <param name="id">The entity's ID.</param>
/// <param name="id">The entity's identifier.</param>
/// <returns>The entity's behavior.</returns>
TEntity ById(string id);
TEntity ById(TTYpe id);
}
}

Просмотреть файл

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="IEstimateLink.cs" company="Microsoft">
// <copyright file="IEstimateLinkCollectionByCurrency.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.Store.PartnerCenter.Invoices
/// <summary>
/// Represents the operations that can be done on the partner's invoices.
/// </summary>
public interface IInvoiceCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Invoice, ResourceCollection<Invoice>>, IEntitySelector<IInvoice>
public interface IInvoiceCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Invoice, ResourceCollection<Invoice>>, IEntitySelector<string, IInvoice>
{
/// <summary>
/// Gets an estimates operations.

Просмотреть файл

@ -11,7 +11,7 @@ namespace Microsoft.Store.PartnerCenter.Invoices
/// <summary>
/// Represents the operations that can be done on receipt collection.
/// </summary>
public interface IReceiptCollection : IPartnerComponent<string>, IEntitySelector<IReceipt>
public interface IReceiptCollection : IPartnerComponent<string>, IEntitySelector<string, IReceipt>
{
}
}

Просмотреть файл

@ -199,6 +199,11 @@ namespace Microsoft.Store.PartnerCenter.Models.Auditing
/// <summary>
/// Increase credit limit
/// </summary>
IncreaseCreditLimit = 36
IncreaseCreditLimit = 36,
/// <summary>
/// Create invoice
/// </summary>
CreateInvoice = 37
}
}

Просмотреть файл

@ -46,7 +46,7 @@ namespace Microsoft.Store.PartnerCenter.Models.Auditing
License = 5,
/// <summary>
/// Third party add-on Resource
/// Third party add-on resource
/// </summary>
ThirdPartyAddOn = 6,
@ -98,6 +98,11 @@ namespace Microsoft.Store.PartnerCenter.Models.Auditing
/// <summary>
/// Credit Limit Resource
/// </summary>
CreditLimit = 16
CreditLimit = 16,
/// <summary>
/// Invoice Resource
/// </summary>
Invoice = 17
}
}

Просмотреть файл

@ -1,48 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="AzureDataMarketDailyUsageLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Invoices
{
using System;
/// <summary>
/// Defines the properties of an Azure data market daily usage line item.
/// </summary>
public sealed class AzureDataMarketDailyUsageLineItem : BaseAzureDataMarketLineItem
{
/// <summary>
/// Gets the type of invoice line item.
/// </summary>
public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.UsageLineItems;
/// <summary>
/// Gets or sets the metered service name.
/// </summary>
/// <remarks>
/// Example: Storage.
/// </remarks>
public string MeteredServiceName { get; set; }
/// <summary>
/// Gets or sets the metered service type.
/// </summary>
/// <remarks>
/// Example: External.
/// </remarks>
public string MeteredServiceType { get; set; }
/// <summary>
/// Gets or sets the customer assigned friendly name for the resource instance.
/// </summary>
public string ResourceFriendlyName { get; set; }
/// <summary>
/// Gets or sets the usage date the resource.
/// </summary>
public DateTime UsageDate { get; set; }
}
}

Просмотреть файл

@ -1,82 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="AzureDataMarketLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Invoices
{
/// <summary>
/// Defines an Azure Data Market billing line item.
/// </summary>
public sealed class AzureDataMarketLineItem : BaseAzureDataMarketLineItem
{
/// <summary>
/// Gets or sets the charge type.
/// </summary>
/// <remarks>
/// Example: Assess Usage Fee For Current Cycle.
/// </remarks>
public string ChargeType { get; set; }
/// <summary>
/// Gets or sets the discount on consumption.
/// </summary>
public decimal ConsumptionDiscount { get; set; }
/// <summary>
/// Gets or sets the price of quantity consumed.
/// </summary>
public decimal ConsumptionPrice { get; set; }
/// <summary>
/// Gets or sets the currency associated with the prices.
/// </summary>
public string CurrencyCode { get; set; }
/// <summary>
/// Gets or sets the units included in the order.
/// </summary>
public decimal IncludedQuantity { get; set; }
/// <summary>
/// Gets the type of invoice line item.
/// </summary>
public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.BillingLineItems;
/// <summary>
/// Gets or sets the price of each unit.
/// </summary>
public decimal ListPrice { get; set; }
/// <summary>
/// Gets or sets the quantity consumed above allowed usage.
/// </summary>
public decimal OverageQuantity { get; set; }
/// <summary>
/// Gets or sets the effective price after taxes.
/// </summary>
public decimal PostTaxEffectiveRate { get; set; }
/// <summary>
/// Gets or sets the total charges after tax. Pretax Charges + Tax Amount.
/// </summary>
public decimal PostTaxTotal { get; set; }
/// <summary>
/// Gets or sets the price charged before taxes.
/// </summary>
public decimal PretaxCharges { get; set; }
/// <summary>
/// Gets or sets the effective price before taxes.
/// </summary>
public decimal PretaxEffectiveRate { get; set; }
/// <summary>
/// Gets or sets the amount of tax charged.
/// </summary>
public decimal TaxAmount { get; set; }
}
}

Просмотреть файл

@ -1,106 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="BaseAzureDataMarketLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Invoices
{
using System;
/// <summary>
/// Groups the common properties for all types of Azure data market invoice line items.
/// </summary>
public abstract class BaseAzureDataMarketLineItem : InvoiceLineItem
{
/// <summary>
/// Gets the billing provider.
/// </summary>
public override BillingProvider BillingProvider => BillingProvider.AzureDataMarket;
/// <summary>
/// Gets or sets the date charge ends.
/// </summary>
public DateTime ChargeEndDate { get; set; }
/// <summary>
/// Gets or sets the date charge begins.
/// </summary>
public DateTime ChargeStartDate { get; set; }
/// <summary>
/// Gets or sets the total units consumed.
/// </summary>
public decimal ConsumedQuantity { get; set; }
/// <summary>
/// Gets or sets the customer company name.
/// </summary>
public string CustomerCompanyName { get; set; }
/// <summary>
/// Gets or sets the invoice number.
/// </summary>
public string InvoiceNumber { get; set; }
/// <summary>
/// Gets or sets the order identifier.
/// </summary>
public string OrderId { get; set; }
/// <summary>
/// Gets or sets the partner's azure active directory tenant Id.
/// </summary>
public string PartnerId { get; set; }
/// <summary>
/// Gets or sets the partner identifier.
/// </summary>
/// <remarks>
/// For direct reseller, this is the partner's MPN identifier.
/// For indirect reseller, this is the VAR's MPN identifier.
/// </remarks>
public int PartnerMpnId { get; set; }
/// <summary>
/// Gets or sets the partner name.
/// </summary>
public string PartnerName { get; set; }
/// <summary>
/// Gets or sets the region associated with the resource instance.
/// </summary>
public string Region { get; set; }
/// <summary>
/// Gets or sets the resource name.
/// </summary>
/// <remarks>
/// Example: Database (GB/month).
/// </remarks>
public string ResourceName { get; set; }
/// <summary>
/// Gets or sets the service name.
/// </summary>
/// <remarks>
/// Example: Azure Data Service.
/// </remarks>
public string ServiceName { get; set; }
/// <summary>
/// Gets or sets the description of the subscription.
/// </summary>
public string SubscriptionDescription { get; set; }
/// <summary>
/// Gets or sets the subscription identifier.
/// </summary>
public string SubscriptionId { get; set; }
/// <summary>
/// Gets or sets the subscription name.
/// </summary>
public string SubscriptionName { get; set; }
}
}

Просмотреть файл

@ -30,23 +30,18 @@ namespace Microsoft.Store.PartnerCenter.Models.Invoices
/// </summary>
Azure,
/// <summary>
/// Bill is provided by Azure Data Market.
/// </summary>
AzureDataMarket,
/// <summary>
/// Bill is provided for one time purchases.
/// </summary>
OneTime,
/// <summary>
/// Indicates that the provider is third party
/// Indicates that the provider is marketplace
/// </summary>
External,
/// <summary>
/// Indicates that the provider is both first party and third party
/// Indicates that the provider is both first party and marketplace
/// </summary>
All
}

Просмотреть файл

@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="DailyRatedUsageReconLineItem.cs" company="Microsoft">
// <copyright file="DailyRatedUsageLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
@ -7,11 +7,12 @@
namespace Microsoft.Store.PartnerCenter.Models.Invoices
{
using System;
using System.Collections.Generic;
/// <summary>
/// Represents unbilled, billed recon line items for daily rated usage.
/// </summary>
public sealed class DailyRatedUsageReconLineItem : InvoiceLineItem
public sealed class DailyRatedUsageLineItem : InvoiceLineItem
{
/// <summary>
/// Gets or sets the partner Id.
@ -161,7 +162,7 @@ namespace Microsoft.Store.PartnerCenter.Models.Invoices
/// <summary>
/// Gets or sets the customer added tags. For more information, see Organize your Azure resources with tags.
/// </summary>
public string Tags { get; set; }
public IDictionary<string, string> Tags { get; private set; }
/// <summary>
/// Gets or sets the service-specific metadata. For example, an image type for a virtual machine.

Просмотреть файл

@ -1,38 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="ProviderSource.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Invoices
{
using JsonConverters;
using Newtonsoft.Json;
/// <summary>
/// Different providers of billing information
/// </summary>
[JsonConverter(typeof(EnumJsonConverter))]
public enum ProviderSource
{
/// <summary>
/// Enum initializer
/// </summary>
None,
/// <summary>
/// Indicates that the provider is both first party and third party
/// </summary>
All,
/// <summary>
/// Indicates that the provider is first party
/// </summary>
Microsoft,
/// <summary>
/// Indicates that the provider is third party
/// </summary>
External
}
}

Просмотреть файл

@ -71,10 +71,6 @@ namespace Microsoft.Store.PartnerCenter.Models.JsonConverters
{
lineItem = new UsageBasedLineItem();
}
else if (billingProvider == BillingProvider.AzureDataMarket)
{
lineItem = new AzureDataMarketLineItem();
}
else if (billingProvider == BillingProvider.Office)
{
lineItem = new LicenseBasedLineItem();
@ -95,13 +91,9 @@ namespace Microsoft.Store.PartnerCenter.Models.JsonConverters
{
lineItem = new DailyUsageLineItem();
}
else if (billingProvider == BillingProvider.AzureDataMarket)
{
lineItem = new AzureDataMarketDailyUsageLineItem();
}
else if (billingProvider == BillingProvider.External)
{
lineItem = new DailyRatedUsageReconLineItem();
lineItem = new DailyRatedUsageLineItem();
}
}

Просмотреть файл

@ -8,46 +8,25 @@ namespace Microsoft.Store.PartnerCenter.Models
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
/// <summary>
/// Represents a URI and the HTTP method which indicates the desired action for accessing the resource.
/// </summary>
public sealed class Link
{
/// <summary>
/// Initializes a new instance of the <see cref="Link" /> class.
/// Gets the headers associated with this link.
/// </summary>
/// <param name="uri">The uniformed resource identifier (URI) for the link.</param>
public Link(Uri uri)
: this(uri, "GET", null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Link" /> class.
/// </summary>
/// <param name="uri">The uniformed resource identifier (URI) for the link.</param>
/// <param name="method">The HTTP method used by the link.</param>
/// <param name="headers">The headers associated with the link.</param>
[JsonConstructor]
public Link(Uri uri, string method, IEnumerable<KeyValuePair<string, string>> headers = null)
{
Uri = uri;
Method = method;
Headers = headers ?? new List<KeyValuePair<string, string>>();
}
/// <summary>
/// Gets the uniformed resource identifier (URI) for this link.
/// </summary>
public Uri Uri { get; private set; }
public IEnumerable<KeyValuePair<string, string>> Headers { get; private set; }
/// <summary>
/// Gets the HTTP method used by this link.
/// </summary>
public string Method { get; private set; }
/// <summary>
/// Gets the headers associated with this link.
/// Gets the uniformed resource identifier (URI) for this link.
/// </summary>
public IEnumerable<KeyValuePair<string, string>> Headers { get; private set; }
public Uri Uri { get; private set; }
}
}

Просмотреть файл

@ -45,14 +45,27 @@ namespace Microsoft.Store.PartnerCenter.Models.Orders
/// </summary>
public OrderLinks Links { get; set; }
/// <summary>
/// Gets or sets the reference customer identifier.
/// </summary>
public string ReferenceCustomerId { get; set; }
/// <summary>
/// Gets or sets the order status.
/// </summary>
public string Status { get; set; }
/// <summary>
/// Gets or sets the reference customer identifier.
/// Gets the total price for the order.
/// </summary>
public string ReferenceCustomerId { get; set; }
/// <remarks>
/// This information will not be returned unless explicitly requested.
/// </remarks>
public double? TotalPrice { get; private set; }
/// <summary>
/// Gets the transaction type.
/// </summary>
public string TransactionType { get; private set; }
}
}

Просмотреть файл

@ -21,6 +21,11 @@ namespace Microsoft.Store.PartnerCenter.Models.Orders
ProvisioningContext = new Dictionary<string, string>();
}
/// <summary>
/// Gets or sets the friendly name for the result contract (subscription).
/// </summary>
public string FriendlyName { get; set; }
/// <summary>
/// Gets or sets the line item number.
/// </summary>
@ -31,35 +36,48 @@ namespace Microsoft.Store.PartnerCenter.Models.Orders
/// </summary>
public string OfferId { get; set; }
/// <summary>
/// Gets or sets the resulting subscription identifier.
/// </summary>
public string SubscriptionId { get; set; }
/// <summary>
/// Gets or sets the parent subscription identifier.
/// This parameter should only be set for add-on offer purchase. This applies to Order updates only.
/// </summary>
public string ParentSubscriptionId { get; set; }
/// <summary>
/// Gets or sets the friendly name for the result contract (subscription).
/// </summary>
public string FriendlyName { get; set; }
/// <summary>
/// Gets or sets the product quantity.
/// </summary>
public int Quantity { get; set; }
/// <summary>
/// Gets or sets the partner identifier on record.
/// </summary>
public string PartnerIdOnRecord { get; set; }
/// <summary>
/// Gets or sets the total price for the order.
/// </summary>
/// <remarks>
/// This information will not be returned unless explicitly requested.
/// </remarks>
public Pricing Pricing { get; set; }
/// <summary>
/// Gets or sets the provisioning context for the offer.
/// </summary>
public Dictionary<string, string> ProvisioningContext { get; private set; }
/// <summary>
/// Gets or sets the product quantity.
/// </summary>
public int Quantity { get; set; }
/// <summary>
/// Gets or sets the resulting subscription identifier.
/// </summary>
public string SubscriptionId { get; set; }
/// <summary>
/// Gets the term duration.
/// </summary>
public string TermDuration { get; private set; }
/// <summary>
/// Gets the transaction type.
/// </summary>
public string TransactionType { get; private set; }
}
}

Просмотреть файл

@ -0,0 +1,24 @@
// -----------------------------------------------------------------------
// <copyright file="OrderLineItemActivationLink.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Orders
{
/// <summary>
/// Represents the activation link for the order line item.
/// </summary>
public sealed class OrderLineItemActivationLink
{
/// <summary>
/// Gets or sets the line item number.
/// </summary>
public int LineItemNumber { get; set; }
/// <summary>
/// Gets or sets the activation link.
/// </summary>
public Link Link { get; set; }
}
}

Просмотреть файл

@ -6,29 +6,39 @@
namespace Microsoft.Store.PartnerCenter.Models.Orders
{
using Newtonsoft.Json;
/// <summary>
/// Bundles the links for an order line item.
/// </summary>
public sealed class OrderLineItemLinks
{
/// <summary>
/// Gets or sets the subscription link for the order line item.
/// Gets or sets the activation links for the order line item.
/// </summary>
[JsonProperty]
public Link Subscription { get; set; }
public Link ActivationLinks { get; set; }
/// <summary>
/// Gets or sets the SKU link for the order line item.
/// Gets or sets the availability link for the order line item.
/// </summary>
[JsonProperty]
public Link Sku { get; set; }
public Link Availability { get; set; }
/// <summary>
/// Gets or sets the product link for the order line item.
/// </summary>
public Link Product { get; set; }
/// <summary>
/// Gets or sets the provisioning status link for the order line item.
/// </summary>
[JsonProperty]
public Link ProvisioningStatus { get; set; }
/// <summary>
/// Gets or sets the SKU link for the order line item.
/// </summary>
public Link Sku { get; set; }
/// <summary>
/// Gets or sets the subscription link for the order line item.
/// </summary>
public Link Subscription { get; set; }
}
}

Просмотреть файл

@ -6,17 +6,19 @@
namespace Microsoft.Store.PartnerCenter.Models.Orders
{
using Newtonsoft.Json;
/// <summary>
/// Bundles the links for an order.
/// </summary>
public sealed class OrderLinks : StandardResourceLinks
{
/// <summary>
/// Gets or sets the link to the patch operation.
/// </summary>
public Link PatchOperation { get; set; }
/// <summary>
/// Gets or sets the link to the provisioning status of an order.
/// </summary>
[JsonProperty]
public Link ProvisioningStatus { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,39 @@
// -----------------------------------------------------------------------
// <copyright file="Pricing.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Orders
{
/// <summary>
/// Represents the pricing details for a line item.
/// </summary>
public sealed class Pricing
{
/// <summary>
/// Gets or sets the discounted price.
/// </summary>
public double? DiscountedPrice { get; set; }
/// <summary>
/// Gets or sets the extended price.
/// </summary>
public double? ExtendedPrice { get; set; }
/// <summary>
/// Gets or sets the list price.
/// </summary>
public double? ListPrice { get; set; }
/// <summary>
/// Gets or sets the prorated price.
/// </summary>
public double? ProratedPrice { get; set; }
/// <summary>
/// Gets or sets the price.
/// </summary>
public double? Price { get; set; }
}
}

Просмотреть файл

@ -1,54 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="SkuDownloadOptions.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Models.Products
{
/// <summary>
/// Class that represents a SKU download option.
/// </summary>
public class SkuDownloadOptions
{
/// <summary>
/// Gets or sets the option key.
/// </summary>
public string OptionKey { get; set; }
/// <summary>
/// Gets or sets the option title.
/// </summary>
public string OptionTitle { get; set; }
/// <summary>
/// Gets or sets the display rank.
/// </summary>
public int DisplayRank { get; set; }
/// <summary>
/// Gets or sets the CPU and file type.
/// </summary>
public string CPUandFileType { get; set; }
/// <summary>
/// Gets or sets the language code.
/// </summary>
public string LanguageCode { get; set; }
/// <summary>
/// Gets or sets the language display name.
/// </summary>
public string LanguageName { get; set; }
/// <summary>
/// Gets or sets the file size in bytes.
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// Gets or sets the SKU download link.
/// </summary>
public Link DownloadLink { get; set; }
}
}

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.Store.PartnerCenter.Offers
/// <summary>
/// Represents the operations that can be performed on offers.
/// </summary>
public interface IOfferCollection : IPartnerComponent<string>, IEntityCollectionRetrievalOperations<Offer, ResourceCollection<Offer>>, IEntitySelector<IOffer>
public interface IOfferCollection : IPartnerComponent<string>, IEntityCollectionRetrievalOperations<Offer, ResourceCollection<Offer>>, IEntitySelector<string, IOffer>
{
/// <summary>
/// Retrieves the operations that can be applied on offers that belong to an offer category.

Просмотреть файл

@ -7,6 +7,8 @@
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using System.Threading;
using System.Threading.Tasks;
using GenericOperations;
using Models.Orders;
@ -15,9 +17,22 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// </summary>
public interface IOrder : IPartnerComponent<Tuple<string, string>>, IEntityGetOperations<Order>, IEntityPatchOperations<Order>
{
/// <summary>
/// Gets line item collection operations.
/// </summary>
IOrderLineItemCollection OrderLineItems { get; }
/// <summary>
/// Gets the order provisioning status operations.
/// </summary>
IOrderProvisioningStatus ProvisioningStatus { get; }
/// <summary>
/// Gets the order information.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The order information including pricing details (based on access permissions) when requested.</returns>
Task<Order> GetAsync(bool includePrice, CancellationToken cancellationToken = default);
}
}

Просмотреть файл

@ -7,6 +7,8 @@
namespace Microsoft.Store.PartnerCenter.Orders
{
using GenericOperations;
using System.Threading;
using System.Threading.Tasks;
using Models;
using Models.Offers;
using Models.Orders;
@ -14,7 +16,7 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// <summary>
/// Encapsulates the order collection operations.
/// </summary>
public interface IOrderCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Order, ResourceCollection<Order>>, IEntityCreateOperations<Order, Order>, IEntitySelector<IOrder>
public interface IOrderCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Order, ResourceCollection<Order>>, IEntityCreateOperations<Order, Order>, IEntitySelector<string, IOrder>
{
/// <summary>
/// Gets the order collection behavior given a billing cycle type.
@ -22,5 +24,13 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// <param name="billingCycleType">The billing cycle type.</param>
/// <returns>The order collection by billing cycle type.</returns>
IOrderCollectionByBillingCycleType ByBillingCycleType(BillingCycleType billingCycleType);
/// <summary>
/// Gets a collection of orders.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The collection of orders.</returns>
Task<ResourceCollection<Order>> GetAsync(bool includePrice, CancellationToken cancellationToken = default);
}
}

Просмотреть файл

@ -7,6 +7,8 @@
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using System.Threading;
using System.Threading.Tasks;
using GenericOperations;
using Models;
using Models.Offers;
@ -17,5 +19,12 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// </summary>
public interface IOrderCollectionByBillingCycleType : IPartnerComponent<Tuple<string, BillingCycleType>>, IEntireEntityCollectionRetrievalOperations<Order, ResourceCollection<Order>>
{
/// <summary>
/// Gets all customer orders.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The customer orders.</returns>
Task<ResourceCollection<Order>> GetAsync(bool includePrice, CancellationToken cancellationToken = default);
}
}

Просмотреть файл

@ -0,0 +1,21 @@
// -----------------------------------------------------------------------
// <copyright file="IOrderLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
/// <summary>
/// Represents the available order line item operations.
/// </summary>
public interface IOrderLineItem : IPartnerComponent<Tuple<string, string, int>>
{
/// <summary>
/// Gets the available customer order line item activation link operations.
/// </summary>
IOrderLineItemActivationLink ActivationLink { get; }
}
}

Просмотреть файл

@ -0,0 +1,20 @@
// -----------------------------------------------------------------------
// <copyright file="IOrderLineItemActivationLink.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using GenericOperations;
using Models;
using Models.Orders;
/// <summary>
/// Represents the customer order line item activation link operations.
/// </summary>
public interface IOrderLineItemActivationLink : IPartnerComponent<Tuple<string, string, int>>, IEntityGetOperations<ResourceCollection<OrderLineItemActivationLink>>
{
}
}

Просмотреть файл

@ -0,0 +1,18 @@
// -----------------------------------------------------------------------
// <copyright file="IOrderLineItemCollection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using GenericOperations;
/// <summary>
/// Represents the available order line item operations.
/// </summary>
public interface IOrderLineItemCollection : IPartnerComponent<Tuple<string, string>>, IEntitySelector<int, IOrderLineItem>
{
}
}

Просмотреть файл

@ -40,12 +40,27 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The customer orders.</returns>
public async Task<ResourceCollection<Order>> GetAsync(CancellationToken cancellationToken = default)
{
return await GetAsync(false, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Gets all customer orders.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The customer orders.</returns>
public async Task<ResourceCollection<Order>> GetAsync(bool includePrice, CancellationToken cancellationToken = default)
{
IDictionary<string, string> parameters = new Dictionary<string, string>
{
{
PartnerService.Instance.Configuration.Apis.GetOrdersByBillingCyleType.Parameters.BillingType,
Context.Item2.ToString()
},
{
PartnerService.Instance.Configuration.Apis.GetOrdersByBillingCyleType.Parameters.IncludePrice,
includePrice.ToString(CultureInfo.InvariantCulture)
}
};

Просмотреть файл

@ -7,6 +7,7 @@
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
@ -97,5 +98,33 @@ namespace Microsoft.Store.PartnerCenter.Orders
new ResourceCollectionConverter<Order>(),
cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Gets a collection of orders.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The collection of orders.</returns>
public async Task<ResourceCollection<Order>> GetAsync(bool includePrice, CancellationToken cancellationToken = default)
{
IDictionary<string, string> parameters = new Dictionary<string, string>
{
{
PartnerService.Instance.Configuration.Apis.GetOrders.Parameters.IncludePrice,
includePrice.ToString(CultureInfo.InvariantCulture)
}
};
return await Partner.ServiceClient.GetAsync<ResourceCollection<Order>>(
new Uri(
string.Format(
CultureInfo.InvariantCulture,
$"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.GetOrders.Path}",
Context),
UriKind.Relative),
parameters,
new ResourceCollectionConverter<Order>(),
cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
// -----------------------------------------------------------------------
// <copyright file="OrderLineItemActivationLinkOperations.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Extensions;
using Models;
using Models.Orders;
/// <summary>
/// Implements the customer order line item activation link operations.
/// </summary>
internal class OrderLineItemActivationLinkOperations : BasePartnerComponent<Tuple<string, string, int>>, IOrderLineItemActivationLink
{
/// <summary>
/// Initializes a new instance of the <see cref="OrderLineItemActivationLinkOperations"/> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="customerId">The customer identifier.</param>
/// <param name="orderId">The order identifier.</param>
/// <param name="lineItemNumber">The line item number.</param>
public OrderLineItemActivationLinkOperations(IPartner rootPartnerOperations, string customerId, string orderId, int lineItemNumber)
: base(rootPartnerOperations, new Tuple<string, string, int>(customerId, orderId, lineItemNumber))
{
customerId.AssertNotEmpty(nameof(customerId));
orderId.AssertNotEmpty(nameof(orderId));
lineItemNumber.AssertNotNull(nameof(lineItemNumber));
}
/// <summary>
/// Retrieves the order line item activation link collection.
/// </summary>
/// <returns>The order line item activation link collection.</returns>
public async Task<ResourceCollection<OrderLineItemActivationLink>> GetAsync(CancellationToken cancellationToken = default)
{
return await Partner.ServiceClient.GetAsync<ResourceCollection<OrderLineItemActivationLink>>(
new Uri(
string.Format(
CultureInfo.InvariantCulture,
$"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.GetActivationLinksByLineItemNumber.Path}",
Context.Item1,
Context.Item2,
Context.Item3),
UriKind.Relative),
cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
// -----------------------------------------------------------------------
// <copyright file="IOrderLineItemCollection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using Extensions;
/// <summary>
/// Implements the available order line item operations.
/// </summary>
internal class OrderLineItemCollectionOperations : BasePartnerComponent<Tuple<string, string>>, IOrderLineItemCollection
{
/// <summary>
/// Initializes a new instance of the <see cref="OrderLineItemCollectionOperations"/> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="customerId">The customer identifier.</param>
/// <param name="orderId">The order identifier.</param>
public OrderLineItemCollectionOperations(IPartner rootPartnerOperations, string customerId, string orderId)
: base(rootPartnerOperations, new Tuple<string, string>(customerId, orderId))
{
customerId.AssertNotEmpty(nameof(customerId));
orderId.AssertNotEmpty(nameof(orderId));
}
/// <summary>
/// Gets the order line item operations.
/// </summary>
/// <param name="id">The order line item number.</param>
/// <returns>The order line item operations.</returns>
public IOrderLineItem this[int id] => ById(id);
/// <summary>
/// Gets the order line item operations.
/// </summary>
/// <param name="id">The order line item number.</param>
/// <returns>The order line item operations.</returns>
public IOrderLineItem ById(int id) => new OrderLineItemOperations(Partner, Context.Item1, Context.Item2, id);
}
}

Просмотреть файл

@ -0,0 +1,34 @@
// -----------------------------------------------------------------------
// <copyright file="OrderLineItemOperations.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using Extensions;
internal class OrderLineItemOperations : BasePartnerComponent<Tuple<string, string, int>>, IOrderLineItem
{
/// <summary>
/// Initializes a new instance of the <see cref="OrderLineItemOperations"/> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="customerId">The customer identifier.</param>
/// <param name="orderId">The order identifier.</param>
/// <param name="lineItemNumber">The line item number</param>
public OrderLineItemOperations(IPartner rootPartnerOperations, string customerId, string orderId, int lineItemNumber)
: base(rootPartnerOperations, new Tuple<string, string, int>(customerId, orderId, lineItemNumber))
{
customerId.AssertNotEmpty(nameof(customerId));
orderId.AssertNotEmpty(nameof(orderId));
lineItemNumber.AssertNotNull(nameof(lineItemNumber));
}
/// <summary>
/// Gets the available customer order line item activation link operations.
/// </summary>
public IOrderLineItemActivationLink ActivationLink => new OrderLineItemActivationLinkOperations(Partner, Context.Item1, Context.Item2, Context.Item3);
}
}

Просмотреть файл

@ -7,6 +7,7 @@
namespace Microsoft.Store.PartnerCenter.Orders
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
@ -31,6 +32,11 @@ namespace Microsoft.Store.PartnerCenter.Orders
orderId.AssertNotEmpty(nameof(orderId));
}
/// <summary>
/// Gets line item collection operations.
/// </summary>
public IOrderLineItemCollection OrderLineItems => new OrderLineItemCollectionOperations(Partner, Context.Item1, Context.Item2);
/// <summary>
/// Gets the order provisioning status operations.
/// </summary>
@ -43,14 +49,34 @@ namespace Microsoft.Store.PartnerCenter.Orders
/// <returns>The customer order.</returns>
public async Task<Order> GetAsync(CancellationToken cancellationToken = default)
{
return await GetAsync(false, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Gets the order information.
/// </summary>
/// <param name="includePrice">A flag indicating whether to include pricing details in the order information or not.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The order information including pricing details (based on access permissions) when requested.</returns>
public async Task<Order> GetAsync(bool includePrice, CancellationToken cancellationToken = default)
{
IDictionary<string, string> parameters = new Dictionary<string, string>
{
{
PartnerService.Instance.Configuration.Apis.GetOrder.Parameters.IncludePrice,
includePrice.ToString(CultureInfo.InvariantCulture)
}
};
return await Partner.ServiceClient.GetAsync<Order>(
new Uri(
string.Format(
CultureInfo.InvariantCulture,
$"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.GetOrder.Path}",
Context.Item1,
Context.Item1,
Context.Item2),
UriKind.Relative),
parameters,
cancellationToken).ConfigureAwait(false);
}

Просмотреть файл

@ -9,7 +9,7 @@
<Copyright>Copyright © 2019</Copyright>
<NeutralLanguage>en-US</NeutralLanguage>
<Product>Microsoft Partner Center</Product>
<Version>1.5.1903.1</Version>
<Version>1.5.1903.2</Version>
<PackageLicenseUrl>https://github.com/Microsoft/Partner-Center-PowerShell/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/Microsoft/Partner-Center-PowerShell</PackageProjectUrl>
<RepositoryUrl>https://github.com/Microsoft/Partner-Center-PowerShell.git</RepositoryUrl>

Просмотреть файл

@ -14,7 +14,7 @@ namespace Microsoft.Store.PartnerCenter.Products
/// <summary>
/// Holds operations that can be performed on availabilities.
/// </summary>
public interface IAvailabilityCollection : IPartnerComponent<Tuple<string, string, string>>, IEntireEntityCollectionRetrievalOperations<Availability, ResourceCollection<Availability>>, IEntitySelector<IAvailability>
public interface IAvailabilityCollection : IPartnerComponent<Tuple<string, string, string>>, IEntireEntityCollectionRetrievalOperations<Availability, ResourceCollection<Availability>>, IEntitySelector<string, IAvailability>
{
/// <summary>
/// Gets the operations that can be applied on availabilities filtered by a specific target segment.

Просмотреть файл

@ -11,7 +11,7 @@ namespace Microsoft.Store.PartnerCenter.Products
/// <summary>
/// Holds operations that can be performed on products from a given country.
/// </summary>
public interface IProductCollectionByCountry : IPartnerComponent<string>, IEntitySelector<IProduct>
public interface IProductCollectionByCountry : IPartnerComponent<string>, IEntitySelector<string, IProduct>
{
/// <summary>

Просмотреть файл

@ -19,10 +19,5 @@ namespace Microsoft.Store.PartnerCenter.Products
/// Gets the operations for the current SKU's availabilities.
/// </summary>
IAvailabilityCollection Availabilities { get; }
/// <summary>
/// Gets the operations for the current SKU's download options.
/// </summary>
ISkuDownloadOptions DownloadOptions { get; }
}
}

Просмотреть файл

@ -14,7 +14,7 @@ namespace Microsoft.Store.PartnerCenter.Products
/// <summary>
/// Holds operations that can be performed on SKUs.
/// </summary>
public interface ISkuCollection : IPartnerComponent<Tuple<string, string>>, IEntitySelector<ISku>, IEntireEntityCollectionRetrievalOperations<Sku, ResourceCollection<Sku>>
public interface ISkuCollection : IPartnerComponent<Tuple<string, string>>, IEntitySelector<string, ISku>, IEntireEntityCollectionRetrievalOperations<Sku, ResourceCollection<Sku>>
{
/// <summary>
/// Gets the operations that can be applied on skus that belong to a segment.

Просмотреть файл

@ -1,20 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="ISkuDownloadOptions.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Products
{
using System;
using GenericOperations;
using Models;
using Models.Products;
/// <summary>
/// Defines the behavior of the SKU's download options.
/// </summary>
public interface ISkuDownloadOptions : IPartnerComponent<Tuple<string, string, string>>, IEntireEntityCollectionRetrievalOperations<SkuDownloadOptions, ResourceCollection<SkuDownloadOptions>>
{
}
}

Просмотреть файл

@ -1,66 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="SkuDownloadOptionsOperations.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Products
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Extensions;
using Models;
using Models.JsonConverters;
using Models.Products;
/// <summary>
/// SKU download options operations implementation.
/// </summary>
internal class SkuDownloadOptionsOperations : BasePartnerComponent<Tuple<string, string, string>>, ISkuDownloadOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="SkuDownloadOptionsOperations" /> class.
/// </summary>
/// <param name="rootPartnerOperations">The root partner operations instance.</param>
/// <param name="productId">The product id to get its download options.</param>
/// <param name="skuId">The sku id to get its download options.</param>
/// <param name="country">The country on which to base the sku.</param>
public SkuDownloadOptionsOperations(IPartner rootPartnerOperations, string productId, string skuId, string country)
: base(rootPartnerOperations, new Tuple<string, string, string>(productId, skuId, country))
{
productId.AssertNotEmpty(nameof(productId));
skuId.AssertNotEmpty(nameof(skuId));
country.AssertNotEmpty(nameof(country));
}
/// <summary>
/// Gets the download options for the provided SKU.
/// </summary>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The download options for the provided SKU.</returns>
public async Task<ResourceCollection<SkuDownloadOptions>> GetAsync(CancellationToken cancellationToken = default)
{
IDictionary<string, string> parameters = new Dictionary<string, string>
{
{
PartnerService.Instance.Configuration.Apis.GetSkuDownloadOptions.Parameters.Country,
Context.Item3
}
};
return await Partner.ServiceClient.GetAsync<ResourceCollection<SkuDownloadOptions>>(
new Uri(
string.Format(CultureInfo.InvariantCulture,
$"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.GetSkuDownloadOptions.Path}",
Context.Item1,
Context.Item2),
UriKind.Relative),
parameters,
new ResourceCollectionConverter<SkuDownloadOptions>(),
cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -24,10 +24,6 @@ namespace Microsoft.Store.PartnerCenter.Products
/// </summary>
private readonly Lazy<IAvailabilityCollection> availabilities;
/// <summary>Provides access to the SKU download options operations.
/// </summary>
private readonly Lazy<ISkuDownloadOptions> downloadOptions;
/// <summary>
/// Initializes a new instance of the <see cref="SkuOperations" /> class.
/// </summary>
@ -43,7 +39,6 @@ namespace Microsoft.Store.PartnerCenter.Products
country.AssertNotEmpty(nameof(country));
availabilities = new Lazy<IAvailabilityCollection>(() => new AvailabilityCollectionOperations(rootPartnerOperations, productId, skuId, country));
downloadOptions = new Lazy<ISkuDownloadOptions>(() => new SkuDownloadOptionsOperations(rootPartnerOperations, productId, skuId, country));
}
/// <summary>
@ -51,10 +46,6 @@ namespace Microsoft.Store.PartnerCenter.Products
/// </summary>
public IAvailabilityCollection Availabilities => availabilities.Value;
/// <summary>
/// Gets the operations for the current SKU's download options.
/// </summary>
public ISkuDownloadOptions DownloadOptions => downloadOptions.Value;
/// <summary>
/// Gets the information for the SKU.

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.Store.PartnerCenter.ServiceRequests
/// <summary>
/// Represents the behavior of service requests.
/// </summary>
public interface IServiceRequestCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<ServiceRequest, ResourceCollection<ServiceRequest>>, IEntitySelector<IServiceRequest>
public interface IServiceRequestCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<ServiceRequest, ResourceCollection<ServiceRequest>>, IEntitySelector<string, IServiceRequest>
{
/// <summary>
/// Queries service requests.

Просмотреть файл

@ -14,7 +14,7 @@ namespace Microsoft.Store.PartnerCenter.Subscriptions
/// <summary>
/// Represents the behavior of the customer subscriptions as a whole.
/// </summary>
public interface ISubscriptionCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Subscription, ResourceCollection<Subscription>>, IEntitySelector<ISubscription>
public interface ISubscriptionCollection : IPartnerComponent<string>, IEntireEntityCollectionRetrievalOperations<Subscription, ResourceCollection<Subscription>>, IEntitySelector<string, ISubscription>
{
/// <summary>
/// Groups customer subscriptions by an order.

Просмотреть файл

@ -37,6 +37,12 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
[ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled | RegexOptions.IgnoreCase)]
public string CustomerId { get; set; }
/// <summary>
/// Gets or sets a flag indicating whether to include pricing details in the order information.
/// </summary>
[Parameter(HelpMessage = "A flag indicating whether to include pricing details in the order information.", Mandatory = false)]
public SwitchParameter IncludePrice { get; set; }
/// <summary>
/// Gets or sets the optional order identifier.
/// </summary>
@ -75,11 +81,12 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
private void GetCustomerOrder(string customerId, string orderId)
{
Order order;
bool includePrice = IncludePrice.ToBool();
customerId.AssertNotEmpty(nameof(customerId));
orderId.AssertNotEmpty(nameof(orderId));
order = Partner.Customers.ById(customerId).Orders.ById(orderId).GetAsync().GetAwaiter().GetResult();
order = Partner.Customers.ById(customerId).Orders.ById(orderId).GetAsync(includePrice).GetAwaiter().GetResult();
WriteObject(new PSOrder(order));
}
@ -95,16 +102,17 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
private void GetCustomerOrders(string customerId, BillingCycleType? billingCycle)
{
IEnumerable<Order> orders;
bool includePrice = IncludePrice.ToBool();
customerId.AssertNotEmpty(nameof(customerId));
if (billingCycle.HasValue)
{
orders = Partner.Customers.ById(customerId).Orders.ByBillingCycleType(billingCycle.Value).GetAsync().GetAwaiter().GetResult().Items;
orders = Partner.Customers.ById(customerId).Orders.ByBillingCycleType(billingCycle.Value).GetAsync(includePrice).GetAwaiter().GetResult().Items;
}
else
{
orders = Partner.Customers.ById(customerId).Orders.GetAsync().GetAwaiter().GetResult().Items;
orders = Partner.Customers.ById(customerId).Orders.GetAsync(includePrice).GetAwaiter().GetResult().Items;
}
WriteObject(orders.Select(o => new PSOrder(o)), true);

Просмотреть файл

@ -0,0 +1,49 @@
// -----------------------------------------------------------------------
// <copyright file="GetPartnerCustomerOrderLineItemActivationLink.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
using System.Management.Automation;
using System.Text.RegularExpressions;
using PartnerCenter.Models.Orders;
/// <summary>
/// Get the activation link for the specified order line item from the partner service.
/// </summary>
[Cmdlet(VerbsCommon.Get, "PartnerCustomerOrderLineItemActivationLink")]
[OutputType(typeof(OrderLineItemActivationLink))]
public class GetPartnerCustomerOrderLineItemActivationLink : PartnerPSCmdlet
{
/// <summary>
/// Gets or sets the identifier of the customer.
/// </summary>
[Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)]
[ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled | RegexOptions.IgnoreCase)]
public string CustomerId { get; set; }
/// <summary>
/// Gets or sets the order identifier.
/// </summary>
[Parameter(HelpMessage = "The identifier for the order.", Mandatory = true)]
[ValidateNotNullOrEmpty]
public string OrderId { get; set; }
/// <summary>
/// Gets or sets the order line item number.
/// </summary>
[Parameter(HelpMessage = "The order line item number.", Mandatory = true)]
[ValidateNotNull]
public int OrderLineItemNumber { get; set; }
/// <summary>
/// Executes the operations associated with the cmdlet.
/// </summary>
public override void ExecuteCmdlet()
{
WriteObject(Partner.Customers[CustomerId].Orders[OrderId].OrderLineItems[OrderLineItemNumber].ActivationLink.GetAsync().GetAwaiter().GetResult().Items, true);
}
}
}

Просмотреть файл

@ -25,9 +25,16 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
/// Gets or sets the billing provider.
/// </summary>
[Parameter(HelpMessage = "The billing provide for the line items.", Mandatory = true)]
[ValidateSet(nameof(BillingProvider.Azure), nameof(BillingProvider.AzureDataMarket), nameof(BillingProvider.Office), nameof(BillingProvider.OneTime))]
[ValidateSet(nameof(BillingProvider.Azure), nameof(BillingProvider.Office), nameof(BillingProvider.OneTime), nameof(BillingProvider.External))]
public BillingProvider BillingProvider { get; set; }
/// <summary>
/// Gets or sets the currenty code.
/// </summary>
[Parameter(HelpMessage = "The currency code for the unbilled line items.", Mandatory = false)]
[ValidateNotNull]
public string CurrencyCode { get; set; }
/// <summary>
/// Gets or set the identifier for the invoice.
/// </summary>
@ -56,7 +63,15 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
List<InvoiceLineItem> items;
ResourceCollection<InvoiceLineItem> lineItems;
lineItems = Partner.Invoices[InvoiceId].By(BillingProvider, LineItemType).GetAsync().GetAwaiter().GetResult();
if (BillingProvider == BillingProvider.External)
{
lineItems = Partner.Invoices[InvoiceId].By(BillingProvider, LineItemType, CurrencyCode, UnbilledPeriod.Current).GetAsync().GetAwaiter().GetResult();
}
else
{
lineItems = Partner.Invoices[InvoiceId].By(BillingProvider, LineItemType).GetAsync().GetAwaiter().GetResult();
}
enumerator = Partner.Enumerators.InvoiceLineItems.Create(lineItems);
items = new List<InvoiceLineItem>();
@ -72,10 +87,6 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
WriteObject(items.Select(i => new PSUsageBasedLineItem((UsageBasedLineItem)i)), true);
}
else if (BillingProvider == BillingProvider.AzureDataMarket)
{
WriteObject(items.Select(i => new PSAzureDataMarketLineItem((AzureDataMarketLineItem)i)), true);
}
else if (BillingProvider == BillingProvider.Office)
{
WriteObject(items.Select(i => new PSLicenseBasedLineItem((LicenseBasedLineItem)i)), true);
@ -84,6 +95,10 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
WriteObject(items.Select(i => new PSOneTimeInvoiceLineItem((OneTimeInvoiceLineItem)i)), true);
}
else if (BillingProvider == BillingProvider.External)
{
WriteObject(items.Select(i => new PSDailyRatedUsageLineItem((DailyRatedUsageLineItem)i)), true);
}
}
else
{
@ -91,9 +106,9 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
WriteObject(items.Select(i => new PSDailyUsageLineItem((DailyUsageLineItem)i)), true);
}
else if (BillingProvider == BillingProvider.AzureDataMarket)
else if (BillingProvider == BillingProvider.External)
{
WriteObject(items.Select(i => new PSAzureDataMarketDailyUsageLineItem((AzureDataMarketDailyUsageLineItem)i)), true);
WriteObject(items.Select(i => new PSDailyRatedUsageLineItem((DailyRatedUsageLineItem)i)), true);
}
}
}

Просмотреть файл

@ -1,56 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="PartnerInvoiceUnbilledThirdParty.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Authentication;
using Models.Invoices;
using PartnerCenter.Enumerators;
using PartnerCenter.Models;
using PartnerCenter.Models.Invoices;
[Cmdlet(VerbsCommon.Get, "PartnerInvoiceUnbilledThirdPartyLineItem")]
[OutputType(typeof(PSDailyRatedUsageReconLineItem))]
public class GetPartnerInvoiceUnbilledThirdPartyLineItem : PartnerPSCmdlet
{
/// <summary>
/// Gets or sets the currenty code.
/// </summary>
[Parameter(HelpMessage = "The currency code for the unbilled line items.", Mandatory = true)]
[ValidateNotNull]
public string CurrencyCode { get; set; }
/// <summary>
/// Gets or sets the types of authentication supported by the command.
/// </summary>
public override AuthenticationTypes SupportedAuthentication => AuthenticationTypes.AppPlusUser;
/// <summary>
/// Executes the operations associated with the cmdlet.
/// </summary>
public override void ExecuteCmdlet()
{
IResourceCollectionEnumerator<ResourceCollection<InvoiceLineItem>> enumerator;
List<InvoiceLineItem> items;
ResourceCollection<InvoiceLineItem> lineItems;
lineItems = Partner.Invoices["unbilled"].By(BillingProvider.External, InvoiceLineItemType.UsageLineItems, CurrencyCode, UnbilledPeriod.Current).GetAsync().GetAwaiter().GetResult();
enumerator = Partner.Enumerators.InvoiceLineItems.Create(lineItems);
items = new List<InvoiceLineItem>();
while (enumerator.HasValue)
{
items.AddRange(enumerator.Current.Items);
enumerator.NextAsync().GetAwaiter().GetResult();
}
WriteObject(items.Select(i => new PSDailyRatedUsageReconLineItem((DailyRatedUsageReconLineItem)i)), true);
}
}
}

Просмотреть файл

@ -1,64 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="PSAzureDataMarketDailyUsageLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices
{
using System;
using Common;
using PartnerCenter.Models.Invoices;
/// <summary>
/// Defines the properties of an Azure data market daily usage line item.
/// </summary>
public sealed class PSAzureDataMarketDailyUsageLineItem : PSBaseAzureDataMarketLineItem
{
/// <summary>
/// Initializes a new instance of the <see cref="PSAzureDataMarketDailyUsageLineItem" /> class.
/// </summary>
public PSAzureDataMarketDailyUsageLineItem()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="PSAzureDataMarketDailyUsageLineItem" /> class.
/// </summary>
/// <param name="lineItem">The base line item for this instance.</param>
public PSAzureDataMarketDailyUsageLineItem(AzureDataMarketDailyUsageLineItem lineItem)
{
this.CopyFrom(lineItem);
}
/// <summary>
/// Gets the type of invoice line item.
/// </summary>
public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.UsageLineItems;
/// <summary>
/// Gets or sets the metered service name.
/// </summary>
/// <remarks>
/// Example: Storage.
/// </remarks>
public string MeteredServiceName { get; set; }
/// <summary>
/// Gets or sets the metered service type.
/// </summary>
/// <remarks>
/// Example: External.
/// </remarks>
public string MeteredServiceType { get; set; }
/// <summary>
/// Gets or sets the customer assigned friendly name for the resource instance.
/// </summary>
public string ResourceFriendlyName { get; set; }
/// <summary>
/// Gets or sets the usage date the resource.
/// </summary>
public DateTime UsageDate { get; set; }
}
}

Просмотреть файл

@ -1,100 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="PSAzureDataMarketLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices
{
using Common;
using PartnerCenter.Models.Invoices;
/// <summary>
/// Defines an Azure Data Market billing line item.
/// </summary>
public sealed class PSAzureDataMarketLineItem : PSBaseAzureDataMarketLineItem
{
/// <summary>
/// Initializes a new instance of the <see cref="PSAzureDataMarketLineItem" /> class.
/// </summary>
public PSAzureDataMarketLineItem()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="PSAzureDataMarketLineItem" /> class.
/// </summary>
/// <param name="lineItem">The base line item for this instance.</param>
public PSAzureDataMarketLineItem(AzureDataMarketLineItem lineItem)
{
this.CopyFrom(lineItem);
}
/// <summary>
/// Gets or sets the charge type.
/// </summary>
/// <remarks>
/// Example: Assess Usage Fee For Current Cycle.
/// </remarks>
public string ChargeType { get; set; }
/// <summary>
/// Gets or sets the discount on consumption.
/// </summary>
public decimal ConsumptionDiscount { get; set; }
/// <summary>
/// Gets or sets the price of quantity consumed.
/// </summary>
public decimal ConsumptionPrice { get; set; }
/// <summary>
/// Gets or sets the currency associated with the prices.
/// </summary>
public string CurrencyCode { get; set; }
/// <summary>
/// Gets or sets the units included in the order.
/// </summary>
public decimal IncludedQuantity { get; set; }
/// <summary>
/// Gets the type of invoice line item.
/// </summary>
public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.BillingLineItems;
/// <summary>
/// Gets or sets the price of each unit.
/// </summary>
public decimal ListPrice { get; set; }
/// <summary>
/// Gets or sets the quantity consumed above allowed usage.
/// </summary>
public decimal OverageQuantity { get; set; }
/// <summary>
/// Gets or sets the effective price after taxes.
/// </summary>
public decimal PostTaxEffectiveRate { get; set; }
/// <summary>
/// Gets or sets the total charges after tax. Pretax Charges + Tax Amount.
/// </summary>
public decimal PostTaxTotal { get; set; }
/// <summary>
/// Gets or sets the price charged before taxes.
/// </summary>
public decimal PretaxCharges { get; set; }
/// <summary>
/// Gets or sets the effective price before taxes.
/// </summary>
public decimal PretaxEffectiveRate { get; set; }
/// <summary>
/// Gets or sets the amount of tax charged.
/// </summary>
public decimal TaxAmount { get; set; }
}
}

Просмотреть файл

@ -1,107 +0,0 @@
// -----------------------------------------------------------------------
// <copyright file="PSBaseAzureDataMarketLineItem.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices
{
using System;
using PartnerCenter.Models.Invoices;
/// <summary>
/// Groups the common properties for all types of Azure data market invoice line items.
/// </summary>
public abstract class PSBaseAzureDataMarketLineItem : PSInvoiceLineItem
{
/// <summary>
/// Gets the billing provider.
/// </summary>
public override BillingProvider BillingProvider => BillingProvider.AzureDataMarket;
/// <summary>
/// Gets or sets the date charge ends.
/// </summary>
public DateTime ChargeEndDate { get; set; }
/// <summary>
/// Gets or sets the date charge begins.
/// </summary>
public DateTime ChargeStartDate { get; set; }
/// <summary>
/// Gets or sets the total units consumed.
/// </summary>
public decimal ConsumedQuantity { get; set; }
/// <summary>
/// Gets or sets the customer company name.
/// </summary>
public string CustomerCompanyName { get; set; }
/// <summary>
/// Gets or sets the invoice number.
/// </summary>
public string InvoiceNumber { get; set; }
/// <summary>
/// Gets or sets the order identifier.
/// </summary>
public string OrderId { get; set; }
/// <summary>
/// Gets or sets the partner's azure active directory tenant Id.
/// </summary>
public string PartnerId { get; set; }
/// <summary>
/// Gets or sets the partner identifier.
/// </summary>
/// <remarks>
/// For direct reseller, this is the partner's MPN identifier.
/// For indirect reseller, this is the VAR's MPN identifier.
/// </remarks>
public int PartnerMpnId { get; set; }
/// <summary>
/// Gets or sets the partner name.
/// </summary>
public string PartnerName { get; set; }
/// <summary>
/// Gets or sets the region associated with the resource instance.
/// </summary>
public string Region { get; set; }
/// <summary>
/// Gets or sets the resource name.
/// </summary>
/// <remarks>
/// Example: Database (GB/month).
/// </remarks>
public string ResourceName { get; set; }
/// <summary>
/// Gets or sets the service name.
/// </summary>
/// <remarks>
/// Example: Azure Data Service.
/// </remarks>
public string ServiceName { get; set; }
/// <summary>
/// Gets or sets the description of the subscription.
/// </summary>
public string SubscriptionDescription { get; set; }
/// <summary>
/// Gets or sets the subscription identifier.
/// </summary>
public string SubscriptionId { get; set; }
/// <summary>
/// Gets or sets the subscription name.
/// </summary>
public string SubscriptionName { get; set; }
}
}

Просмотреть файл

@ -13,19 +13,19 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices
/// <summary>
/// Represents unbilled, billed recon line items for daily rated usage.
/// </summary>
public sealed class PSDailyRatedUsageReconLineItem : PSInvoiceLineItem
public sealed class PSDailyRatedUsageLineItem : PSInvoiceLineItem
{
/// <summary>
/// Initializes a new instance of the <see cref="PSDailyRatedUsageReconLineItem" /> class.
/// Initializes a new instance of the <see cref="PSDailyRatedUsageLineItem" /> class.
/// </summary>
public PSDailyRatedUsageReconLineItem()
public PSDailyRatedUsageLineItem()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="PSDailyRatedUsageReconLineItem" /> class.
/// Initializes a new instance of the <see cref="PSDailyRatedUsageLineItem" /> class.
/// </summary>
/// <param name="lineItem">The base line item for this instance.</param>
public PSDailyRatedUsageReconLineItem(DailyRatedUsageReconLineItem lineItem)
public PSDailyRatedUsageLineItem(DailyRatedUsageLineItem lineItem)
{
this.CopyFrom(lineItem);
}

Просмотреть файл

@ -71,6 +71,19 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Orders
/// </summary>
public string Status { get; set; }
/// <summary>
/// Gets the total price for the order.
/// </summary>
/// <remarks>
/// This information will not be returned unless explicitly requested.
/// </remarks>
public double? TotalPrice { get; private set; }
/// <summary>
/// Gets the transaction type.
/// </summary>
public string TransactionType { get; private set; }
/// <summary>
/// Additional operations to be performed when cloning an instance of <see cref="Order"/> to an instance of <see cref="PSOrder" />.
/// </summary>

Просмотреть файл

@ -62,6 +62,14 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Orders
/// </remarks>
public string ParentSubscriptionId { get; set; }
/// <summary>
/// Gets or sets the pricing for the order.
/// </summary>
/// <remarks>
/// This information will not be returned unless explicitly requested.
/// </remarks>
public Pricing Pricing { get; set; }
/// <summary>
/// Gets the provisioning context for the offer.
/// </summary>
@ -77,6 +85,16 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Orders
/// </summary>
public string SubscriptionId { get; set; }
/// <summary>
/// Gets the term duration.
/// </summary>
public string TermDuration { get; private set; }
/// <summary>
/// Gets the transaction type.
/// </summary>
public string TransactionType { get; private set; }
/// <summary>
/// Additional operations to be performed when cloning an instance of <see cref="OrderLineItem" /> to an instance of <see cref="PSOrderLineItem" />.
/// </summary>

Просмотреть файл

@ -92,6 +92,7 @@
'Get-PartnerCustomerLicenseDeploymentInfo',
'Get-PartnerCustomerManagedService',
'Get-PartnerCustomerOrder',
'Get-PartnerCustomerOrderLineItemActivationLink',
'Get-PartnerCustomerQualification',
'Get-PartnerCustomerServiceCosts',
'Get-PartnerCustomerServiceCostsSummary',
@ -115,7 +116,6 @@
'Get-PartnerInvoiceSummary',
'Get-PartnerInvoiceStatement',
'Get-PartnerInvoiceTaxReceiptStatement',
'Get-PartnerInvoiceUnbilledThirdPartyLineItem',
'Get-PartnerLegalProfile',
'Get-PartnerLicenseDeploymentInfo',
'Get-PartnerLicenseUsageInfo',

Просмотреть файл

@ -93,6 +93,7 @@
'Get-PartnerCustomerLicenseDeploymentInfo',
'Get-PartnerCustomerManagedService',
'Get-PartnerCustomerOrder',
'Get-PartnerCustomerOrderLineItemActivationLink',
'Get-PartnerCustomerQualification',
'Get-PartnerCustomerServiceCosts',
'Get-PartnerCustomerServiceCostsSummary',
@ -116,7 +117,6 @@
'Get-PartnerInvoiceSummary',
'Get-PartnerInvoiceStatement',
'Get-PartnerInvoiceTaxReceiptStatement',
'Get-PartnerInvoiceUnbilledThirdPartyLineItem',
'Get-PartnerLegalProfile',
'Get-PartnerLicenseDeploymentInfo',
'Get-PartnerLicenseUsageInfo',

Просмотреть файл

@ -14,21 +14,14 @@
<RepositoryUrl>https://github.com/Microsoft/Partner-Center-PowerShell.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Version>1.5.1903.1</Version>
<Version>1.5.1903.2</Version>
</PropertyGroup>
<ItemGroup>
<!-- This None is here so the conditionally included files show up in the Solution Explorer -->
<None Include="**\*.cs;**\*.xml;**\*.axml" Exclude="obj\**\*.*;bin\**\*.*" />
<Compile Remove="Platforms\**\*.*" />
<Compile Remove="BreakingChangeAttribute.cs" />
<Compile Remove="BreakingChangeBaseAttribute.cs" />
<Compile Remove="Common\BreakingChangeAttributeHelper.cs" />
<None Remove="Commands\GetPartnerCustomerQualification.cs" />
<None Remove="Commands\GetPartnerInvoiceTaxReceiptStatement.cs" />
<None Remove="Commands\GetPartnerInvoiceUnbilledThirdPartyLineItem.cs" />
<None Remove="Commands\SetPartnerCustomerQualification.cs" />
<None Remove="Models\Invoices\PSDailyRatedUsageReconLineItem.cs" />
<None Remove="Commands\GetPartnerCustomerOrderLineItemActivationLink.cs" />
<ProjectReference Include="..\PartnerCenter\PartnerCenter.csproj" />
</ItemGroup>

Просмотреть файл

@ -15,7 +15,7 @@
<Description>Integration tests for the Partner Center project.</Description>
<Version>1.5.1903.1</Version>
<Version>1.5.1903.2</Version>
<NeutralLanguage>en-US</NeutralLanguage>

Просмотреть файл

@ -8,6 +8,22 @@
<AssemblyName>Microsoft.Store.PartnerCenter.Tests.UnitTests</AssemblyName>
<RootNamespace>Microsoft.Store.PartnerCenter.Tests.UnitTests</RootNamespace>
<Version>1.5.1903.2</Version>
<Authors>Microsoft</Authors>
<Company>Microsoft Corporation</Company>
<Product>Microsoft Partner Center PowerShell</Product>
<Description>Unit tests for the Microsoft Partner Center library used by the Microsoft Partner Center PowerShell module.</Description>
<PackageProjectUrl>https://github.com/Microsoft/Partner-Center-PowerShell</PackageProjectUrl>
<RepositoryUrl>https://github.com/Microsoft/Partner-Center-PowerShell.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -8,6 +8,22 @@
<AssemblyName>Microsoft.Store.PartnerCenter.PowerShell.Tests.UnitTests</AssemblyName>
<RootNamespace>Microsoft.Store.PartnerCenter.PowerShell.Tests.UnitTests</RootNamespace>
<Version>1.5.1903.2</Version>
<Authors>Microsoft</Authors>
<Company>Microsoft Corporation</Company>
<Product>Microsoft Partner Center PowerShell</Product>
<Description>Unit test for the Microsoft Partner Center PowerShell module.</Description>
<PackageProjectUrl>https://github.com/Microsoft/Partner-Center-PowerShell</PackageProjectUrl>
<RepositoryUrl>https://github.com/Microsoft/Partner-Center-PowerShell.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<ItemGroup>