diff --git a/Vonage.Test/VerifyTest.cs b/Vonage.Test/VerifyTest.cs
index b1e538def..80b0d3a31 100644
--- a/Vonage.Test/VerifyTest.cs
+++ b/Vonage.Test/VerifyTest.cs
@@ -12,7 +12,7 @@ public class VerifyTest : TestBase
[Theory]
[InlineData(true, true)]
[InlineData(false, false)]
- public void Psd2Verification(bool passCreds, bool kitchenSink)
+ public async Task Psd2VerificationAsync(bool passCreds, bool kitchenSink)
{
var expectedResponse = @"{
""request_id"": ""abcdef0123456789abcdef0123456789"",
@@ -44,104 +44,11 @@ public void Psd2Verification(bool passCreds, bool kitchenSink)
VerifyResponse response;
if (passCreds)
{
- response = client.VerifyClient.VerifyRequestWithPSD2(request, creds);
+ response = await client.VerifyClient.VerifyRequestWithPSD2Async(request, creds);
}
else
{
- response = client.VerifyClient.VerifyRequestWithPSD2(request);
- }
-
- Assert.Equal("abcdef0123456789abcdef0123456789", response.RequestId);
- Assert.Equal("0", response.Status);
- }
-
- [Theory]
- [InlineData(true, true)]
- [InlineData(false, false)]
- public void Psd2VerificationAsync(bool passCreds, bool kitchenSink)
- {
- var expectedResponse = @"{
- ""request_id"": ""abcdef0123456789abcdef0123456789"",
- ""status"": ""0""
- }";
- var expectedUri = $"{this.ApiUrl}/verify/psd2/json";
- string expectedRequestContent;
- var request = new Psd2Request {Number = "447700900000", Payee = "Acme Inc", Amount = 4.8};
- if (kitchenSink)
- {
- expectedRequestContent =
- $"payee={WebUtility.UrlEncode("Acme Inc")}&amount=4.8&workflow_id=1&number=447700900000&country=GB&code_length=4&lg=en-us&pin_expiry=240&next_event_wait=60&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- request.Country = "GB";
- request.CodeLength = 4;
- request.Lg = "en-us";
- request.PinExpiry = 240;
- request.NextEventWait = 60;
- request.WorkflowId = Psd2Request.Workflow.SMS_TTS_TTS;
- }
- else
- {
- expectedRequestContent =
- $"payee={WebUtility.UrlEncode("Acme Inc")}&amount=4.8&number=447700900000&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- }
-
- this.Setup(expectedUri, expectedResponse, expectedRequestContent);
- var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret);
- var client = this.BuildVonageClient(creds);
- VerifyResponse response;
- if (passCreds)
- {
- response = client.VerifyClient.VerifyRequestWithPSD2(request, creds);
- }
- else
- {
- response = client.VerifyClient.VerifyRequestWithPSD2(request);
- }
-
- Assert.Equal("abcdef0123456789abcdef0123456789", response.RequestId);
- Assert.Equal("0", response.Status);
- }
-
- [Theory]
- [InlineData(true, true)]
- [InlineData(false, false)]
- public void RequestVerification(bool passCreds, bool kitchenSink)
- {
- var expectedResponse = @"{
- ""request_id"": ""abcdef0123456789abcdef0123456789"",
- ""status"": ""0""
- }";
- var expectedUri = $"{this.ApiUrl}/verify/json";
- string expectedRequestContent;
- var request = new VerifyRequest {Number = "447700900000", Brand = "Acme Inc"};
- if (kitchenSink)
- {
- expectedRequestContent =
- $"brand={WebUtility.UrlEncode("Acme Inc")}&sender_id=ACME&workflow_id=1&number=447700900000&country=GB&code_length=4&lg=en-us&pin_expiry=240&next_event_wait=60&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- request.Country = "GB";
- request.SenderId = "ACME";
- request.CodeLength = 4;
- request.Lg = "en-us";
- request.PinExpiry = 240;
- request.NextEventWait = 60;
- request.WorkflowId = VerifyRequest.Workflow.SMS_TTS_TTS;
- }
- else
- {
- expectedRequestContent =
- $"brand={WebUtility.UrlEncode("Acme Inc")}&number=447700900000&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- }
-
- this.Setup(expectedUri, expectedResponse, expectedRequestContent);
- var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret);
- var client = this.BuildVonageClient(creds);
- VerifyResponse response;
- if (passCreds)
- {
- response = client.VerifyClient.VerifyRequest(request, creds);
- }
- else
- {
- response = client.VerifyClient.VerifyRequest(request);
+ response = await client.VerifyClient.VerifyRequestWithPSD2Async(request);
}
Assert.Equal("abcdef0123456789abcdef0123456789", response.RequestId);
@@ -195,55 +102,6 @@ public async Task RequestVerificationAsync(bool passCreds, bool kitchenSink)
Assert.Equal("0", response.Status);
}
- [Theory]
- [InlineData(true, true)]
- [InlineData(false, false)]
- public void TestCheckVerification(bool passCreds, bool kitchenSink)
- {
- var expectedResponse = @"{
- ""request_id"": ""abcdef0123456789abcdef0123456789"",
- ""event_id"": ""0A00000012345678"",
- ""status"": ""0"",
- ""price"": ""0.10000000"",
- ""currency"": ""EUR"",
- ""estimated_price_messages_sent"": ""0.03330000""
- }";
- var expectedUri = $"{this.ApiUrl}/verify/check/json";
- string expectedRequestContent;
- var request = new VerifyCheckRequest {Code = "1234", RequestId = "abcdef0123456789abcdef0123456789"};
- if (kitchenSink)
- {
- expectedRequestContent =
- $"request_id=abcdef0123456789abcdef0123456789&code=1234&ip_address={WebUtility.UrlEncode("123.0.0.255")}&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- request.IpAddress = "123.0.0.255";
- }
- else
- {
- expectedRequestContent =
- $"request_id=abcdef0123456789abcdef0123456789&code=1234&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- }
-
- this.Setup(expectedUri, expectedResponse, expectedRequestContent);
- var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret);
- var client = this.BuildVonageClient(creds);
- VerifyCheckResponse response;
- if (passCreds)
- {
- response = client.VerifyClient.VerifyCheck(request, creds);
- }
- else
- {
- response = client.VerifyClient.VerifyCheck(request);
- }
-
- Assert.Equal("0.10000000", response.Price);
- Assert.Equal("0.03330000", response.EstimatedPriceMessagesSent);
- Assert.Equal("EUR", response.Currency);
- Assert.Equal("0A00000012345678", response.EventId);
- Assert.Equal("abcdef0123456789abcdef0123456789", response.RequestId);
- Assert.Equal("0", response.Status);
- }
-
[Theory]
[InlineData(true, true)]
[InlineData(false, false)]
@@ -293,36 +151,6 @@ public async Task TestCheckVerificationAsync(bool passCreds, bool kitchenSink)
Assert.Equal("0", response.Status);
}
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
- public void TestControlVerify(bool passCreds)
- {
- var expectedResponse = @"{
- ""status"": ""0"",
- ""command"": ""cancel""
- }";
- var expectedUri = $"{this.ApiUrl}/verify/control/json";
- var requestContent =
- $"request_id=abcdef0123456789abcdef0123456789&cmd=cancel&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- this.Setup(expectedUri, expectedResponse, requestContent);
- var request = new VerifyControlRequest {Cmd = "cancel", RequestId = "abcdef0123456789abcdef0123456789"};
- var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret);
- var client = this.BuildVonageClient(creds);
- VerifyControlResponse response;
- if (passCreds)
- {
- response = client.VerifyClient.VerifyControl(request, creds);
- }
- else
- {
- response = client.VerifyClient.VerifyControl(request, creds);
- }
-
- Assert.Equal("0", response.Status);
- Assert.Equal("cancel", response.Command);
- }
-
[Theory]
[InlineData(true)]
[InlineData(false)]
@@ -354,7 +182,7 @@ public async Task TestControlVerifyAsync(bool passCreds)
}
[Fact]
- public void TestControlVerifyInvalidCredentials()
+ public async Task TestControlVerifyInvalidCredentials()
{
var expectedResponse = @"{
""status"": ""4"",
@@ -369,7 +197,7 @@ public void TestControlVerifyInvalidCredentials()
var client = this.BuildVonageClient(creds);
try
{
- client.VerifyClient.VerifyControl(request, creds);
+ await client.VerifyClient.VerifyControlAsync(request, creds);
Assert.True(false, "Automatically failing because exception wasn't thrown");
}
catch (VonageVerifyResponseException ex)
@@ -379,76 +207,6 @@ public void TestControlVerifyInvalidCredentials()
}
}
- [Theory]
- [InlineData(false)]
- [InlineData(true)]
- public void TestVerifySearch(bool passCreds)
- {
- var expectedResponse = @"{
- ""request_id"": ""abcdef0123456789abcdef0123456789"",
- ""account_id"": ""abcdef01"",
- ""status"": ""IN PROGRESS"",
- ""number"": ""447700900000"",
- ""price"": ""0.10000000"",
- ""currency"": ""EUR"",
- ""sender_id"": ""mySenderId"",
- ""date_submitted"": ""2020-01-01 12:00:00"",
- ""date_finalized"": ""2020-01-01 12:00:00"",
- ""first_event_date"": ""2020-01-01 12:00:00"",
- ""last_event_date"": ""2020-01-01 12:00:00"",
- ""checks"": [
- {
- ""date_received"": ""2020-01-01 12:00:00"",
- ""code"": ""987654"",
- ""status"": ""abc123"",
- ""ip_address"": ""123.0.0.255""
- }
- ],
- ""events"": [
- {
- ""type"": ""abc123"",
- ""id"": ""abc123""
- }
- ],
- ""estimated_price_messages_sent"": ""0.03330000""
- }";
- var expectedUri =
- $"{this.ApiUrl}/verify/search/json?request_id=abcdef0123456789abcdef0123456789&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
- this.Setup(expectedUri, expectedResponse);
- var request = new VerifySearchRequest {RequestId = "abcdef0123456789abcdef0123456789"};
- var creds = Credentials.FromApiKeyAndSecret(this.ApiKey, this.ApiSecret);
- var client = this.BuildVonageClient(creds);
- VerifySearchResponse response;
- if (passCreds)
- {
- response = client.VerifyClient.VerifySearch(request, creds);
- }
- else
- {
- response = client.VerifyClient.VerifySearch(request);
- }
-
- var req = response;
- Assert.Equal("abcdef0123456789abcdef0123456789", req.RequestId);
- Assert.Equal("abcdef01", req.AccountId);
- Assert.Equal("IN PROGRESS", req.Status);
- Assert.Equal("447700900000", req.Number);
- Assert.Equal("0.10000000", req.Price);
- Assert.Equal("EUR", req.Currency);
- Assert.Equal("mySenderId", req.SenderId);
- Assert.Equal("2020-01-01 12:00:00", req.DateSubmitted);
- Assert.Equal("2020-01-01 12:00:00", req.DateFinalized);
- Assert.Equal("2020-01-01 12:00:00", req.FirstEventDate);
- Assert.Equal("2020-01-01 12:00:00", req.LastEventDate);
- Assert.Equal("2020-01-01 12:00:00", req.Checks[0].DateReceived);
- Assert.Equal("987654", req.Checks[0].Code);
- Assert.Equal("abc123", req.Checks[0].Status);
- Assert.Equal("123.0.0.255", req.Checks[0].IpAddress);
- Assert.Equal("abc123", req.Events[0].Type);
- Assert.Equal("abc123", req.Events[0].Id);
- Assert.Equal("0.03330000", req.EstimatedPriceMessagesSent);
- }
-
[Theory]
[InlineData(false)]
[InlineData(true)]
diff --git a/Vonage/Verify/IVerifyClient.cs b/Vonage/Verify/IVerifyClient.cs
index 0614bf034..a2f68fd0c 100644
--- a/Vonage/Verify/IVerifyClient.cs
+++ b/Vonage/Verify/IVerifyClient.cs
@@ -47,47 +47,4 @@ public interface IVerifyClient
///
///
Task VerifyRequestWithPSD2Async(Psd2Request request, Credentials creds = null);
-
- ///
- /// Use Verify request to generate and send a PIN to your user
- ///
- ///
- ///
- ///
- VerifyResponse VerifyRequest(VerifyRequest request, Credentials creds = null);
-
- ///
- /// Use Verify check to confirm that the PIN you received from your user matches the one sent by Vonage in your Verify request
- ///
- ///
- ///
- ///
- VerifyCheckResponse VerifyCheck(VerifyCheckRequest request, Credentials creds = null);
-
- ///
- /// Use Verify search to check the status of past or current verification requests
- ///
- ///
- ///
- ///
- VerifySearchResponse VerifySearch(VerifySearchRequest request, Credentials creds = null);
-
- ///
- /// Control the progress of your Verify requests. To cancel an existing Verify request, or to trigger the next verification event
- ///
- ///
- ///
- ///
- VerifyControlResponse VerifyControl(VerifyControlRequest request, Credentials creds = null);
-
- ///
- /// Use Verify request to generate and send a PIN to your user to authorize a payment:
- /// 1. Create a request to send a verification code to your user.
- /// 2. Check the status field in the response to ensure that your request was successful (zero is success).
- /// 3. Use the request_id field in the response for the Verify check.
- ///
- ///
- ///
- ///
- VerifyResponse VerifyRequestWithPSD2(Psd2Request request, Credentials creds = null);
}
\ No newline at end of file
diff --git a/Vonage/Verify/VerifyClient.cs b/Vonage/Verify/VerifyClient.cs
index fc14f7fae..afe039ad6 100644
--- a/Vonage/Verify/VerifyClient.cs
+++ b/Vonage/Verify/VerifyClient.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Vonage.Common;
using Vonage.Request;
@@ -25,19 +24,6 @@ internal VerifyClient(Credentials credentials, Configuration configuration, ITim
public Credentials Credentials { get; set; }
- ///
- [Obsolete("Favor asynchronous version instead.")]
- public VerifyCheckResponse VerifyCheck(VerifyCheckRequest request, Credentials creds = null)
- {
- var response = ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)
- .DoPostRequestUrlContentFromObject(
- ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/verify/check/json"),
- request
- );
- this.ValidateVerifyResponse(response);
- return response;
- }
-
///
public async Task VerifyCheckAsync(VerifyCheckRequest request, Credentials creds = null)
{
@@ -50,19 +36,6 @@ public async Task VerifyCheckAsync(VerifyCheckRequest reque
return response;
}
- ///
- [Obsolete("Favor asynchronous version instead.")]
- public VerifyControlResponse VerifyControl(VerifyControlRequest request, Credentials creds = null)
- {
- var response = ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)
- .DoPostRequestUrlContentFromObject(
- ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/verify/control/json"),
- request
- );
- this.ValidateVerifyResponse(response);
- return response;
- }
-
///
public async Task VerifyControlAsync(VerifyControlRequest request, Credentials creds = null)
{
@@ -75,19 +48,6 @@ public async Task VerifyControlAsync(VerifyControlRequest
return response;
}
- ///
- [Obsolete("Favor asynchronous version instead.")]
- public VerifyResponse VerifyRequest(VerifyRequest request, Credentials creds = null)
- {
- var response = ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)
- .DoPostRequestUrlContentFromObject(
- ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/verify/json"),
- request
- );
- this.ValidateVerifyResponse(response);
- return response;
- }
-
///
public async Task VerifyRequestAsync(VerifyRequest request, Credentials creds = null)
{
@@ -100,19 +60,6 @@ public async Task VerifyRequestAsync(VerifyRequest request, Cred
return response;
}
- ///
- [Obsolete("Favor asynchronous version instead.")]
- public VerifyResponse VerifyRequestWithPSD2(Psd2Request request, Credentials creds = null)
- {
- var response = ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)
- .DoPostRequestUrlContentFromObject(
- ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/verify/psd2/json"),
- request
- );
- this.ValidateVerifyResponse(response);
- return response;
- }
-
///
public async Task VerifyRequestWithPSD2Async(Psd2Request request, Credentials creds = null)
{
@@ -125,16 +72,6 @@ public async Task VerifyRequestWithPSD2Async(Psd2Request request
return response;
}
- ///
- [Obsolete("Favor asynchronous version instead.")]
- public VerifySearchResponse VerifySearch(VerifySearchRequest request, Credentials creds = null) =>
- ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)
- .DoGetRequestWithQueryParameters(
- ApiRequest.GetBaseUri(ApiRequest.UriType.Api, this.configuration, "/verify/search/json"),
- AuthType.Query,
- request
- );
-
///
public Task VerifySearchAsync(VerifySearchRequest request, Credentials creds = null) =>
ApiRequest.Build(this.GetCredentials(creds), this.configuration, this.timeProvider)