microsoft / Partner-Center-Java

Partner Center SDK for Java
https://docs.microsoft.com/java/partnercenter/
31 stars 12 forks source link

Unable to create MicrosoftCustomerAgreement #86

Closed victor-ochoa-td closed 5 years ago

victor-ochoa-td commented 5 years ago

I am not sure if this is a bug or not but I am not able to create MicrosoftCustomerAgreement. Every time I try to add a MicrosoftCustomerAgreement, a MicrosoftCloudAgreement is created instead.

Steps to reproduce

This is the code I am using to create the MicrosoftCustomerAgreement:

ICustomerAgreementCollection agreementCollection = new CustomerAgreementCollectionOperations(serviceInstance, tenantId);

Agreement newAgreement = new Agreement();
newAgreement.setDateAgreed(dateAgreed);
newAgreement.setPrimaryContact(contact);
newAgreement.setTemplateId(cloudAgreementInfo.getTemplateId());
newAgreement.setType("MicrosoftCustomerAgreement");
agreementCollection.byAgreementType("MicrosoftCustomerAgreement").create(newAgreement);

When I fetch the agreement info for the customer, this is what I get:

            "primaryContact": {
                "firstName": "First",
                "lastName": "Last Name",
                "email": "test@test.com",
                "phoneNumber": "0212345678"
            },
            "templateId": "998b88de-aa99-4388-a42c-1b3517d49490",
            "type": "MicrosoftCloudAgreement",
            "userId": null

As shown the type of the agreement is different from the one I tried to create. I also can confirm that from PAC Portal.

Expected behavior

A MicrosoftCustomerAgreement should be created, instead of a MicrosoftCloudAgreement

Environment

PartnerCenter version: 1.14

ghost commented 5 years ago

@victor-ochoa-td when you create the agreement are you using 117a77b0-9360-443b-8795-c6dedc750cf9 for the template identifier?

Also, when you request the agreements for the customer are you using code similar to the following

partnerOperations.getCustomers().byId(customerId).getAgreements().byAgreementType("MicrosoftCustomerAgreement").get()
victor-ochoa-td commented 5 years ago

@isaiahwilliams I was using the wrong Template Id. We were using "*" to retrieve all agreement types but the template Id was wrong so only a MicrosoftCloudAgreement was created. My bad.

You can safely close this ticket, it was failing just because of my own incompetence. :disappointed_relieved:

Thanks a lot for your help!

ghost commented 5 years ago

@victor-ochoa-td I am glad you were able to get everything sorted. It is always the small things that trip us all up. Let me know if you have any other issues.