Merge branch 'master' into brijeshp/telcoOverage

This commit is contained in:
Pothera Brijesh 2021-12-01 14:19:21 -08:00
Родитель 2e4dd4472c 975961b7cb
Коммит 3a59dc0181
9 изменённых файлов: 159 добавлений и 3 удалений

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

@ -92,6 +92,8 @@
<add key="DefaultOfferId" value="" />
<!-- The product ID to use in product scenarios, leave empty to prompt user to enter it -->
<add key="DefaultProductId" value="" />
<!-- The product promotion ID to use in product promotion scenarios, leave empty to prompt user to enter it -->
<add key="DefaultProductPromotionId" value="" />
<!-- The sku ID to use in sku scenarios, leave empty to prompt user to enter it -->
<add key="DefaultSkuId" value="" />
<!-- The availability ID to use in availability scenarios, leave empty to prompt user to enter it -->

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

@ -284,6 +284,20 @@ namespace Microsoft.Store.PartnerCenter.Samples
"The Product ID can't be empty");
}
/// <summary>
/// Obtains a product promotion ID to work with from the configuration if set there or prompts the user to enter it.
/// </summary>
/// <param name="promptMessage">An optional custom prompt message.</param>
/// <returns>The product promotion ID.</returns>
protected string ObtainProductPromotionId(string promptMessage = default(string))
{
return this.ObtainValue(
this.Context.Configuration.Scenario.DefaultProductPromotionId,
"Product Promotion Id",
string.IsNullOrWhiteSpace(promptMessage) ? "Enter the product promotion ID" : promptMessage,
"The Product Promotion ID can't be empty");
}
/// <summary>
/// Obtains a SKU ID to work with from the configuration if set there or prompts the user to enter it.
/// </summary>

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

@ -249,6 +249,17 @@ namespace Microsoft.Store.PartnerCenter.Samples.Configuration
}
}
/// <summary>
/// Gets the configured product promotion ID.
/// </summary>
public string DefaultProductPromotionId
{
get
{
return this.ConfigurationSection["DefaultProductPromotionId"];
}
}
/// <summary>
/// Gets the configured SKU ID.
/// </summary>

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

@ -0,0 +1,42 @@
// -----------------------------------------------------------------------
// <copyright file="GetValidationStatus.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Samples.Customers
{
using Microsoft.Store.PartnerCenter.Models.ValidationStatus.Enums;
/// <summary>
/// A scenario that showcases retrieving a customer's validation status.
/// </summary>
public class GetValidationStatus : BasePartnerScenario
{
/// <summary>
/// Initializes a new instance of the <see cref="GetValidationStatus"/> class.
/// </summary>
/// <param name="context">The scenario context.</param>
public GetValidationStatus(IScenarioContext context) : base("Get customer validation status.", context)
{
}
/// <summary>
/// Executes the scenario.
/// </summary>
protected override void RunScenario()
{
string customerIdToRetrieve = this.ObtainCustomerId("Enter the customer ID to retrieve the validation status for:");
var partnerOperations = this.Context.UserPartnerOperations;
this.Context.ConsoleHelper.StartProgress($"Retrieving customer's validation status for type: {ValidationType.Account}");
var validationTypeToFetch = ValidationType.Account;
var customerValidationStatus = partnerOperations.Customers.ById(customerIdToRetrieve).ValidationStatus.GetValidationStatus(validationTypeToFetch);
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(customerValidationStatus, "Customer Validation Status");
}
}
}

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

@ -0,0 +1,40 @@
// -----------------------------------------------------------------------
// <copyright file="GetProductPromotion.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Samples.Products
{
using System.Globalization;
/// <summary>
/// A scenario that retrieves product promotion details supported in a country.
/// </summary>
public class GetProductPromotion : BasePartnerScenario
{
/// <summary>
/// Initializes a new instance of the <see cref="GetProductPromotion"/> class.
/// </summary>
/// <param name="context">The scenario context.</param>
public GetProductPromotion(IScenarioContext context) : base("Get product promotion", context)
{
}
/// <summary>
/// Executes the scenario.
/// </summary>
protected override void RunScenario()
{
var partnerOperations = this.Context.UserPartnerOperations;
var productPromotionId = this.ObtainProductId("Enter the ID of the product promotion");
string countryCode = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the 2 digit country code of the product", "The country code can't be empty");
this.Context.ConsoleHelper.StartProgress(string.Format(CultureInfo.InvariantCulture, "Getting details for product promotion {0} in country {1}", productPromotionId, countryCode));
var productPromotion = partnerOperations.ProductPromotions.ByCountry(countryCode).ById(productPromotionId).Get();
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(productPromotion, string.Format(CultureInfo.InvariantCulture, "Product promotion details of {0}", productPromotionId));
}
}
}

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

