diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f13629..fbc637d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - codecov: codecov/codecov@5.0.3 + codecov: codecov/codecov@6.0.0 defaults: &defaults working_directory: ~/project diff --git a/src/main/java/com/trolley/VerificationGateway.java b/src/main/java/com/trolley/VerificationGateway.java index 3afea80..9e34f0d 100644 --- a/src/main/java/com/trolley/VerificationGateway.java +++ b/src/main/java/com/trolley/VerificationGateway.java @@ -35,6 +35,11 @@ public String trigger(final String verificationType, final Object body) throws E return this.client.post(endpoint, new ObjectMapper().writeValueAsString(body)); } + public String triggerIdentityOrBusinessVerification(final Object body) throws Exception { + final String endpoint = "/v1/verifications/trigger"; + return this.client.post(endpoint, new ObjectMapper().writeValueAsString(body)); + } + public String triggerWatchlist(final Object body) throws Exception { final String endpoint = "/v1/verifications/watchlist/trigger"; return this.client.post(endpoint, new ObjectMapper().writeValueAsString(body)); diff --git a/src/test/java/com/trolley/VerificationGatewayTest.java b/src/test/java/com/trolley/VerificationGatewayTest.java new file mode 100644 index 0000000..9b25507 --- /dev/null +++ b/src/test/java/com/trolley/VerificationGatewayTest.java @@ -0,0 +1,48 @@ +package com.trolley; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.junit.Test; + +public class VerificationGatewayTest { + @Test + public void triggerIdentityOrBusinessVerificationUsesDedicatedEndpoint() throws Exception { + final VerificationGateway gateway = new VerificationGateway(new Configuration()); + final RecordingClient client = new RecordingClient(); + gateway.client = client; + + final Map body = new LinkedHashMap<>(); + body.put("recipientId", "R-123"); + body.put("types", Arrays.asList("individual")); + body.put("retryAllowed", true); + + final String response = gateway.triggerIdentityOrBusinessVerification(body); + + assertEquals("/v1/verifications/trigger", client.endpoint); + assertEquals( + "{\"recipientId\":\"R-123\",\"types\":[\"individual\"],\"retryAllowed\":true}", + client.body + ); + assertEquals("{\"ok\":true}", response); + } + + private static class RecordingClient extends Client { + private String endpoint; + private String body; + + RecordingClient() { + super(new Configuration()); + } + + @Override + public String post(final String endpoint, final String body) { + this.endpoint = endpoint; + this.body = body; + return "{\"ok\":true}"; + } + } +}