/
GetCustomerAgreements.java
40 lines (32 loc) · 1.49 KB
/
GetCustomerAgreements.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See the LICENSE file in the project root for full license information.
package com.microsoft.store.partnercenter.samples.agreements;
import com.microsoft.store.partnercenter.IAggregatePartner;
import com.microsoft.store.partnercenter.models.ResourceCollection;
import com.microsoft.store.partnercenter.models.agreements.Agreement;
import com.microsoft.store.partnercenter.samples.BasePartnerScenario;
import com.microsoft.store.partnercenter.samples.IScenarioContext;
/**
* Showcases getting the list of agreement details.
*/
public class GetCustomerAgreements
extends BasePartnerScenario
{
public GetCustomerAgreements (IScenarioContext context)
{
super("Get all customer agreements", context);
}
/**
* Executes the scenario.
*/
@Override
protected void runScenario()
{
IAggregatePartner partnerOperations = this.getContext().getUserPartnerOperations();
String selectedCustomerId = this.obtainCustomerId( "Enter the ID of the customer" );
this.getContext().getConsoleHelper().startProgress( "Retrieving the customer's agreements" );
ResourceCollection<Agreement> customerAgreements = partnerOperations.getCustomers().byId(selectedCustomerId).getAgreements().get();
this.getContext().getConsoleHelper().stopProgress();
this.getContext().getConsoleHelper().writeObject( customerAgreements, "Customer agreements:" );
}
}