From 2f3d3e3fc474ad017407772e4b1300d8b7a04ecd Mon Sep 17 00:00:00 2001 From: Paul Smelser Date: Fri, 29 Dec 2017 18:49:22 -0500 Subject: [PATCH] #154 creating ServiceRequestOperations --- .../partnercenter/PartnerCenterAdmin.java | 2 + .../api/PartnerCenterAdminTemplate.java | 11 +- .../api/support/SupportContact.java | 57 ++++++ .../api/support/SupportOperations.java | 16 ++ .../api/support/SupportTopic.java | 47 +++++ .../api/support/impl/SupportTemplate.java | 82 +++++++++ .../managedservice/ManagedService.java | 45 +++++ .../managedservice/ManagedServiceLinks.java | 48 +++++ .../api/support/servicerequest/FileInfo.java | 54 ++++++ .../servicerequest/ServiceRequest.java | 167 ++++++++++++++++++ .../servicerequest/ServiceRequestContact.java | 63 +++++++ .../servicerequest/ServiceRequestNote.java | 38 ++++ .../ServiceRequestOrganization.java | 36 ++++ .../ServiceRequestSeverity.java | 18 ++ .../servicerequest/ServiceRequestStatus.java | 18 ++ .../partnercenter/api/uri/UriProvider.java | 2 +- .../SubscriptionOperationsTest.java | 2 +- .../data/subscription/ok-date-shorter.json | 2 +- 18 files changed, 704 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/SupportContact.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/SupportOperations.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/SupportTopic.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/impl/SupportTemplate.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedService.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedServiceLinks.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/FileInfo.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequest.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestContact.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestNote.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestOrganization.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestSeverity.java create mode 100644 src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestStatus.java diff --git a/src/main/java/org/springframework/social/partnercenter/PartnerCenterAdmin.java b/src/main/java/org/springframework/social/partnercenter/PartnerCenterAdmin.java index 43ada4c..6ee8d35 100644 --- a/src/main/java/org/springframework/social/partnercenter/PartnerCenterAdmin.java +++ b/src/main/java/org/springframework/social/partnercenter/PartnerCenterAdmin.java @@ -5,6 +5,7 @@ import org.springframework.social.partnercenter.api.customer.user.AdminUserOperations; import org.springframework.social.partnercenter.api.order.AdminOrderOperations; import org.springframework.social.partnercenter.api.order.subscription.AdminSubscriptionOperations; +import org.springframework.social.partnercenter.api.support.SupportOperations; public interface PartnerCenterAdmin extends PartnerCenter { String PROVIDER_ID = "partner-center-admin"; @@ -14,4 +15,5 @@ public interface PartnerCenterAdmin extends PartnerCenter { AdminOrderOperations getOrderOperations(); AdminSubscriptionOperations getSubscriptionOperations(); AnalyticsOperations getAnalyticsOperations(); + SupportOperations getSupportOperations(); } diff --git a/src/main/java/org/springframework/social/partnercenter/api/PartnerCenterAdminTemplate.java b/src/main/java/org/springframework/social/partnercenter/api/PartnerCenterAdminTemplate.java index 77a5d45..8dffdcf 100644 --- a/src/main/java/org/springframework/social/partnercenter/api/PartnerCenterAdminTemplate.java +++ b/src/main/java/org/springframework/social/partnercenter/api/PartnerCenterAdminTemplate.java @@ -13,6 +13,8 @@ import org.springframework.social.partnercenter.api.order.impl.AdminOrderTemplate; import org.springframework.social.partnercenter.api.order.subscription.AdminSubscriptionOperations; import org.springframework.social.partnercenter.api.order.subscription.impl.AdminSubscriptionTemplate; +import org.springframework.social.partnercenter.api.support.SupportOperations; +import org.springframework.social.partnercenter.api.support.impl.SupportTemplate; import org.springframework.social.partnercenter.api.uri.UriProvider; import org.springframework.social.partnercenter.http.client.RestClient; import org.springframework.social.partnercenter.http.client.RestResource; @@ -23,6 +25,7 @@ public class PartnerCenterAdminTemplate extends PartnerCenterTemplate implements private final AdminOrderOperations adminOrderOperations; private final AdminSubscriptionOperations adminSubscriptionOperations; private final AnalyticsOperations analyticsOperations; + private final SupportOperations supportOperations; public PartnerCenterAdminTemplate(UriProvider uriProvider, String accessToken, String version){ super(uriProvider, accessToken, version); @@ -30,7 +33,8 @@ public PartnerCenterAdminTemplate(UriProvider uriProvider, String accessToken, S adminUserOperations = new AdminUserTemplate(createRestResource(uriProvider.partnerCenterCustomerUri().build().toUri()), isAuthorized()); adminOrderOperations = new AdminOrderTemplate(createRestResource(uriProvider.partnerCenterCustomerUri().build().toUri()), isAuthorized()); adminSubscriptionOperations = new AdminSubscriptionTemplate(createRestResource(uriProvider.partnerCenterCustomerUri().build().toUri()), isAuthorized()); - analyticsOperations = new AnalyticsTemplate(createRestResource(uriProvider.partnerAnalyticsUri().build().toUri()), isAuthorized()); + analyticsOperations = new AnalyticsTemplate(createRestResource(uriProvider.partnerBaseUri().build().toUri()), isAuthorized()); + supportOperations = new SupportTemplate(createRestResource(uriProvider.partnerBaseUri().build().toUri()), isAuthorized()); } private RestResource createRestResource(URI baseUri){ @@ -61,4 +65,9 @@ public AdminSubscriptionOperations getSubscriptionOperations() { public AnalyticsOperations getAnalyticsOperations() { return analyticsOperations; } + + @Override + public SupportOperations getSupportOperations() { + return supportOperations; + } } diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/SupportContact.java b/src/main/java/org/springframework/social/partnercenter/api/support/SupportContact.java new file mode 100644 index 0000000..8ac7d0a --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/SupportContact.java @@ -0,0 +1,57 @@ +package org.springframework.social.partnercenter.api.support; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import org.springframework.social.partnercenter.api.ResourceAttributes; +import org.springframework.social.partnercenter.api.ResourceLinks; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class SupportContact { + private String supportTenantId; + private String supportMpnId; + private String name; + private ResourceLinks links; + private ResourceAttributes attributes; + + public String getSupportTenantId() { + return supportTenantId; + } + + public void setSupportTenantId(String supportTenantId) { + this.supportTenantId = supportTenantId; + } + + public String getSupportMpnId() { + return supportMpnId; + } + + public void setSupportMpnId(String supportMpnId) { + this.supportMpnId = supportMpnId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ResourceLinks getLinks() { + return links; + } + + public void setLinks(ResourceLinks links) { + this.links = links; + } + + public ResourceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ResourceAttributes attributes) { + this.attributes = attributes; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/SupportOperations.java b/src/main/java/org/springframework/social/partnercenter/api/support/SupportOperations.java new file mode 100644 index 0000000..729d9ad --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/SupportOperations.java @@ -0,0 +1,16 @@ +package org.springframework.social.partnercenter.api.support; + +import org.springframework.http.ResponseEntity; +import org.springframework.social.partnercenter.api.PartnerCenterResponse; +import org.springframework.social.partnercenter.api.support.managedservice.ManagedService; +import org.springframework.social.partnercenter.api.support.servicerequest.ServiceRequest; + +public interface SupportOperations { + ResponseEntity getSupportContact(String customerId, String subscriptionId); + ResponseEntity updateSupportContact(String customerId, String subscriptionId, SupportContact supportContact); + ResponseEntity> getManagedServices(String customerId); + ResponseEntity> getSupportTopics(); + ResponseEntity> getServiceRequests(String customerId); + ResponseEntity updateServiceRequest(ServiceRequest request); + ResponseEntity createServiceRequest(ServiceRequest request); +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/SupportTopic.java b/src/main/java/org/springframework/social/partnercenter/api/support/SupportTopic.java new file mode 100644 index 0000000..e5cec5e --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/SupportTopic.java @@ -0,0 +1,47 @@ +package org.springframework.social.partnercenter.api.support; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import org.springframework.social.partnercenter.api.ResourceAttributes; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class SupportTopic { + private String name; + private String description; + private int id; + private ResourceAttributes attribute; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ResourceAttributes getAttribute() { + return attribute; + } + + public void setAttribute(ResourceAttributes attribute) { + this.attribute = attribute; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/impl/SupportTemplate.java b/src/main/java/org/springframework/social/partnercenter/api/support/impl/SupportTemplate.java new file mode 100644 index 0000000..badc329 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/impl/SupportTemplate.java @@ -0,0 +1,82 @@ +package org.springframework.social.partnercenter.api.support.impl; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.ResponseEntity; +import org.springframework.social.partnercenter.PartnerCenter; +import org.springframework.social.partnercenter.api.AbstractTemplate; +import org.springframework.social.partnercenter.api.PartnerCenterResponse; +import org.springframework.social.partnercenter.api.support.SupportContact; +import org.springframework.social.partnercenter.api.support.SupportOperations; +import org.springframework.social.partnercenter.api.support.SupportTopic; +import org.springframework.social.partnercenter.api.support.managedservice.ManagedService; +import org.springframework.social.partnercenter.api.support.servicerequest.ServiceRequest; +import org.springframework.social.partnercenter.http.client.RestResource; + +public class SupportTemplate extends AbstractTemplate implements SupportOperations { + private static final String CUSTOMERS = "customers"; + private static final String SUBSCRIPTIONS = "subscriptions"; + private static final String SUPPORT_CONTACT = "supportcontact"; + private static final String MANAGED_SERVICES = "managedservices"; + private static final String SERVICE_REQUESTS = "servicerequests"; + + private final RestResource restResource; + + public SupportTemplate(RestResource restResource, boolean isAuthorized) { + super(isAuthorized); + this.restResource = restResource; + } + + @Override + public ResponseEntity getSupportContact(String customerId, String subscriptionId) { + return restResource.request() + .pathSegment(CUSTOMERS, customerId, SUBSCRIPTIONS, subscriptionId, SUPPORT_CONTACT) + .get(SupportContact.class); + } + + @Override + public ResponseEntity updateSupportContact(String customerId, String subscriptionId, SupportContact supportContact) { + return restResource.request() + .pathSegment(CUSTOMERS, customerId, SUBSCRIPTIONS, subscriptionId, SUPPORT_CONTACT) + .put(supportContact, SupportContact.class); + } + + @Override + public ResponseEntity> getManagedServices(String customerId) { + return restResource.request() + .pathSegment(CUSTOMERS, customerId, MANAGED_SERVICES) + .get(new ParameterizedTypeReference>() {}); + } + + @Override + public ResponseEntity> getSupportTopics() { + return restResource.request() + .pathSegment(SERVICE_REQUESTS, "supporttopics") + .get(new ParameterizedTypeReference>() {}); + } + + @Override + public ResponseEntity> getServiceRequests(String customerId) { + return restResource.request() + .pathSegment(CUSTOMERS, customerId, SERVICE_REQUESTS) + .get(new ParameterizedTypeReference>() {}); + } + + @Override + public ResponseEntity updateServiceRequest(ServiceRequest request) { + return restResource.request() + .pathSegment(SERVICE_REQUESTS, request.getId()) + .patch(request, ServiceRequest.class); + } + + @Override + public ResponseEntity createServiceRequest(ServiceRequest request) { + return restResource.request() + .pathSegment(SERVICE_REQUESTS) + .post(request, ServiceRequest.class); + } + + @Override + protected String getProviderId() { + return PartnerCenter.PROVIDER_ID; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedService.java b/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedService.java new file mode 100644 index 0000000..dd29d73 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedService.java @@ -0,0 +1,45 @@ +package org.springframework.social.partnercenter.api.support.managedservice; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ManagedService { + private String id; + private String name; + private String groupName; + private ManagedServiceLinks links; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public ManagedServiceLinks getLinks() { + return links; + } + + public void setLinks(ManagedServiceLinks links) { + this.links = links; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedServiceLinks.java b/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedServiceLinks.java new file mode 100644 index 0000000..5508ab0 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/managedservice/ManagedServiceLinks.java @@ -0,0 +1,48 @@ +package org.springframework.social.partnercenter.api.support.managedservice; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import org.springframework.social.partnercenter.api.Link; +import org.springframework.social.partnercenter.api.ResourceAttributes; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ManagedServiceLinks { + private Link adminService; + private Link serviceHealth; + private Link serviceTicket; + private ResourceAttributes attributes; + + public Link getAdminService() { + return adminService; + } + + public void setAdminService(Link adminService) { + this.adminService = adminService; + } + + public Link getServiceHealth() { + return serviceHealth; + } + + public void setServiceHealth(Link serviceHealth) { + this.serviceHealth = serviceHealth; + } + + public Link getServiceTicket() { + return serviceTicket; + } + + public void setServiceTicket(Link serviceTicket) { + this.serviceTicket = serviceTicket; + } + + public ResourceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ResourceAttributes attributes) { + this.attributes = attributes; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/FileInfo.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/FileInfo.java new file mode 100644 index 0000000..8a6a605 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/FileInfo.java @@ -0,0 +1,54 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class FileInfo { + private String id; + private String comment; + private String fileExtension; + private String fileNameWithoutExtension; + private Long fileSize; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public String getFileExtension() { + return fileExtension; + } + + public void setFileExtension(String fileExtension) { + this.fileExtension = fileExtension; + } + + public String getFileNameWithoutExtension() { + return fileNameWithoutExtension; + } + + public void setFileNameWithoutExtension(String fileNameWithoutExtension) { + this.fileNameWithoutExtension = fileNameWithoutExtension; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequest.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequest.java new file mode 100644 index 0000000..a8a06d7 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequest.java @@ -0,0 +1,167 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import java.time.ZonedDateTime; +import java.util.List; + +import org.springframework.social.partnercenter.api.ResourceAttributes; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ServiceRequest { + private String id; + private String title; + private ServiceRequestSeverity severity; + private ServiceRequestStatus status; + private ServiceRequestOrganization organization; + private ServiceRequestContact primaryContact; + private ServiceRequestContact lastUpdatedBy; + private String productName; + private String productId; + private List fileLinks; + private ServiceRequestNote newNote; + private List notes; + private ZonedDateTime createdDate; + private ZonedDateTime lastModifiedDate; + private ZonedDateTime lastClosedDate; + private String countryCode; + private ResourceAttributes attributes; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public ServiceRequestSeverity getSeverity() { + return severity; + } + + public void setSeverity(ServiceRequestSeverity severity) { + this.severity = severity; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ServiceRequestStatus getStatus() { + return status; + } + + public void setStatus(ServiceRequestStatus status) { + this.status = status; + } + + public ZonedDateTime getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(ZonedDateTime createdDate) { + this.createdDate = createdDate; + } + + public ZonedDateTime getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(ZonedDateTime lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } + + public ZonedDateTime getLastClosedDate() { + return lastClosedDate; + } + + public void setLastClosedDate(ZonedDateTime lastClosedDate) { + this.lastClosedDate = lastClosedDate; + } + + public ResourceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ResourceAttributes attributes) { + this.attributes = attributes; + } + + public ServiceRequestOrganization getOrganization() { + return organization; + } + + public void setOrganization(ServiceRequestOrganization organization) { + this.organization = organization; + } + + public ServiceRequestContact getPrimaryContact() { + return primaryContact; + } + + public void setPrimaryContact(ServiceRequestContact primaryContact) { + this.primaryContact = primaryContact; + } + + public ServiceRequestContact getLastUpdatedBy() { + return lastUpdatedBy; + } + + public void setLastUpdatedBy(ServiceRequestContact lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public ServiceRequestNote getNewNote() { + return newNote; + } + + public void setNewNote(ServiceRequestNote newNote) { + this.newNote = newNote; + } + + public List getNotes() { + return notes; + } + + public void setNotes(List notes) { + this.notes = notes; + } + + public List getFileLinks() { + return fileLinks; + } + + public void setFileLinks(List fileLinks) { + this.fileLinks = fileLinks; + } + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestContact.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestContact.java new file mode 100644 index 0000000..5cb06c5 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestContact.java @@ -0,0 +1,63 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ServiceRequestContact { + private ServiceRequestOrganization organization; + private String contactId; + private String lastName; + private String firstName; + private String email; + private String phoneNumber; + + public ServiceRequestOrganization getOrganization() { + return organization; + } + + public void setOrganization(ServiceRequestOrganization organization) { + this.organization = organization; + } + + public String getContactId() { + return contactId; + } + + public void setContactId(String contactId) { + this.contactId = contactId; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestNote.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestNote.java new file mode 100644 index 0000000..f622d17 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestNote.java @@ -0,0 +1,38 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ServiceRequestNote { + private String createdByName; + private ZonedDateTime createdDate; + private String text; + + public String getCreatedByName() { + return createdByName; + } + + public void setCreatedByName(String createdByName) { + this.createdByName = createdByName; + } + + public ZonedDateTime getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(ZonedDateTime createdDate) { + this.createdDate = createdDate; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestOrganization.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestOrganization.java new file mode 100644 index 0000000..e22b0dc --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestOrganization.java @@ -0,0 +1,36 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(NON_NULL) +public class ServiceRequestOrganization { + private String id; + private String name; + private String phoneNumber; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestSeverity.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestSeverity.java new file mode 100644 index 0000000..73143a4 --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestSeverity.java @@ -0,0 +1,18 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServiceRequestSeverity { + UNKNOWN("unknown"), CRITICAL("critical"), MODERATE("moderate"), MINIMAL("minimal"); + + private String jsonValue; + + ServiceRequestSeverity(String jsonValue) { + this.jsonValue = jsonValue; + } + + @JsonValue + public String getJsonValue() { + return jsonValue; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestStatus.java b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestStatus.java new file mode 100644 index 0000000..8aed2ba --- /dev/null +++ b/src/main/java/org/springframework/social/partnercenter/api/support/servicerequest/ServiceRequestStatus.java @@ -0,0 +1,18 @@ +package org.springframework.social.partnercenter.api.support.servicerequest; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServiceRequestStatus { + NONE("none"), OPEN("open"), CLOSED("closed"), ATTENTION_NEEDED("attention_needed"); + + private String jsonValue; + + ServiceRequestStatus(String jsonValue) { + this.jsonValue = jsonValue; + } + + @JsonValue + public String getJsonValue() { + return jsonValue; + } +} diff --git a/src/main/java/org/springframework/social/partnercenter/api/uri/UriProvider.java b/src/main/java/org/springframework/social/partnercenter/api/uri/UriProvider.java index 2cfce02..3c33aa1 100644 --- a/src/main/java/org/springframework/social/partnercenter/api/uri/UriProvider.java +++ b/src/main/java/org/springframework/social/partnercenter/api/uri/UriProvider.java @@ -71,7 +71,7 @@ public UriComponentsBuilder partnerCenterCustomerUri(){ return partnerCenterBuilder().pathSegment("v1", "customers"); } - public UriComponentsBuilder partnerAnalyticsUri(){ + public UriComponentsBuilder partnerBaseUri(){ return partnerCenterBuilder().pathSegment("v1"); } diff --git a/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java b/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java index 17408c6..ae0b9b5 100644 --- a/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java +++ b/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java @@ -60,7 +60,7 @@ public void testById_whenCalledAndDateIsShort_thenResponseIsParsedCorrectly() { SoftAssertions.assertSoftly(softly -> { softly.assertThat(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").format(subscription.getCommitmentEndDate())).isEqualTo("9999-12-04T00:00:00Z"); softly.assertThat(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").format(subscription.getEffectiveStartDate())).isEqualTo("2017-10-04T00:00:00Z"); - softly.assertThat(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(subscription.getCreationDate())).isEqualTo("2017-11-06T15:28:31.600Z"); + softly.assertThat(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(subscription.getCreationDate())).isEqualTo("2017-12-05T02:38:29.400Z"); }); } diff --git a/src/test/resources/data/subscription/ok-date-shorter.json b/src/test/resources/data/subscription/ok-date-shorter.json index 78c9a53..1a779e4 100644 --- a/src/test/resources/data/subscription/ok-date-shorter.json +++ b/src/test/resources/data/subscription/ok-date-shorter.json @@ -1 +1 @@ -{"id":"6C36999D-F573-408D-A463-ED9EAC6319E1","offerId":"MS-AZR-0146P","offerName":"Microsoft Azure","friendlyName":"Pay As You Go","quantity":20,"unitType":"Usage-based","hasPurchasableAddons":false,"creationDate":"2017-11-06T15:28:31.6Z","effectiveStartDate":"2017-10-04T00:00:00Z","commitmentEndDate":"9999-12-04T00:00:00Z","status":"active","autoRenewEnabled":false,"isTrial":false,"billingType":"usage","billingCycle":"monthly","contractType":"subscription","links":{"offer":{"uri":"/offers/MS-AZR-0146P?country=US","method":"GET","headers":[]},"self":{"uri":"/customers/cec7381b-58d1-455d-b516-134caf447ffa/subscriptions/6C36999D-F573-408D-A463-ED9EAC6319E1","method":"GET","headers":[]}},"orderId":"7CB5E7EA-F17F-4C77-BD7C-6417B7A90CCC","attributes":{"etag":"eyJpZCI6IjZjMzY5OTlkLWY1NzMtNDA4ZC1hNDYzLWVkOWVhYzYzMTllMSIsInZlcnNpb24iOjJ9","objectType":"Subscription"}} +{"id":"6C36999D-F573-408D-A463-ED9EAC6319E1","offerId":"MS-AZR-0146P","offerName":"Microsoft Azure","friendlyName":"Pay As You Go","quantity":20,"unitType":"Usage-based","hasPurchasableAddons":false,"creationDate":"2017-12-05T02:38:29.4Z","effectiveStartDate":"2017-10-04T00:00:00Z","commitmentEndDate":"9999-12-04T00:00:00Z","status":"active","autoRenewEnabled":false,"isTrial":false,"billingType":"usage","billingCycle":"monthly","contractType":"subscription","links":{"offer":{"uri":"/offers/MS-AZR-0146P?country=US","method":"GET","headers":[]},"self":{"uri":"/customers/cec7381b-58d1-455d-b516-134caf447ffa/subscriptions/6C36999D-F573-408D-A463-ED9EAC6319E1","method":"GET","headers":[]}},"orderId":"7CB5E7EA-F17F-4C77-BD7C-6417B7A90CCC","attributes":{"etag":"eyJpZCI6IjZjMzY5OTlkLWY1NzMtNDA4ZC1hNDYzLWVkOWVhYzYzMTllMSIsInZlcnNpb24iOjJ9","objectType":"Subscription"}}