Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
else
echo "Skipping integration tests because TROLLEY_ACCESS_KEY/TROLLEY_SECRET_KEY are not configured."
fi
- run:
name: Install GPG
command: apt-get update -qq && apt-get install -y gnupg
- run:
name: Upload coverage to Codecov
when: always
Expand Down
39 changes: 39 additions & 0 deletions tests/ClientRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,45 @@ public void GatewayRequestDispatchesPatch()
});
}

[TestMethod]
public void VerificationGatewayTriggersIdentityOrBusinessVerification()
{
string method = null;
string path = null;
string body = null;

WithServer(async context =>
{
method = context.Request.HttpMethod;
path = context.Request.RawUrl;
using (var reader = new System.IO.StreamReader(context.Request.InputStream, context.Request.ContentEncoding))
{
body = await reader.ReadToEndAsync();
}

byte[] response = Encoding.UTF8.GetBytes("{\"ok\":true}");
context.Response.StatusCode = 200;
context.Response.ContentType = "application/json";
context.Response.OutputStream.Write(response, 0, response.Length);
context.Response.Close();
}, baseUrl =>
{
var gateway = new Trolley.Gateway("access", "secret", baseUrl);

string response = gateway.verification.TriggerIdentityOrBusinessVerification(new
{
recipientId = "R-123",
types = new[] { "individual" },
retryAllowed = true
});

Assert.AreEqual("POST", method);
Assert.AreEqual("/v1/verifications/trigger", path);
Assert.AreEqual("{\"recipientId\":\"R-123\",\"types\":[\"individual\"],\"retryAllowed\":true}", body);
Assert.AreEqual("{\"ok\":true}", response);
});
}

private static void WithServer(Func<HttpListenerContext, Task> handler, Action<string> test)
{
int port = GetAvailablePort();
Expand Down
6 changes: 6 additions & 0 deletions trolley/VerificationGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public string Trigger(string verificationType, object body)
return this.gateway.client.Post(endPoint, JsonConvert.SerializeObject(body));
}

public string TriggerIdentityOrBusinessVerification(object body)
{
string endPoint = "/v1/verifications/trigger";
return this.gateway.client.Post(endPoint, JsonConvert.SerializeObject(body));
}

public string TriggerWatchlist(object body)
{
string endPoint = "/v1/verifications/watchlist/trigger";
Expand Down
Loading