From e1c90b80e0d5e4e88879eed82bc7cf3cd8b4ec9c Mon Sep 17 00:00:00 2001 From: Dovchik Date: Tue, 30 Jan 2024 13:36:51 +0100 Subject: [PATCH 1/8] feat: add Start{Method} functions for verification --- src/Sinch/Verification/SinchVerification.cs | 98 ++++++++++++++++++- .../Request/StartDataVerificationRequest.cs | 14 +++ .../StartFlashCallVerificationRequest.cs | 23 +++++ .../StartPhoneCallVerificationRequest.cs | 14 +++ .../Request/StartSmsVerificationRequest.cs | 14 +++ ...Request.cs => StartVerificationRequest.cs} | 2 +- .../Request/StartVerificationRequestBase.cs | 27 +++++ ...se.cs => StartDataVerificationResponse.cs} | 2 +- ... => StartFlashCallVerificationResponse.cs} | 2 +- ... => StartPhoneCallVerificationResponse.cs} | 2 +- ...nse.cs => StartSmsVerificationResponse.cs} | 2 +- .../Response/VerificationStartResponseBase.cs | 8 +- .../Verification/VerificationTests.cs | 4 +- .../Verification/VerificationStartTests.cs | 24 ++--- 14 files changed, 210 insertions(+), 26 deletions(-) create mode 100644 src/Sinch/Verification/Start/Request/StartDataVerificationRequest.cs create mode 100644 src/Sinch/Verification/Start/Request/StartFlashCallVerificationRequest.cs create mode 100644 src/Sinch/Verification/Start/Request/StartPhoneCallVerificationRequest.cs create mode 100644 src/Sinch/Verification/Start/Request/StartSmsVerificationRequest.cs rename src/Sinch/Verification/Start/Request/{VerificationStartRequest.cs => StartVerificationRequest.cs} (97%) create mode 100644 src/Sinch/Verification/Start/Request/StartVerificationRequestBase.cs rename src/Sinch/Verification/Start/Response/{DataVerificationStartResponse.cs => StartDataVerificationResponse.cs} (86%) rename src/Sinch/Verification/Start/Response/{FlashCallVerificationStartResponse.cs => StartFlashCallVerificationResponse.cs} (95%) rename src/Sinch/Verification/Start/Response/{PhoneCallVerificationStartResponse.cs => StartPhoneCallVerificationResponse.cs} (65%) rename src/Sinch/Verification/Start/Response/{SmsVerificationStartResponse.cs => StartSmsVerificationResponse.cs} (92%) diff --git a/src/Sinch/Verification/SinchVerification.cs b/src/Sinch/Verification/SinchVerification.cs index b338237e..b6e7594a 100644 --- a/src/Sinch/Verification/SinchVerification.cs +++ b/src/Sinch/Verification/SinchVerification.cs @@ -20,7 +20,43 @@ public interface ISinchVerification /// /// /// - Task Start(VerificationStartRequest request, + Task Start(StartVerificationRequest request, + CancellationToken cancellationToken = default); + + /// + /// Starts an SMS Verification. Verification by SMS message with a PIN code. + /// + /// + /// + /// + Task StartSms(StartSmsVerificationRequest request, + CancellationToken cancellationToken = default); + + /// + /// Starts a Flash Call verification. Verification by placing a flashcall (missed call) and detecting the incoming calling number (CLI). + /// + /// + /// + /// + Task StartFlashCall(StartFlashCallVerificationRequest request, + CancellationToken cancellationToken = default); + + /// + /// Starts a Phone Call verification.Verification by placing a PSTN call to the user's phone and playing an announcement, asking the user to press a particular digit to verify the phone number + /// + /// + /// + /// + Task StartPhoneCall(StartPhoneCallVerificationRequest request, + CancellationToken cancellationToken = default); + + /// + /// Starts a Data verification. Verification by accessing internal infrastructure of mobile carriers to verify if given verification attempt was originated from device with matching phone number. + /// + /// + /// + /// + Task StartSeamless(StartDataVerificationRequest request, CancellationToken cancellationToken = default); /// @@ -61,15 +97,71 @@ public SinchVerification(ILoggerAdapter logger, Uri baseAddre } /// - public Task Start(VerificationStartRequest request, + public Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default) { var uri = new Uri(_baseAddress, $"verification/v1/verifications"); _logger?.LogDebug("Starting verification..."); - return _http.Send(uri, HttpMethod.Post, request, + return _http.Send(uri, HttpMethod.Post, request, cancellationToken: cancellationToken); } + /// + public async Task StartSms(StartSmsVerificationRequest request, + CancellationToken cancellationToken = default) + { + var result = await Start(new StartVerificationRequest() + { + Custom = request.Custom, + Identity = request.Identity, + Method = request.Method, + Reference = request.Reference + }, cancellationToken); + return result as StartSmsVerificationResponse; + } + + /// + public async Task StartFlashCall(StartFlashCallVerificationRequest request, + CancellationToken cancellationToken = default) + { + var result = await Start(new StartVerificationRequest() + { + Custom = request.Custom, + Identity = request.Identity, + Method = request.Method, + Reference = request.Reference, + FlashCallOptions = request.FlashCallOptions + }, cancellationToken); + return result as StartFlashCallVerificationResponse; + } + + /// + public async Task StartPhoneCall(StartPhoneCallVerificationRequest request, CancellationToken cancellationToken = default) + { + var result = await Start(new StartVerificationRequest() + { + Custom = request.Custom, + Identity = request.Identity, + Method = request.Method, + Reference = request.Reference, + }, cancellationToken); + return result as StartPhoneCallVerificationResponse; + } + + /// + public async Task StartSeamless(StartDataVerificationRequest request, CancellationToken cancellationToken = default) + { + var result = await Start(new StartVerificationRequest() + { + Custom = request.Custom, + Identity = request.Identity, + Method = request.Method, + Reference = request.Reference, + }, cancellationToken); + return result as StartDataVerificationResponse; + } + + public Task ReportIdentity(string endpoint, VerifyReportRequest request, CancellationToken cancellationToken = default) { diff --git a/src/Sinch/Verification/Start/Request/StartDataVerificationRequest.cs b/src/Sinch/Verification/Start/Request/StartDataVerificationRequest.cs new file mode 100644 index 00000000..a4ea8576 --- /dev/null +++ b/src/Sinch/Verification/Start/Request/StartDataVerificationRequest.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using Sinch.Verification.Common; + +namespace Sinch.Verification.Start.Request +{ + public class StartDataVerificationRequest : StartVerificationRequestBase + { + /// + /// The type of the verification request. Set to Seamless + /// + [JsonInclude] + public override VerificationMethodEx Method { get; } = VerificationMethodEx.Seamless; + } +} diff --git a/src/Sinch/Verification/Start/Request/StartFlashCallVerificationRequest.cs b/src/Sinch/Verification/Start/Request/StartFlashCallVerificationRequest.cs new file mode 100644 index 00000000..b757c065 --- /dev/null +++ b/src/Sinch/Verification/Start/Request/StartFlashCallVerificationRequest.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using Sinch.Verification.Common; + +namespace Sinch.Verification.Start.Request +{ + public class StartFlashCallVerificationRequest : StartVerificationRequestBase + { + /// + /// The type of the verification request. Set to SMS. + /// + [JsonInclude] + public override VerificationMethodEx Method { get; } = VerificationMethodEx.FlashCall; + + /// + /// An optional object for flashCall verifications. + /// It allows you to specify dial time out parameter for flashCall. + /// FlashCallOptions object can be specified optionally, and only + /// if the verification request was triggered from your backend (no SDK client) + /// through an Application signed request. + /// + public FlashCallOptions FlashCallOptions { get; set; } + } +} diff --git a/src/Sinch/Verification/Start/Request/StartPhoneCallVerificationRequest.cs b/src/Sinch/Verification/Start/Request/StartPhoneCallVerificationRequest.cs new file mode 100644 index 00000000..c463d5dd --- /dev/null +++ b/src/Sinch/Verification/Start/Request/StartPhoneCallVerificationRequest.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using Sinch.Verification.Common; + +namespace Sinch.Verification.Start.Request +{ + public class StartPhoneCallVerificationRequest : StartVerificationRequestBase + { + /// + /// The type of the verification request. Set to Phone Call + /// + [JsonInclude] + public override VerificationMethodEx Method { get; } = VerificationMethodEx.Callout; + } +} diff --git a/src/Sinch/Verification/Start/Request/StartSmsVerificationRequest.cs b/src/Sinch/Verification/Start/Request/StartSmsVerificationRequest.cs new file mode 100644 index 00000000..630fee28 --- /dev/null +++ b/src/Sinch/Verification/Start/Request/StartSmsVerificationRequest.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using Sinch.Verification.Common; + +namespace Sinch.Verification.Start.Request +{ + public sealed class StartSmsVerificationRequest : StartVerificationRequestBase + { + /// + /// The type of the verification request. Set to SMS. + /// + [JsonInclude] + public override VerificationMethodEx Method { get; } = VerificationMethodEx.Sms; + } +} diff --git a/src/Sinch/Verification/Start/Request/VerificationStartRequest.cs b/src/Sinch/Verification/Start/Request/StartVerificationRequest.cs similarity index 97% rename from src/Sinch/Verification/Start/Request/VerificationStartRequest.cs rename to src/Sinch/Verification/Start/Request/StartVerificationRequest.cs index 4dc9be84..2b27b5d4 100644 --- a/src/Sinch/Verification/Start/Request/VerificationStartRequest.cs +++ b/src/Sinch/Verification/Start/Request/StartVerificationRequest.cs @@ -2,7 +2,7 @@ namespace Sinch.Verification.Start.Request { - public class VerificationStartRequest + public class StartVerificationRequest { /// /// Specifies the type of endpoint that will be verified and the particular endpoint. diff --git a/src/Sinch/Verification/Start/Request/StartVerificationRequestBase.cs b/src/Sinch/Verification/Start/Request/StartVerificationRequestBase.cs new file mode 100644 index 00000000..e2860eb1 --- /dev/null +++ b/src/Sinch/Verification/Start/Request/StartVerificationRequestBase.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using Sinch.Verification.Common; + +namespace Sinch.Verification.Start.Request +{ + public abstract class StartVerificationRequestBase + { + [JsonInclude] + public abstract VerificationMethodEx Method { get; } + + /// + /// Specifies the type of endpoint that will be verified and the particular endpoint. + /// `number` is currently the only supported endpoint type. + /// + public Identity Identity { get; set; } + + /// + /// Used to pass your own reference in the request for tracking purposes. + /// + public string Reference { get; set; } + + /// + /// Can be used to pass custom data in the request. + /// + public string Custom { get; set; } + } +} diff --git a/src/Sinch/Verification/Start/Response/DataVerificationStartResponse.cs b/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs similarity index 86% rename from src/Sinch/Verification/Start/Response/DataVerificationStartResponse.cs rename to src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs index 725a6417..6c2d30f6 100644 --- a/src/Sinch/Verification/Start/Response/DataVerificationStartResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class DataVerificationStartResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartDataVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse { /// /// The response contains the target URI. diff --git a/src/Sinch/Verification/Start/Response/FlashCallVerificationStartResponse.cs b/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs similarity index 95% rename from src/Sinch/Verification/Start/Response/FlashCallVerificationStartResponse.cs rename to src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs index a4b0f0fd..f5f4752d 100644 --- a/src/Sinch/Verification/Start/Response/FlashCallVerificationStartResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class FlashCallVerificationStartResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartFlashCallVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse { /// /// The response contains the cliFilter and interceptionTimeout properties. diff --git a/src/Sinch/Verification/Start/Response/PhoneCallVerificationStartResponse.cs b/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs similarity index 65% rename from src/Sinch/Verification/Start/Response/PhoneCallVerificationStartResponse.cs rename to src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs index d9fec661..0224512f 100644 --- a/src/Sinch/Verification/Start/Response/PhoneCallVerificationStartResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class PhoneCallVerificationStartResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartPhoneCallVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse { } diff --git a/src/Sinch/Verification/Start/Response/SmsVerificationStartResponse.cs b/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs similarity index 92% rename from src/Sinch/Verification/Start/Response/SmsVerificationStartResponse.cs rename to src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs index 1c2ee39a..ff47b2be 100644 --- a/src/Sinch/Verification/Start/Response/SmsVerificationStartResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class SmsVerificationStartResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartSmsVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse { /// /// The response contains the template of the SMS to be expected and intercepted. diff --git a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs index 9b5ef5ff..8d89d0f2 100644 --- a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs +++ b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs @@ -45,24 +45,24 @@ public override IVerificationStartResponse Read(ref Utf8JsonReader reader, Type if (VerificationMethodEx.Seamless.Value == method) { - return elem.Deserialize(options); + return elem.Deserialize(options); } if (VerificationMethodEx.Sms.Value == method) { return - elem.Deserialize( + elem.Deserialize( options); } if (VerificationMethodEx.FlashCall.Value == method) { - return elem.Deserialize(options); + return elem.Deserialize(options); } if (VerificationMethodEx.Callout.Value == method) { - return elem.Deserialize(options); + return elem.Deserialize(options); } throw new JsonException( diff --git a/tests/Sinch.Tests/Verification/VerificationTests.cs b/tests/Sinch.Tests/Verification/VerificationTests.cs index 9acf69c1..cf2fe57c 100644 --- a/tests/Sinch.Tests/Verification/VerificationTests.cs +++ b/tests/Sinch.Tests/Verification/VerificationTests.cs @@ -48,8 +48,8 @@ public void DeserializeVerificationStartResponse() }; var smsResponse = JsonSerializer.Deserialize(jData, _jsonSerializerOptions); - smsResponse.Should().BeOfType().Which.Should().BeEquivalentTo( - new SmsVerificationStartResponse() + smsResponse.Should().BeOfType().Which.Should().BeEquivalentTo( + new StartSmsVerificationResponse() { Id = "1234567890", Method = VerificationMethodEx.Sms, diff --git a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs index 6a3df868..045b6a40 100644 --- a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs +++ b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs @@ -31,7 +31,7 @@ public class VerificationStartTests : VerificationTestBase [Fact] public async Task StartSmsVerification() { - var response = await VerificationClient.Verification.Start(new VerificationStartRequest() + var response = await VerificationClient.Verification.Start(new StartVerificationRequest() { Custom = "456", Reference = "123", @@ -43,8 +43,8 @@ public async Task StartSmsVerification() }, }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new SmsVerificationStartResponse() + response.Should().BeOfType().Which.Should().BeEquivalentTo( + new StartSmsVerificationResponse() { Id = "1234567890", Method = VerificationMethodEx.Sms, @@ -68,7 +68,7 @@ public async Task StartSmsVerification() [Fact] public async Task StartFlashCallVerification() { - var response = await VerificationClient.Verification.Start(new VerificationStartRequest() + var response = await VerificationClient.Verification.Start(new StartVerificationRequest() { Identity = _identity, Method = VerificationMethodEx.FlashCall, @@ -77,8 +77,8 @@ public async Task StartFlashCallVerification() DialTimeout = 12, } }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new FlashCallVerificationStartResponse() + response.Should().BeOfType().Which.Should().BeEquivalentTo( + new StartFlashCallVerificationResponse() { Id = _id, Method = VerificationMethodEx.FlashCall, @@ -96,13 +96,13 @@ public async Task StartFlashCallVerification() [Fact] public async Task StartPhoneCallVerification() { - var response = await VerificationClient.Verification.Start(new VerificationStartRequest() + var response = await VerificationClient.Verification.Start(new StartVerificationRequest() { Identity = _identity, Method = VerificationMethodEx.Callout, }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new PhoneCallVerificationStartResponse() + response.Should().BeOfType().Which.Should().BeEquivalentTo( + new StartPhoneCallVerificationResponse() { Id = _id, Method = VerificationMethodEx.Callout, @@ -113,13 +113,13 @@ public async Task StartPhoneCallVerification() [Fact] public async Task StartSeamlessVerification() { - var response = await VerificationClient.Verification.Start(new VerificationStartRequest() + var response = await VerificationClient.Verification.Start(new StartVerificationRequest() { Identity = _identity, Method = VerificationMethodEx.Seamless, }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new DataVerificationStartResponse() + response.Should().BeOfType().Which.Should().BeEquivalentTo( + new StartDataVerificationResponse() { Id = _id, Method = VerificationMethodEx.Seamless, From c27cfedc4c4f311b3753ff1b781f4319d8612a55 Mon Sep 17 00:00:00 2001 From: Dovchik Date: Tue, 30 Jan 2024 14:28:04 +0100 Subject: [PATCH 2/8] feat: include dedicate verification start functions in tests --- .../Verification/VerificationStartTests.cs | 181 +++++++++++------- 1 file changed, 113 insertions(+), 68 deletions(-) diff --git a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs index 045b6a40..7ca83908 100644 --- a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs +++ b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs @@ -10,9 +10,17 @@ namespace Sinch.Tests.e2e.Verification { public class VerificationStartTests : VerificationTestBase { - private List _links = new List() + private readonly string _id = "123"; + + private readonly Identity _identity = new() + { + Endpoint = "+48000000", + Type = IdentityType.Number + }; + + private readonly List _links = new() { - new() + new Links { Method = "put", Href = "href", @@ -20,115 +28,152 @@ public class VerificationStartTests : VerificationTestBase } }; - private string _id = "123"; - - private Identity _identity = new Identity() - { - Endpoint = "+48000000", - Type = IdentityType.Number - }; - [Fact] public async Task StartSmsVerification() { - var response = await VerificationClient.Verification.Start(new StartVerificationRequest() + var startVerificationRequest = new StartVerificationRequest { Custom = "456", Reference = "123", Method = VerificationMethodEx.Sms, - Identity = new Identity() + Identity = new Identity { Endpoint = "+49000000", Type = IdentityType.Number + } + }; + var startSmsVerificationResponse = new StartSmsVerificationResponse + { + Id = "1234567890", + Method = VerificationMethodEx.Sms, + Sms = new SmsInfo + { + Template = "Your verification code is {{CODE}}", + InterceptionTimeout = 32 }, - }); - - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new StartSmsVerificationResponse() + Links = new List { - Id = "1234567890", - Method = VerificationMethodEx.Sms, - Sms = new SmsInfo() + new() { - Template = "Your verification code is {{CODE}}", - InterceptionTimeout = 32, - }, - Links = new List() - { - new() - { - Method = "GET", - Href = "some_string_value", - Rel = "status" - } + Method = "GET", + Href = "some_string_value", + Rel = "status" } - }); + } + }; + + + var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); + responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( + startSmsVerificationResponse); + + var response = await VerificationClient.Verification.StartSms(new StartSmsVerificationRequest + { + Custom = startVerificationRequest.Custom, + Reference = startVerificationRequest.Reference, + Identity = startVerificationRequest.Identity + }); + response.Should().BeEquivalentTo(startSmsVerificationResponse); } [Fact] public async Task StartFlashCallVerification() { - var response = await VerificationClient.Verification.Start(new StartVerificationRequest() + var startVerificationRequest = new StartVerificationRequest { Identity = _identity, Method = VerificationMethodEx.FlashCall, - FlashCallOptions = new FlashCallOptions() + FlashCallOptions = new FlashCallOptions { - DialTimeout = 12, + DialTimeout = 12 } - }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new StartFlashCallVerificationResponse() + }; + var startFlashCallVerificationResponse = new StartFlashCallVerificationResponse + { + Id = _id, + Method = VerificationMethodEx.FlashCall, + FlashCall = new FlashCallDetails { - Id = _id, - Method = VerificationMethodEx.FlashCall, - FlashCall = new FlashCallDetails() - { - InterceptionTimeout = 50, - CliFilter = "cli-filter", - ReportTimeout = 5, - DenyCallAfter = 72, - }, - Links = _links - }); + InterceptionTimeout = 50, + CliFilter = "cli-filter", + ReportTimeout = 5, + DenyCallAfter = 72 + }, + Links = _links + }; + + var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); + responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( + startFlashCallVerificationResponse); + + var response = await VerificationClient.Verification.StartFlashCall(new StartFlashCallVerificationRequest + { + Identity = startVerificationRequest.Identity, + Reference = startVerificationRequest.Reference, + FlashCallOptions = startVerificationRequest.FlashCallOptions, + Custom = startVerificationRequest.Custom + }); + response.Should().BeEquivalentTo(startFlashCallVerificationResponse); } [Fact] public async Task StartPhoneCallVerification() { - var response = await VerificationClient.Verification.Start(new StartVerificationRequest() + var startVerificationRequest = new StartVerificationRequest { Identity = _identity, + Method = VerificationMethodEx.Callout + }; + var startPhoneCallVerificationResponse = new StartPhoneCallVerificationResponse + { + Id = _id, Method = VerificationMethodEx.Callout, + Links = _links + }; + + var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); + responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( + startPhoneCallVerificationResponse); + + var response = await VerificationClient.Verification.StartPhoneCall(new StartPhoneCallVerificationRequest + { + Identity = startVerificationRequest.Identity, + Reference = startVerificationRequest.Reference, + Custom = startVerificationRequest.Custom }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new StartPhoneCallVerificationResponse() - { - Id = _id, - Method = VerificationMethodEx.Callout, - Links = _links - }); + response.Should().BeEquivalentTo(startPhoneCallVerificationResponse); } [Fact] public async Task StartSeamlessVerification() { - var response = await VerificationClient.Verification.Start(new StartVerificationRequest() + var startVerificationRequest = new StartVerificationRequest { Identity = _identity, + Method = VerificationMethodEx.Seamless + }; + var startDataVerificationResponse = new StartDataVerificationResponse + { + Id = _id, Method = VerificationMethodEx.Seamless, - }); - response.Should().BeOfType().Which.Should().BeEquivalentTo( - new StartDataVerificationResponse() + Links = _links, + Seamless = new Seamless { - Id = _id, - Method = VerificationMethodEx.Seamless, - Links = _links, - Seamless = new Seamless() - { - TargetUri = "uri-target" - } - }); + TargetUri = "uri-target" + } + }; + + var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); + responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( + startDataVerificationResponse); + + var response = await VerificationClient.Verification.StartSeamless(new StartDataVerificationRequest + { + Identity = startVerificationRequest.Identity, + Reference = startVerificationRequest.Reference, + Custom = startVerificationRequest.Custom + }); + response.Should().BeEquivalentTo(startDataVerificationResponse); } } } From 377a102b0acbef73894eb246696da80875ea8c55 Mon Sep 17 00:00:00 2001 From: Dovchik Date: Wed, 31 Jan 2024 14:47:03 +0100 Subject: [PATCH 3/8] fix: correctly deserialize IVerificationStartResponse --- .../Response/VerificationStartResponseBase.cs | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs index 8d89d0f2..dc1a3b6c 100644 --- a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs +++ b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs @@ -14,24 +14,28 @@ public abstract class VerificationStartResponseBase /// public string Id { get; set; } - /// - /// The value of the method used for the Verification. - /// - public VerificationMethodEx Method { get; set; } - /// /// Available methods and actions which can be done after a successful Verification /// [JsonPropertyName("_links")] public List Links { get; set; } + + /// + /// The value of the method used for the Verification. + /// + public VerificationMethodEx Method { get; set; } } /// /// A marker interface for VerificationResponse items. /// + // Note about JsonDerivedType - it works if class has an interface property, but don't work if you try to deserialize interface itself. So, httpContent.ReadAsJson() will not work. + // So I'm using JsonConverter for that [JsonConverter(typeof(VerificationResponseConverter))] public interface IVerificationStartResponse { + [JsonPropertyName("method")] + public VerificationMethodEx Method { get; set; } } public class VerificationResponseConverter : JsonConverter @@ -44,26 +48,18 @@ public override IVerificationStartResponse Read(ref Utf8JsonReader reader, Type var method = descriptor.Value.GetString(); if (VerificationMethodEx.Seamless.Value == method) - { return elem.Deserialize(options); - } if (VerificationMethodEx.Sms.Value == method) - { return elem.Deserialize( options); - } if (VerificationMethodEx.FlashCall.Value == method) - { return elem.Deserialize(options); - } if (VerificationMethodEx.Callout.Value == method) - { return elem.Deserialize(options); - } throw new JsonException( $"Failed to match verification method object, got prop `{descriptor.Name}` with value `{method}`"); @@ -72,7 +68,24 @@ public override IVerificationStartResponse Read(ref Utf8JsonReader reader, Type public override void Write(Utf8JsonWriter writer, IVerificationStartResponse value, JsonSerializerOptions options) { - JsonSerializer.Serialize(writer, value, options); + switch (value) + { + case StartFlashCallVerificationResponse startFlashCallVerificationResponse: + JsonSerializer.Serialize(writer, startFlashCallVerificationResponse, options); + break; + case StartPhoneCallVerificationResponse startPhoneCallVerificationResponse: + JsonSerializer.Serialize(writer, startPhoneCallVerificationResponse, options); + break; + case StartSmsVerificationResponse startSmsVerificationResponse: + JsonSerializer.Serialize(writer, startSmsVerificationResponse, options); + break; + case StartDataVerificationResponse startDataVerificationResponse: + JsonSerializer.Serialize(writer, startDataVerificationResponse, options); + break; + default: + throw new ArgumentOutOfRangeException(nameof(value), + $"Cannot find a matching class for the interface {nameof(IVerificationStartResponse)}"); + } } } } From 4c644057948f0e3eb0a00c577d76cfbd97a32649 Mon Sep 17 00:00:00 2001 From: Dovchik Date: Wed, 31 Jan 2024 14:47:39 +0100 Subject: [PATCH 4/8] refactor: rename IVerificationStartResponse to IStartVerificationResponse --- .../Start/Response/StartDataVerificationResponse.cs | 2 +- .../Response/StartFlashCallVerificationResponse.cs | 2 +- .../Response/StartPhoneCallVerificationResponse.cs | 2 +- .../Start/Response/StartSmsVerificationResponse.cs | 2 +- .../Start/Response/VerificationStartResponseBase.cs | 10 +++++----- tests/Sinch.Tests/Verification/VerificationTests.cs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs b/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs index 6c2d30f6..f028a988 100644 --- a/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartDataVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class StartDataVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartDataVerificationResponse : VerificationStartResponseBase, IStartVerificationResponse { /// /// The response contains the target URI. diff --git a/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs b/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs index f5f4752d..7ad259d7 100644 --- a/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartFlashCallVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class StartFlashCallVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartFlashCallVerificationResponse : VerificationStartResponseBase, IStartVerificationResponse { /// /// The response contains the cliFilter and interceptionTimeout properties. diff --git a/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs b/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs index 0224512f..dc092672 100644 --- a/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartPhoneCallVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class StartPhoneCallVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartPhoneCallVerificationResponse : VerificationStartResponseBase, IStartVerificationResponse { } diff --git a/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs b/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs index ff47b2be..228166b6 100644 --- a/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs +++ b/src/Sinch/Verification/Start/Response/StartSmsVerificationResponse.cs @@ -1,6 +1,6 @@ namespace Sinch.Verification.Start.Response { - public class StartSmsVerificationResponse : VerificationStartResponseBase, IVerificationStartResponse + public class StartSmsVerificationResponse : VerificationStartResponseBase, IStartVerificationResponse { /// /// The response contains the template of the SMS to be expected and intercepted. diff --git a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs index dc1a3b6c..18dc4401 100644 --- a/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs +++ b/src/Sinch/Verification/Start/Response/VerificationStartResponseBase.cs @@ -32,15 +32,15 @@ public abstract class VerificationStartResponseBase // Note about JsonDerivedType - it works if class has an interface property, but don't work if you try to deserialize interface itself. So, httpContent.ReadAsJson() will not work. // So I'm using JsonConverter for that [JsonConverter(typeof(VerificationResponseConverter))] - public interface IVerificationStartResponse + public interface IStartVerificationResponse { [JsonPropertyName("method")] public VerificationMethodEx Method { get; set; } } - public class VerificationResponseConverter : JsonConverter + public class VerificationResponseConverter : JsonConverter { - public override IVerificationStartResponse Read(ref Utf8JsonReader reader, Type typeToConvert, + public override IStartVerificationResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var elem = JsonElement.ParseValue(ref reader); @@ -65,7 +65,7 @@ public override IVerificationStartResponse Read(ref Utf8JsonReader reader, Type $"Failed to match verification method object, got prop `{descriptor.Name}` with value `{method}`"); } - public override void Write(Utf8JsonWriter writer, IVerificationStartResponse value, + public override void Write(Utf8JsonWriter writer, IStartVerificationResponse value, JsonSerializerOptions options) { switch (value) @@ -84,7 +84,7 @@ public override void Write(Utf8JsonWriter writer, IVerificationStartResponse val break; default: throw new ArgumentOutOfRangeException(nameof(value), - $"Cannot find a matching class for the interface {nameof(IVerificationStartResponse)}"); + $"Cannot find a matching class for the interface {nameof(IStartVerificationResponse)}"); } } } diff --git a/tests/Sinch.Tests/Verification/VerificationTests.cs b/tests/Sinch.Tests/Verification/VerificationTests.cs index cf2fe57c..58a4fd34 100644 --- a/tests/Sinch.Tests/Verification/VerificationTests.cs +++ b/tests/Sinch.Tests/Verification/VerificationTests.cs @@ -46,7 +46,7 @@ public void DeserializeVerificationStartResponse() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }; - var smsResponse = JsonSerializer.Deserialize(jData, _jsonSerializerOptions); + var smsResponse = JsonSerializer.Deserialize(jData, _jsonSerializerOptions); smsResponse.Should().BeOfType().Which.Should().BeEquivalentTo( new StartSmsVerificationResponse() From d077b8ea6c68c70b6afd5bfcd73add646e4e48d7 Mon Sep 17 00:00:00 2001 From: Dovchik Date: Wed, 31 Jan 2024 14:47:58 +0100 Subject: [PATCH 5/8] refactor: add helper function for identity creation --- src/Sinch/Verification/Common/Identity.cs | 18 ++++++++++++++++-- src/Sinch/Verification/SinchVerification.cs | 6 +++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Sinch/Verification/Common/Identity.cs b/src/Sinch/Verification/Common/Identity.cs index 5fc8beef..d268abcd 100644 --- a/src/Sinch/Verification/Common/Identity.cs +++ b/src/Sinch/Verification/Common/Identity.cs @@ -5,19 +5,33 @@ namespace Sinch.Verification.Common { public class Identity { + /// + /// Creates an Identity with phone number. + /// + /// an E.164-compatible phone number + /// + public static Identity Number(string phoneNumber) + { + return new Identity() + { + Type = IdentityType.Number, + Endpoint = phoneNumber + }; + } + /// /// Currently only number type is supported. /// [JsonPropertyName("type")] public IdentityType Type { get; set; } - + /// /// For type number use an E.164-compatible phone number. /// [JsonPropertyName("endpoint")] public string Endpoint { get; set; } } - + [JsonConverter(typeof(EnumRecordJsonConverter))] public record IdentityType(string Value) : EnumRecord(Value) { diff --git a/src/Sinch/Verification/SinchVerification.cs b/src/Sinch/Verification/SinchVerification.cs index b6e7594a..7908cb07 100644 --- a/src/Sinch/Verification/SinchVerification.cs +++ b/src/Sinch/Verification/SinchVerification.cs @@ -20,7 +20,7 @@ public interface ISinchVerification /// /// /// - Task Start(StartVerificationRequest request, + Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default); /// @@ -97,12 +97,12 @@ public SinchVerification(ILoggerAdapter logger, Uri baseAddre } /// - public Task Start(StartVerificationRequest request, + public Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default) { var uri = new Uri(_baseAddress, $"verification/v1/verifications"); _logger?.LogDebug("Starting verification..."); - return _http.Send(uri, HttpMethod.Post, request, + return _http.Send(uri, HttpMethod.Post, request, cancellationToken: cancellationToken); } From 645cceacd69b81d48da12f974f54efcfdd9b916f Mon Sep 17 00:00:00 2001 From: Dovchik Date: Wed, 31 Jan 2024 14:58:00 +0100 Subject: [PATCH 6/8] feat: add start sms with just phone number param --- src/Sinch/Verification/SinchVerification.cs | 28 +++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Sinch/Verification/SinchVerification.cs b/src/Sinch/Verification/SinchVerification.cs index 7908cb07..825c3767 100644 --- a/src/Sinch/Verification/SinchVerification.cs +++ b/src/Sinch/Verification/SinchVerification.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Sinch.Core; using Sinch.Logger; +using Sinch.Verification.Common; using Sinch.Verification.Report.Request; using Sinch.Verification.Report.Response; using Sinch.Verification.Start.Request; @@ -32,6 +33,15 @@ Task Start(StartVerificationRequest request, Task StartSms(StartSmsVerificationRequest request, CancellationToken cancellationToken = default); + /// + /// Starts an SMS Verification for the specified E.164-compatible phone number. Verification by SMS message with a PIN code. + /// + /// A E.164-compatible phone number + /// + /// + Task StartSms(string phoneNumber, + CancellationToken cancellationToken = default); + /// /// Starts a Flash Call verification. Verification by placing a flashcall (missed call) and detecting the incoming calling number (CLI). /// @@ -120,6 +130,18 @@ public async Task StartSms(StartSmsVerificationReq return result as StartSmsVerificationResponse; } + /// + public async Task StartSms(string phoneNumber, + CancellationToken cancellationToken = default) + { + var result = await Start(new StartVerificationRequest() + { + Identity = Identity.Number(phoneNumber), + Method = VerificationMethodEx.Sms + }, cancellationToken); + return result as StartSmsVerificationResponse; + } + /// public async Task StartFlashCall(StartFlashCallVerificationRequest request, CancellationToken cancellationToken = default) @@ -136,7 +158,8 @@ public async Task StartFlashCall(StartFlashC } /// - public async Task StartPhoneCall(StartPhoneCallVerificationRequest request, CancellationToken cancellationToken = default) + public async Task StartPhoneCall(StartPhoneCallVerificationRequest request, + CancellationToken cancellationToken = default) { var result = await Start(new StartVerificationRequest() { @@ -149,7 +172,8 @@ public async Task StartPhoneCall(StartPhoneC } /// - public async Task StartSeamless(StartDataVerificationRequest request, CancellationToken cancellationToken = default) + public async Task StartSeamless(StartDataVerificationRequest request, + CancellationToken cancellationToken = default) { var result = await Start(new StartVerificationRequest() { From 5c8b31d39fa66983973b5b16733a5e602bd5a4b9 Mon Sep 17 00:00:00 2001 From: Dovchik Date: Wed, 31 Jan 2024 15:00:02 +0100 Subject: [PATCH 7/8] chore: style cleanup --- src/Sinch/Verification/SinchVerification.cs | 44 +++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/Sinch/Verification/SinchVerification.cs b/src/Sinch/Verification/SinchVerification.cs index 825c3767..cb865865 100644 --- a/src/Sinch/Verification/SinchVerification.cs +++ b/src/Sinch/Verification/SinchVerification.cs @@ -25,7 +25,7 @@ Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default); /// - /// Starts an SMS Verification. Verification by SMS message with a PIN code. + /// Starts an SMS Verification. Verification by SMS message with a PIN code. /// /// /// @@ -34,7 +34,8 @@ Task StartSms(StartSmsVerificationRequest request, CancellationToken cancellationToken = default); /// - /// Starts an SMS Verification for the specified E.164-compatible phone number. Verification by SMS message with a PIN code. + /// Starts an SMS Verification for the specified E.164-compatible phone number. Verification by SMS message with a PIN + /// code. /// /// A E.164-compatible phone number /// @@ -43,7 +44,8 @@ Task StartSms(string phoneNumber, CancellationToken cancellationToken = default); /// - /// Starts a Flash Call verification. Verification by placing a flashcall (missed call) and detecting the incoming calling number (CLI). + /// Starts a Flash Call verification. Verification by placing a flashcall (missed call) and detecting the incoming + /// calling number (CLI). /// /// /// @@ -52,7 +54,8 @@ Task StartFlashCall(StartFlashCallVerificati CancellationToken cancellationToken = default); /// - /// Starts a Phone Call verification.Verification by placing a PSTN call to the user's phone and playing an announcement, asking the user to press a particular digit to verify the phone number + /// Starts a Phone Call verification.Verification by placing a PSTN call to the user's phone and playing an + /// announcement, asking the user to press a particular digit to verify the phone number /// /// /// @@ -61,7 +64,8 @@ Task StartPhoneCall(StartPhoneCallVerificati CancellationToken cancellationToken = default); /// - /// Starts a Data verification. Verification by accessing internal infrastructure of mobile carriers to verify if given verification attempt was originated from device with matching phone number. + /// Starts a Data verification. Verification by accessing internal infrastructure of mobile carriers to verify if given + /// verification attempt was originated from device with matching phone number. /// /// /// @@ -83,7 +87,7 @@ Task ReportIdentity(string endpoint, VerifyReportRe CancellationToken cancellationToken = default); /// - /// Report the received verification code to verify it, using the Verification ID of the Verification request. + /// Report the received verification code to verify it, using the Verification ID of the Verification request. /// /// /// @@ -95,9 +99,9 @@ Task ReportId(string id, VerifyReportRequest reques internal class SinchVerification : ISinchVerification { - private readonly ILoggerAdapter _logger; private readonly Uri _baseAddress; private readonly IHttp _http; + private readonly ILoggerAdapter _logger; public SinchVerification(ILoggerAdapter logger, Uri baseAddress, IHttp http) { @@ -110,17 +114,17 @@ public SinchVerification(ILoggerAdapter logger, Uri baseAddre public Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default) { - var uri = new Uri(_baseAddress, $"verification/v1/verifications"); + var uri = new Uri(_baseAddress, "verification/v1/verifications"); _logger?.LogDebug("Starting verification..."); return _http.Send(uri, HttpMethod.Post, request, - cancellationToken: cancellationToken); + cancellationToken); } /// public async Task StartSms(StartSmsVerificationRequest request, CancellationToken cancellationToken = default) { - var result = await Start(new StartVerificationRequest() + var result = await Start(new StartVerificationRequest { Custom = request.Custom, Identity = request.Identity, @@ -134,7 +138,7 @@ public async Task StartSms(StartSmsVerificationReq public async Task StartSms(string phoneNumber, CancellationToken cancellationToken = default) { - var result = await Start(new StartVerificationRequest() + var result = await Start(new StartVerificationRequest { Identity = Identity.Number(phoneNumber), Method = VerificationMethodEx.Sms @@ -146,7 +150,7 @@ public async Task StartSms(string phoneNumber, public async Task StartFlashCall(StartFlashCallVerificationRequest request, CancellationToken cancellationToken = default) { - var result = await Start(new StartVerificationRequest() + var result = await Start(new StartVerificationRequest { Custom = request.Custom, Identity = request.Identity, @@ -161,26 +165,26 @@ public async Task StartFlashCall(StartFlashC public async Task StartPhoneCall(StartPhoneCallVerificationRequest request, CancellationToken cancellationToken = default) { - var result = await Start(new StartVerificationRequest() + var result = await Start(new StartVerificationRequest { Custom = request.Custom, Identity = request.Identity, Method = request.Method, - Reference = request.Reference, + Reference = request.Reference }, cancellationToken); return result as StartPhoneCallVerificationResponse; } - /// + /// public async Task StartSeamless(StartDataVerificationRequest request, CancellationToken cancellationToken = default) { - var result = await Start(new StartVerificationRequest() + var result = await Start(new StartVerificationRequest { Custom = request.Custom, Identity = request.Identity, Method = request.Method, - Reference = request.Reference, + Reference = request.Reference }, cancellationToken); return result as StartDataVerificationResponse; } @@ -212,16 +216,16 @@ private Task Report(VerifyReportRequest request, FlashCallVerificationReportRequest flashCallVerificationReportRequest => _http.Send(uri, HttpMethod.Put, flashCallVerificationReportRequest, - cancellationToken: cancellationToken), + cancellationToken), SmsVerificationReportRequest smsVerificationRequest => _http .Send( uri, HttpMethod.Put, smsVerificationRequest, - cancellationToken: cancellationToken), + cancellationToken), PhoneCallVerificationReportRequest phoneRequest => _http .Send(uri, HttpMethod.Put, phoneRequest, - cancellationToken: cancellationToken), + cancellationToken), _ => throw new ArgumentOutOfRangeException(nameof(request)) }; } From 6bd45e6c207fcfc4a55985a49d4aa3012c9bc47e Mon Sep 17 00:00:00 2001 From: Dovchik Date: Thu, 1 Feb 2024 13:30:58 +0100 Subject: [PATCH 8/8] refactor: remove generic start verification method --- src/Sinch/Verification/SinchVerification.cs | 13 +------------ .../e2e/Verification/VerificationStartTests.cs | 17 ----------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/Sinch/Verification/SinchVerification.cs b/src/Sinch/Verification/SinchVerification.cs index cb865865..29eb721c 100644 --- a/src/Sinch/Verification/SinchVerification.cs +++ b/src/Sinch/Verification/SinchVerification.cs @@ -14,16 +14,6 @@ namespace Sinch.Verification { public interface ISinchVerification { - /// - /// This method is used by the mobile and web Verification SDKs to start a verification. - /// It can also be used to request a verification from your backend, by making an request. - /// - /// - /// - /// - Task Start(StartVerificationRequest request, - CancellationToken cancellationToken = default); - /// /// Starts an SMS Verification. Verification by SMS message with a PIN code. /// @@ -110,8 +100,7 @@ public SinchVerification(ILoggerAdapter logger, Uri baseAddre _http = http; } - /// - public Task Start(StartVerificationRequest request, + private Task Start(StartVerificationRequest request, CancellationToken cancellationToken = default) { var uri = new Uri(_baseAddress, "verification/v1/verifications"); diff --git a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs index 7ca83908..44cdb5b5 100644 --- a/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs +++ b/tests/Sinch.Tests/e2e/Verification/VerificationStartTests.cs @@ -62,11 +62,6 @@ public async Task StartSmsVerification() } }; - - var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); - responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( - startSmsVerificationResponse); - var response = await VerificationClient.Verification.StartSms(new StartSmsVerificationRequest { Custom = startVerificationRequest.Custom, @@ -102,10 +97,6 @@ public async Task StartFlashCallVerification() Links = _links }; - var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); - responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( - startFlashCallVerificationResponse); - var response = await VerificationClient.Verification.StartFlashCall(new StartFlashCallVerificationRequest { Identity = startVerificationRequest.Identity, @@ -131,10 +122,6 @@ public async Task StartPhoneCallVerification() Links = _links }; - var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); - responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( - startPhoneCallVerificationResponse); - var response = await VerificationClient.Verification.StartPhoneCall(new StartPhoneCallVerificationRequest { Identity = startVerificationRequest.Identity, @@ -163,10 +150,6 @@ public async Task StartSeamlessVerification() } }; - var responseGeneric = await VerificationClient.Verification.Start(startVerificationRequest); - responseGeneric.Should().BeOfType().Which.Should().BeEquivalentTo( - startDataVerificationResponse); - var response = await VerificationClient.Verification.StartSeamless(new StartDataVerificationRequest { Identity = startVerificationRequest.Identity,