diff --git a/src/main/java/com/vonage/client/account/AccountClient.java b/src/main/java/com/vonage/client/account/AccountClient.java index 94691a2a5..08898a35f 100644 --- a/src/main/java/com/vonage/client/account/AccountClient.java +++ b/src/main/java/com/vonage/client/account/AccountClient.java @@ -221,6 +221,8 @@ public ListSecretsResponse listSecrets(String apiKey) throws AccountResponseExce * @return SecretResponse object which contains the results from the API. * * @throws AccountResponseException If there was an error making the request or retrieving the response. + * + * @since 7.9.0 */ public SecretResponse getSecret(String secretId) throws AccountResponseException { return getSecret(apiKeyGetter.get(), secretId); @@ -250,6 +252,8 @@ public SecretResponse getSecret(String apiKey, String secretId) throws AccountRe * @return SecretResponse object which contains the created secret from the API. * * @throws AccountResponseException If there was an error making the request or retrieving the response. + * + * @since 7.9.0 */ public SecretResponse createSecret(String secret) throws AccountResponseException { return createSecret(apiKeyGetter.get(), secret); @@ -277,6 +281,8 @@ public SecretResponse createSecret(String apiKey, String secret) throws AccountR * @param secretId The id of the secret to revoke. * * @throws AccountResponseException If there was an error making the request or retrieving the response. + * + * @since 7.9.0 */ public void revokeSecret(String secretId) throws AccountResponseException { revokeSecret(apiKeyGetter.get(), secretId); diff --git a/src/main/java/com/vonage/client/verify/VerifyClient.java b/src/main/java/com/vonage/client/verify/VerifyClient.java index 4f1ae35bc..93ef8f3be 100644 --- a/src/main/java/com/vonage/client/verify/VerifyClient.java +++ b/src/main/java/com/vonage/client/verify/VerifyClient.java @@ -160,11 +160,7 @@ public VerifyResponse verify(final String number, final String from, final int length, final Locale locale) throws VonageClientException, VonageResponseParseException { - return verify(new VerifyRequest.Builder(number, brand) - .senderId(from) - .locale(locale) - .build() - ); + return verify(VerifyRequest.builder(number, brand).length(length).senderId(from).locale(locale).build()); } /** @@ -209,7 +205,6 @@ public CheckResponse check(final String requestId, final String code) throws Von return check(new CheckRequest(requestId, code)); } - /** * Search for a previous verification request. * diff --git a/src/test/java/com/vonage/client/verify/VerifyClientVerifyEndpointTest.java b/src/test/java/com/vonage/client/verify/VerifyClientVerifyEndpointTest.java index 9662e4b8c..8fe83003e 100644 --- a/src/test/java/com/vonage/client/verify/VerifyClientVerifyEndpointTest.java +++ b/src/test/java/com/vonage/client/verify/VerifyClientVerifyEndpointTest.java @@ -30,25 +30,6 @@ public VerifyClientVerifyEndpointTest() { client = new VerifyClient(wrapper); } - @Test - public void testVerifyWithNumberBrandFromLengthLocaleLineType() throws Exception { - stubResponse(200, - "{\n" + " \"request_id\": \"not-really-a-request-id\",\n" + " \"status\": 0,\n" - + " \"error_text\": \"error\"\n" + "}" - ); - - VerifyResponse response = client.verify("447700900999", - "TestBrand", - "15555215554", - 6, - Locale.US - ); - - assertEquals(VerifyStatus.OK, response.getStatus()); - assertEquals("error", response.getErrorText()); - assertEquals("not-really-a-request-id", response.getRequestId()); - } - @Test public void testVerifyWithNumberBrandFromLengthLocale() throws Exception { stubResponse(200, @@ -131,7 +112,8 @@ public void testVerifyWithNonNumericStatus() throws Exception { .senderId("15555215554") .length(6) .locale(Locale.US) - .build()); + .build() + ); assertEquals(VerifyStatus.INTERNAL_ERROR, response.getStatus()); assertEquals("error", response.getErrorText()); @@ -195,7 +177,7 @@ protected VerifyRequest sampleRequest() { } @Override - protected Map sampleQueryParams() { + protected Map sampleQueryParams() { Map params = new LinkedHashMap<>(); params.put("number", "4477990090090"); params.put("brand", "Brand.com"); @@ -207,7 +189,17 @@ protected VerifyRequest sampleRequest() { params.put("pin_expiry", "60"); params.put("next_event_wait", "90"); params.put("workflow_id", "3"); + return params; + } + @Override + public void runTests() throws Exception { + super.runTests(); + assertQueryParamsMatchRequest(); + } + + private void assertQueryParamsMatchRequest() { + Map params = sampleQueryParams(); VerifyRequest request = sampleRequest(); assertNotNull(request.toString()); assertEquals(request.getNumber(), params.get("number")); @@ -220,8 +212,6 @@ protected VerifyRequest sampleRequest() { assertEquals(request.getPinExpiry().toString(), params.get("pin_expiry")); assertEquals(request.getNextEventWait().toString(), params.get("next_event_wait")); assertEquals(String.valueOf(request.getWorkflow().getId()), params.get("workflow_id")); - - return params; } } .runTests();