Add Delete partner customer Dap sample. (#89)
Co-authored-by: kaminasy <54291876+kaminasy@users.noreply.github.com>
This commit is contained in:
Родитель
792cf03a70
Коммит
017c207223
|
@ -0,0 +1,49 @@
|
|||
// -----------------------------------------------------------------------
|
||||
// <copyright file="DeletePartnerCustomerDap.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace Microsoft.Store.PartnerCenter.Samples.Customers
|
||||
{
|
||||
using Models.Customers;
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a partner customer Dap.
|
||||
/// </summary>
|
||||
public class DeletePartnerCustomerDap : BasePartnerScenario
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeletePartnerCustomerRelationship"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">The scenario context.</param>
|
||||
public DeletePartnerCustomerDap(IScenarioContext context) : base("Delete Partner Customer Dap", context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the scenario.
|
||||
/// </summary>
|
||||
protected override void RunScenario()
|
||||
{
|
||||
var partnerOperations = this.Context.UserPartnerOperations;
|
||||
|
||||
// prompt the user the enter the customer ID
|
||||
var customerIdToDeleteRelationshipOf = this.Context.ConsoleHelper.ReadNonEmptyString("Please enter the ID of the customer you want to delete Dap with", "The customer ID can't be empty");
|
||||
|
||||
// Delete the partner customer dap
|
||||
this.Context.ConsoleHelper.StartProgress("Deleting partner customer Dap");
|
||||
|
||||
Customer customer = new Customer
|
||||
{
|
||||
AllowDelegatedAccess = false
|
||||
};
|
||||
|
||||
partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Patch(customer);
|
||||
|
||||
this.Context.ConsoleHelper.Success("Partner customer Dap successfully deleted");
|
||||
|
||||
this.Context.ConsoleHelper.StopProgress();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,12 +57,9 @@ namespace Microsoft.Store.PartnerCenter.Samples.Customers
|
|||
RelationshipToPartner = CustomerPartnerRelationship.None
|
||||
};
|
||||
|
||||
customer = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Patch(customer);
|
||||
partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Patch(customer);
|
||||
|
||||
if (customer.RelationshipToPartner == CustomerPartnerRelationship.None)
|
||||
{
|
||||
this.Context.ConsoleHelper.Success("Customer Partner Relationship successfully deleted");
|
||||
}
|
||||
this.Context.ConsoleHelper.Success("Customer Partner Relationship successfully deleted");
|
||||
|
||||
this.Context.ConsoleHelper.StopProgress();
|
||||
}
|
||||
|
|
|
@ -252,7 +252,8 @@ namespace Microsoft.Store.PartnerCenter.Samples
|
|||
new GetCustomerRelationshipRequest(context),
|
||||
new UpdateCustomerBillingProfile(context),
|
||||
new ValidateCustomerAddress(context),
|
||||
new DeletePartnerCustomerRelationship(context)
|
||||
new DeletePartnerCustomerRelationship(context),
|
||||
new DeletePartnerCustomerDap(context)
|
||||
};
|
||||
|
||||
return new AggregatePartnerScenario("Customer samples", customerScenarios, context);
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
<Compile Include="Analytics\GetCustomerLicensesUsageAnalytics.cs" />
|
||||
<Compile Include="Customers\CreateCustomerQualification.cs" />
|
||||
<Compile Include="Customers\CreateCustomerQualificationWithGCC.cs" />
|
||||
<Compile Include="Customers\DeletePartnerCustomerDap.cs" />
|
||||
<Compile Include="Customers\DeletePartnerCustomerRelationship.cs" />
|
||||
<Compile Include="Customers\GetCustomerQualifications.cs" />
|
||||
<Compile Include="Customers\GetValidationStatus.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче