Merge pull request #32 from microsoft/sankargo/091220193PPActivation

Included sample for Sandbox 3PP Subscription activation.
This commit is contained in:
SankarGopalan 2019-09-21 07:36:39 -07:00 коммит произвёл GitHub
Родитель e9a57eb997 391da11099
Коммит c47bb9609f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 42 добавлений и 1 удалений

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

@ -356,7 +356,8 @@ namespace Microsoft.Store.PartnerCenter.Samples
new AddSubscriptionAddOn(context),
new ConvertTrialSubscription(context),
new CancelSaaSSubscription(context),
new ToggleSubscriptionAutoRenew(context)
new ToggleSubscriptionAutoRenew(context),
new ActivateSandboxThirdPartySubscription(context),
};
return new AggregatePartnerScenario("Subscription samples", subscriptionScenarios, context);

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

@ -243,6 +243,7 @@
<Compile Include="ServiceRequests\GetPartnerServiceRequestDetails.cs" />
<Compile Include="ServiceRequests\GetServiceRequestSupportTopics.cs" />
<Compile Include="ServiceRequests\UpdatePartnerServiceRequest.cs" />
<Compile Include="Subscriptions\ActivateSandboxThirdPartySubscription.cs" />
<Compile Include="Subscriptions\CancelSaaSSubscription.cs" />
<Compile Include="Subscriptions\ConvertTrialSubscription.cs" />
<Compile Include="Subscriptions\GetSubscription.cs" />

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

@ -0,0 +1,39 @@
// -----------------------------------------------------------------------
// <copyright file="ActivateSandboxThirdPartySubscription.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Samples.Subscriptions
{
/// <summary>
/// Activate Sandbox 3PP subscription.
/// </summary>
public class ActivateSandboxThirdPartySubscription : BasePartnerScenario
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivateSandboxThirdPartySubscription"/> class.
/// </summary>
/// <param name="context">The scenario context.</param>
public ActivateSandboxThirdPartySubscription(IScenarioContext context) : base("Activate Sandbox third party subscription", context)
{
}
/// <summary>
/// Executes the scenario.
/// </summary>
protected override void RunScenario()
{
var partnerOperations = this.Context.UserPartnerOperations;
var customerId = this.ObtainCustomerId();
var subscriptionId = this.ObtainSubscriptionId(customerId, "Enter the ID of the subscription to activate");
var subscriptionOperations = partnerOperations.Customers.ById(customerId).Subscriptions.ById(subscriptionId);
this.Context.ConsoleHelper.StartProgress("Activating subscription");
var subscriptionActivationResult = subscriptionOperations.Activate();
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(subscriptionActivationResult, "Subscription activation result");
}
}
}