XRay.ClientV2
0.1.4
dotnet add package XRay.ClientV2 --version 0.1.4
NuGet\Install-Package XRay.ClientV2 -Version 0.1.4
<PackageReference Include="XRay.ClientV2" Version="0.1.4" />
paket add XRay.ClientV2 --version 0.1.4
#r "nuget: XRay.ClientV2, 0.1.4"
// Install XRay.ClientV2 as a Cake Addin #addin nuget:?package=XRay.ClientV2&version=0.1.4 // Install XRay.ClientV2 as a Cake Tool #tool nuget:?package=XRay.ClientV2&version=0.1.4
XRay
Package for testing and using XRay KYC/B services.
Before you start using this package, you will need to register your organisation at XRay Portal, and obtain your unique Token.
Usage info
To use XRayApiClient
you will need to provide it with url endpoint and Token.
Token is secret key generated on portal and is unique to your organisation.
To use APIs you first need to authenticate client using AuthenticateWithAsync
method.
It will use provided token to get XRay's access token - which lasts for a short period of time - usually 30min.
After token expires, authenticate again with the same Token.
After authentication, you can use XRayApiClient
to create and retrieve sessions.
Set isTesting = true
on session to use test data that is not billed.
Example
Creating session
Returned session will be populated only with small subset of data - to get details, use GetSessionDetails()
static async Task<Session> CreateTestSession_PersonPasses()
{
using var client = new XRayApiClient(Endpoint);
await client.AuthenticateWithAsync(Token);
Session session;
try
{
session = await client
.SetPerson(new PersonInput()
{
FirstName = "John",
MiddleName = "Henry",
LastName = "Smith",
Gender = "male",
IsoLatin1Name = "Johnny",
Nationality = "AU",
Dob = DateTime.Parse("2000-03-03"),
Documents = new List<DocumentInput>() {
new DocumentInput { Number = "B23SDS2233", Expiry = DateTime.Parse("2022-03-03"), Type = DocumentType.MediCard }
},
Communications = new List<CommunicationInput>() {
new CommunicationInput { IpAddress = "22.22.22.22", Website = "www.johnsmith.com" }
},
})
.SetIsTesting(true)
.SetResponseTransport(ResponseTransport.LongPolling)
//.SetWebhook("https://en4f7tfoezabp.x.pipedream.net/")
.SetDescription("Test from code: " + DateTime.Now.ToString())
.SetConfigurationId(ConfigurationId)
.PublishAsync();
}
catch (ResponseException resExc)
{
Console.WriteLine(resExc.Message);
Console.WriteLine(String.Join("\n", resExc.AllErrorMessages));
return null;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
// Now get all details about session
return await GetSessionDetails(session.Id ?? Guid.Empty, client);
}
Get Session details
static async Task<Session> GetSessionDetails(Guid id, XRayApiClient client)
{
try
{
var session = await client.GetSessionAsync(id);
Console.WriteLine(JsonSerializer.Serialize(session, new JsonSerializerOptions { WriteIndented = true }));
return session;
}
catch (ResponseException resExc)
{
Console.WriteLine(resExc.Message);
Console.WriteLine(String.Join("\n", resExc.AllErrorMessages));
return null;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- GraphQL (>= 3.1.5)
- GraphQL.Client (>= 4.0.2)
- GraphQL.Client.Serializer.Newtonsoft (>= 4.0.2)
- GraphQlClientGenerator (>= 0.9.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.