Add Delete partner customer Dap sample. (#89)

Co-authored-by: kaminasy <54291876+kaminasy@users.noreply.github.com>
This commit is contained in:
adbhat-ms 2022-07-21 10:43:49 -07:00 коммит произвёл GitHub
Родитель 792cf03a70
Коммит 017c207223
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 54 добавлений и 6 удалений

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

@ -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" />