@ -0,0 +1,40 @@
// -----------------------------------------------------------------------
// <copyright file="GetProductPromotions.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Samples.Products
{
using System.Globalization;
/// <summary>
/// A scenario that retrieves all the product promotions supported in a country and in a segment.
/// </summary>
public class GetProductPromotions : BasePartnerScenario
{
/// <summary>
/// Initializes a new instance of the <see cref="GetProductPromotions"/> class.
/// </summary>
/// <param name="context">The scenario context.</param>
public GetProductPromotions(IScenarioContext context) : base("Get product promotions", context)
{
}
/// <summary>
/// Executes the scenario.
/// </summary>
protected override void RunScenario()
{
var partnerOperations = this.Context.UserPartnerOperations;
string countryCode = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the 2 digit country code to get its supported products", "The country code can't be empty");
string segment = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the segment to get its supported product promotions", "The segment can't be empty");
this.Context.ConsoleHelper.StartProgress(string.Format(CultureInfo.InvariantCulture, "Getting product promotions in segment {0} in country {1}", segment, countryCode));
var productPromotions = partnerOperations.ProductPromotions.ByCountry(countryCode).BySegment(segment).Get();
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(productPromotions, string.Format(CultureInfo.InvariantCulture, "Product promotions in segment {0}", segment));
}
}
}

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

@ -36,6 +36,7 @@ namespace Microsoft.Store.PartnerCenter.Samples
using Subscriptions;
using Utilization;
using Validations;
using ValidationStatus;
/// <summary>
/// The main program class for the partner center .NET SDK samples.
@ -241,6 +242,7 @@ namespace Microsoft.Store.PartnerCenter.Samples
new GetCustomerQualifications(context),
new CreateCustomerQualification(context),
new CreateCustomerQualificationWithGCC(context),
new GetValidationStatus(context),
new DeleteCustomerFromTipAccount(context),
new GetCustomerManagedServices(context),
new GetCustomerRelationshipRequest(context),
@ -280,7 +282,9 @@ namespace Microsoft.Store.PartnerCenter.Samples
private static IPartnerScenario GetProductScenarios(IScenarioContext context)
{
var productScenarios = new IPartnerScenario[]
{
{
new GetProductPromotions(context),
new GetProductPromotion(context),
new GetProducts(context),
new GetProductsByTargetSegment(context),
new GetProduct(context),

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

@ -137,6 +137,7 @@
<Compile Include="Customers\CreateCustomerQualificationWithGCC.cs" />
<Compile Include="Customers\DeletePartnerCustomerRelationship.cs" />
<Compile Include="Customers\GetCustomerQualifications.cs" />
<Compile Include="Customers\GetValidationStatus.cs" />
<Compile Include="Customers\UpdateCustomerBillingProfile.cs" />
<Compile Include="Customers\GetCustomerManagedServices.cs" />
<Compile Include="Customers\FilterCustomers.cs" />
@ -215,6 +216,8 @@
<Compile Include="Products\GetAvailabilities.cs" />
<Compile Include="Products\GetAvailability.cs" />
<Compile Include="Products\CheckInventory.cs" />
<Compile Include="Products\GetProductPromotion.cs" />
<Compile Include="Products\GetProductPromotions.cs" />
<Compile Include="Products\GetSku.cs" />
<Compile Include="Products\GetProduct.cs" />
<Compile Include="Products\GetSkusByTargetSegment.cs" />

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

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Identity.Client" version="4.31.0" targetFramework="net461" />
<package id="Microsoft.Store.PartnerCenter" version="2.0.1" targetFramework="net461" />
<package id="Microsoft.Store.PartnerCenter" version="3.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.7.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="net461" />
<package id="System.Data.DataSetExtensions" version="4.5.0" targetFramework="net461" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />