The UPS Address Validation API's database is updated every + month with new address information from USPS. Address Validation for + City, State, Zip is only available for the United States.
+Using the Pickup API, applications can cancel previously + scheduled pickups.
+Using the Pickup API, applications can schedule pickups.
+UPS uses tracking numbers to identify and track packages in + its system. Applications can use this tracking number to track, + locate, and verify arrival of a package. A successful query by + tracking number returns information for the specific package within + a shipment. For example, if a package shipment contained four + individual packages, the query response would show a shipment + containing the one package out of four with the associated tracking + number.
+#{errorPage.exceptionId}
+#{errorPage.createdAt}
+Name | +Value | +
---|---|
Process:
+
Element:
+
#{caller.callerElement}
+ #{causedBy.class.simpleName}: #{causedBy.message.trim()}
#{errorPage.getRequestUri()}
+#{errorPage.getServletName()}
+#{errorPage.applicationName}
+Key | +Value | +
---|---|
#{errorPage.getStackTrace()}
+ + * Detailed guidance on writing these kind of tests can be found in our Process + * Testing docs + *
+ */ +@IvyProcessTest(enableWebServer = true) +public class AddressValidationProcessTest { + + private static final BpmProcess testee = BpmProcess.path("AddressValidation"); + + @BeforeEach + void beforeEach(AppFixture fixture) { + // Disable OAuth feature for mock rest service + fixture.config("RestClients.ups (Address Validation - Street Level).Features", + "ch.ivyteam.ivy.rest.client.mapper.JsonFeature"); + fixture.var("ups-connector.Url", "{ivy.app.baseurl}/api/upsMock"); + } + + @Test + void addressValidation(BpmClient bpmClient) throws NoSuchFieldException { + BpmElement startable = testee.elementName("addressValidation(Integer,String,String,Integer,XAVRequest)"); + XAVRequest requestData = new XAVRequest(); + requestData.setRequest(new XAVRequestRequest()); + requestData.getRequest().setRequestOption("1"); + XAVRequestAddressKeyFormat addressKeyFormat = new XAVRequestAddressKeyFormat(); + addressKeyFormat.setConsigneeName("test"); + addressKeyFormat.setRegion("ROSWELL,GA,30076-1521"); + addressKeyFormat.countryCode("CountryCode"); + ExecutionResult result = bpmClient.start().subProcess(startable).execute(1, "v1", "1", 1, requestData); + var response = (XAVResponseWrapper) result.data().last().get("xavResponseWrapper"); + assertThat(response.getXaVResponse().getResponse().getResponseStatus().getCode()).isEqualTo("1"); + assertThat(response.getXaVResponse().getResponse().getResponseStatus().getDescription()).isEqualTo("Success"); + } +} \ No newline at end of file diff --git a/ups-connector-test/src_test/com/axonivy/ups/connector/test/PickupProcessTest.java b/ups-connector-test/src_test/com/axonivy/ups/connector/test/PickupProcessTest.java new file mode 100644 index 0000000..b6cc6ea --- /dev/null +++ b/ups-connector-test/src_test/com/axonivy/ups/connector/test/PickupProcessTest.java @@ -0,0 +1,45 @@ +package com.axonivy.ups.connector.test; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.ups.wwwcie.api.client.PickupCancelResponse; + +import ch.ivyteam.ivy.bpm.engine.client.BpmClient; +import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; +import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; +import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; +import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; +import ch.ivyteam.ivy.environment.AppFixture; + +/** + *+ * Detailed guidance on writing these kind of tests can be found in our Process + * Testing docs + *
+ */ +@IvyProcessTest(enableWebServer = true) +public class PickupProcessTest { + + private static final BpmProcess testee = BpmProcess.path("Pickup"); + + @BeforeEach + void beforeEach(AppFixture fixture) { + // Disable OAuth feature for mock rest service + fixture.config("RestClients.ups (Pickup).Features", "ch.ivyteam.ivy.rest.client.mapper.JsonFeature"); + fixture.var("ups-connector.Url", "{ivy.app.baseurl}/api/upsMock"); + } + + @Test + void cancelPickup(BpmClient bpmClient) throws NoSuchFieldException { + BpmElement startable = testee.elementName("pickupCancel(String,String,String,String,String)"); + ExecutionResult result = bpmClient.start().subProcess(startable).execute("1", "ciewssoatcnc0lRzHj9P2z", + "testing", "2929602E9CP", "02"); + var response = (PickupCancelResponse) result.data().last().get("PickupCancelResponse"); + assertThat(response.getResponse().getResponseStatus().getCode()).isEqualTo("1"); + assertThat(response.getResponse().getResponseStatus().getDescription()).isEqualTo("Success"); + } +} \ No newline at end of file diff --git a/ups-connector-test/src_test/com/axonivy/ups/connector/test/TrackingProcessTest.java b/ups-connector-test/src_test/com/axonivy/ups/connector/test/TrackingProcessTest.java new file mode 100644 index 0000000..2105fd5 --- /dev/null +++ b/ups-connector-test/src_test/com/axonivy/ups/connector/test/TrackingProcessTest.java @@ -0,0 +1,44 @@ +package com.axonivy.ups.connector.test; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.axonivy.ups.connector.TrackingRequestData; +import com.ups.wwwcie.client.TrackApiResponse; + +import ch.ivyteam.ivy.bpm.engine.client.BpmClient; +import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; +import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; +import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; +import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; +import ch.ivyteam.ivy.environment.AppFixture; + +@IvyProcessTest(enableWebServer = true) +public class TrackingProcessTest { + + private static final BpmProcess testee = BpmProcess.path("Tracking"); + + @BeforeEach + void beforeEach(AppFixture fixture) { + // Disable OAuth feature for mock rest service + fixture.config("RestClients.ups (TrackService API).Features", "ch.ivyteam.ivy.rest.client.mapper.JsonFeature"); + fixture.var("ups-connector.Url", "{ivy.app.baseurl}/api/upsMock"); + } + + @Test + void getTracking(BpmClient bpmClient) throws NoSuchFieldException { + BpmElement startable = testee.elementName("tracking(TrackingRequestData)"); + TrackingRequestData requestData = new TrackingRequestData(); + requestData.setInquiryNumber("1Z615V90DK63764633"); + requestData.setLocale("de_DE"); + requestData.setReturnSignature("false"); + requestData.setTransactionSrc("testing"); + requestData.setTransId("ciewssoatcnc0lRzHj9P2z"); + ExecutionResult result = bpmClient.start().subProcess(startable).execute(requestData); + var response = (TrackApiResponse) result.data().last().get("TrackApiResponse"); + assertThat(response.getTrackResponse().getShipment().get(0).getInquiryNumber()).isEqualTo("1Z615V90DK63764633"); + } + +} \ No newline at end of file diff --git a/ups-connector/.classpath b/ups-connector/.classpath new file mode 100644 index 0000000..804a531 --- /dev/null +++ b/ups-connector/.classpath @@ -0,0 +1,42 @@ + +