diff --git a/MangoPay.SDK.Tests/ApiIdentityVerificationsTest.cs b/MangoPay.SDK.Tests/ApiIdentityVerificationsTest.cs
new file mode 100644
index 0000000..627252b
--- /dev/null
+++ b/MangoPay.SDK.Tests/ApiIdentityVerificationsTest.cs
@@ -0,0 +1,65 @@
+using System.Threading.Tasks;
+using MangoPay.SDK.Entities.GET;
+using MangoPay.SDK.Entities.POST;
+using NUnit.Framework;
+
+namespace MangoPay.SDK.Tests
+{
+ [TestFixture]
+ [Explicit]
+ public class ApiIdentityVerifications : BaseTest
+ {
+ private static IdentityVerificationDTO _identityVerification;
+
+ [Test]
+ public async Task Test_CreateIdentityVerification()
+ {
+ await GetNewIdentityVerification();
+
+ Assert.IsNotNull(_identityVerification);
+ Assert.IsNotNull(_identityVerification.ReturnUrl);
+ Assert.IsNotNull(_identityVerification.HostedUrl);
+ Assert.IsNotNull(_identityVerification.Status);
+ }
+
+ [Test]
+ public async Task Test_GetIdentityVerification()
+ {
+ await GetNewIdentityVerification();
+ IdentityVerificationDTO fetched = await Api.IdentityVerifications.GetAsync(_identityVerification.Id);
+
+ Assert.IsNotNull(fetched);
+ Assert.AreEqual(_identityVerification.HostedUrl, fetched.HostedUrl);
+ Assert.AreEqual(_identityVerification.ReturnUrl, fetched.ReturnUrl);
+ Assert.AreEqual(_identityVerification.Status, fetched.Status);
+ }
+
+ [Test]
+ public async Task Test_GetIdentityVerificationChecks()
+ {
+ await GetNewIdentityVerification();
+ IdentityVerificationCheckDTO check =
+ await Api.IdentityVerifications.GetChecksAsync(_identityVerification.Id);
+
+ Assert.IsNotNull(check);
+ Assert.IsNotNull(check.SessionId);
+ Assert.IsNotNull(check.Status);
+ Assert.IsNotNull(check.LastUpdate);
+ Assert.IsNotNull(check.CreationDate);
+ Assert.IsNotNull(check.Checks);
+ }
+
+ private async Task GetNewIdentityVerification()
+ {
+ if (_identityVerification == null)
+ {
+ UserNaturalDTO john = await GetJohn();
+ IdentityVerificationPostDto postDto = new IdentityVerificationPostDto();
+ postDto.ReturnUrl = "https://example.com";
+ postDto.Tag = "Created by the .NET SDK";
+
+ _identityVerification = await Api.IdentityVerifications.CreateAsync(postDto, john.Id);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MangoPay.SDK/Core/APIs/ApiBase.cs b/MangoPay.SDK/Core/APIs/ApiBase.cs
index 48e3ff1..35d3aee 100644
--- a/MangoPay.SDK/Core/APIs/ApiBase.cs
+++ b/MangoPay.SDK/Core/APIs/ApiBase.cs
@@ -245,7 +245,11 @@ public abstract class ApiBase
{ MethodKey.VirtualAccountDeactivate, new ApiEndPoint("/wallets/{0}/virtual-accounts/{1}", RequestType.PUT) },
{ MethodKey.VirtualAccountGet, new ApiEndPoint("/wallets/{0}/virtual-accounts/{1}", RequestType.GET) },
{ MethodKey.VirtualAccountGetAll, new ApiEndPoint("/wallets/{0}/virtual-accounts", RequestType.GET) },
- { MethodKey.VirtualAccountGetAvailabilities, new ApiEndPoint("/virtual-accounts/availability", RequestType.GET) }
+ { MethodKey.VirtualAccountGetAvailabilities, new ApiEndPoint("/virtual-accounts/availability", RequestType.GET) },
+
+ { MethodKey.IdentityVerificationCreate, new ApiEndPoint("/users/{0}/identity-verifications", RequestType.POST) },
+ { MethodKey.IdentityVerificationGet, new ApiEndPoint("/identity-verifications/{0}", RequestType.GET) },
+ { MethodKey.IdentityVerificationGetChecks, new ApiEndPoint("/identity-verifications/{0}/checks", RequestType.GET) }
};
/// Creates new API instance.
diff --git a/MangoPay.SDK/Core/APIs/ApiIdentityVerifications.cs b/MangoPay.SDK/Core/APIs/ApiIdentityVerifications.cs
new file mode 100644
index 0000000..9e74288
--- /dev/null
+++ b/MangoPay.SDK/Core/APIs/ApiIdentityVerifications.cs
@@ -0,0 +1,48 @@
+using System.Threading.Tasks;
+using MangoPay.SDK.Core.Enumerations;
+using MangoPay.SDK.Entities.GET;
+using MangoPay.SDK.Entities.POST;
+
+namespace MangoPay.SDK.Core.APIs
+{
+ /// API for identity verification.
+ public class ApiIdentityVerifications : ApiBase
+ {
+ /// Instantiates new ApiIdentityVerification object.
+ /// Root/parent instance that holds the OAuthToken and Configuration instance.
+ public ApiIdentityVerifications(MangoPayApi root) : base(root)
+ {
+ }
+
+ /// Creates new identity verification.
+ /// Idempotent key for this request.
+ /// Object instance to be created.
+ /// The user identifier.
+ /// Object instance returned from API.
+ public async Task CreateAsync(IdentityVerificationPostDto identityVerification,
+ string userId, string idempotentKey = null)
+ {
+ return await CreateObjectAsync(
+ MethodKey.IdentityVerificationCreate, identityVerification,
+ idempotentKey, userId);
+ }
+
+ /// See the status and basic details of an identity verification session
+ /// Identity verification identitifer.
+ /// Object instance returned from API.
+ public async Task GetAsync(string id)
+ {
+ return await this.GetObjectAsync(MethodKey.IdentityVerificationGet,
+ entitiesId: id);
+ }
+
+ /// Obtain verified user data and results of each check performed
+ /// Identity verification identitifer.
+ /// Object instance returned from API.
+ public async Task GetChecksAsync(string id)
+ {
+ return await this.GetObjectAsync(MethodKey.IdentityVerificationGetChecks,
+ entitiesId: id);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MangoPay.SDK/Core/Enumerations/EventType.cs b/MangoPay.SDK/Core/Enumerations/EventType.cs
index 5d6a1d1..743e30a 100644
--- a/MangoPay.SDK/Core/Enumerations/EventType.cs
+++ b/MangoPay.SDK/Core/Enumerations/EventType.cs
@@ -1,6 +1,4 @@
-using System;
-
namespace MangoPay.SDK.Core.Enumerations
{
/// Event types enumeration.
@@ -105,6 +103,12 @@ public enum EventType
VIRTUAL_ACCOUNT_ACTIVE,
VIRTUAL_ACCOUNT_BLOCKED,
VIRTUAL_ACCOUNT_CLOSED,
- VIRTUAL_ACCOUNT_FAILED
+ VIRTUAL_ACCOUNT_FAILED,
+
+ IDENTITY_VERIFICATION_VALIDATED,
+ IDENTITY_VERIFICATION_FAILED,
+ IDENTITY_VERIFICATION_INCONCLUSIVE,
+ IDENTITY_VERIFICATION_OUTDATED,
+ IDENTITY_VERIFICATION_TIMEOUT
}
}
diff --git a/MangoPay.SDK/Core/Enumerations/MethodKey.cs b/MangoPay.SDK/Core/Enumerations/MethodKey.cs
index 84fb3cd..53e67c1 100644
--- a/MangoPay.SDK/Core/Enumerations/MethodKey.cs
+++ b/MangoPay.SDK/Core/Enumerations/MethodKey.cs
@@ -205,5 +205,9 @@ public enum MethodKey
VirtualAccountGetAll,
VirtualAccountDeactivate,
VirtualAccountGetAvailabilities,
+
+ IdentityVerificationCreate,
+ IdentityVerificationGet,
+ IdentityVerificationGetChecks
}
}
diff --git a/MangoPay.SDK/Entities/GET/CheckDTO.cs b/MangoPay.SDK/Entities/GET/CheckDTO.cs
new file mode 100644
index 0000000..a6093d8
--- /dev/null
+++ b/MangoPay.SDK/Entities/GET/CheckDTO.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using MangoPay.SDK.Core;
+using Newtonsoft.Json;
+
+namespace MangoPay.SDK.Entities.GET
+{
+ public class CheckDTO
+ {
+ /// The unique identifier of the verification check.
+ public string CheckId { get; set; }
+
+ ///
+ /// Type of verification check performed:
+ /// BUSINESS_VERIFICATION - Verification of the business entity of a Legal User.
+ /// IDENTITY_DOCUMENT_VERIFICATION - Verification of the identity document of a Natural User or the legal representative of a Legal User.
+ /// PERSONS_SIGNIFICANT_CONTROL - Verification of a person of significant control of a Legal User.
+ ///
+ public string Type { get; set; }
+
+ /// Returned values: VALIDATED, REFUSED, REVIEW
+ public string CheckStatus { get; set; }
+
+ /// The date and time at which the check was created.
+ [JsonConverter(typeof(UnixDateTimeConverter))]
+ public DateTime CreationDate { get; set; }
+
+ /// The date and time at which the check was last updated.
+ [JsonConverter(typeof(UnixDateTimeConverter))]
+ public DateTime LastUpdate { get; set; }
+
+ ///
+ /// The data points collected and verified during the check.
+ ///
+ public List Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MangoPay.SDK/Entities/GET/CheckDataDTO.cs b/MangoPay.SDK/Entities/GET/CheckDataDTO.cs
new file mode 100644
index 0000000..ee914b0
--- /dev/null
+++ b/MangoPay.SDK/Entities/GET/CheckDataDTO.cs
@@ -0,0 +1,11 @@
+namespace MangoPay.SDK.Entities.GET
+{
+ public class CheckDataDTO
+ {
+ /// The type of the data point.
+ public string Type { get; set; }
+
+ /// The value of the data point.
+ public string Value { get; set; }
+ }
+}
diff --git a/MangoPay.SDK/Entities/GET/IdentityVerificationCheckDTO.cs b/MangoPay.SDK/Entities/GET/IdentityVerificationCheckDTO.cs
new file mode 100644
index 0000000..e9ec516
--- /dev/null
+++ b/MangoPay.SDK/Entities/GET/IdentityVerificationCheckDTO.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using MangoPay.SDK.Core;
+using Newtonsoft.Json;
+
+namespace MangoPay.SDK.Entities.GET
+{
+ public class IdentityVerificationCheckDTO : EntityBase
+ {
+ /// Unique identifier for the entire verification session.
+ public string SessionId { get; set; }
+
+ ///
+ /// The status of the identity verification session:
+ /// PENDING – The session is available on the HostedUrl, to which the user must be redirected to complete it.
+ /// VALIDATED – The session was successful.
+ /// REFUSED – The session was refused.
+ /// REVIEW – The session is under manual review by Mangopay.
+ /// OUTDATED – The session is no longer valid (likely due to expired documents used during the session).
+ /// TIMEOUT – The session timed out due to inactivity.
+ /// ERROR – The session was not completed because an error occurred.
+ ///
+ public string Status { get; set; }
+
+ /// The date and time at which the session was last updated.
+ [JsonConverter(typeof(UnixDateTimeConverter))]
+ public DateTime LastUpdate { get; set; }
+
+ ///
+ /// The details of the individual verification checks performed during the session.
+ ///
+ public List Checks { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MangoPay.SDK/Entities/GET/IdentityVerificationDTO.cs b/MangoPay.SDK/Entities/GET/IdentityVerificationDTO.cs
new file mode 100644
index 0000000..1b557e0
--- /dev/null
+++ b/MangoPay.SDK/Entities/GET/IdentityVerificationDTO.cs
@@ -0,0 +1,23 @@
+namespace MangoPay.SDK.Entities.GET
+{
+ public class IdentityVerificationDTO : EntityBase
+ {
+ /// The URL to which the user is returned after the hosted identity verification session, regardless of the outcome.
+ public string ReturnUrl { get; set; }
+
+ /// The URL to redirect the user to for the hosted identity verification session.
+ public string HostedUrl { get; set; }
+
+ ///
+ /// The status of the identity verification session:
+ /// PENDING – The session is available on the HostedUrl, to which the user must be redirected to complete it.
+ /// VALIDATED – The session was successful.
+ /// REFUSED – The session was refused.
+ /// REVIEW – The session is under manual review by Mangopay.
+ /// OUTDATED – The session is no longer valid (likely due to expired documents used during the session).
+ /// TIMEOUT – The session timed out due to inactivity.
+ /// ERROR – The session was not completed because an error occurred.
+ ///
+ public string Status { get; set; }
+ }
+}
diff --git a/MangoPay.SDK/Entities/POST/IdentityVerificationPostDTO.cs b/MangoPay.SDK/Entities/POST/IdentityVerificationPostDTO.cs
new file mode 100644
index 0000000..88e35f3
--- /dev/null
+++ b/MangoPay.SDK/Entities/POST/IdentityVerificationPostDTO.cs
@@ -0,0 +1,8 @@
+namespace MangoPay.SDK.Entities.POST
+{
+ public class IdentityVerificationPostDto : EntityPostBase
+ {
+ /// The URL to which the user is returned after the hosted identity verification session, regardless of the outcome.
+ public string ReturnUrl { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MangoPay.SDK/MangoPayApi.cs b/MangoPay.SDK/MangoPayApi.cs
index 1b95b95..4294977 100644
--- a/MangoPay.SDK/MangoPayApi.cs
+++ b/MangoPay.SDK/MangoPayApi.cs
@@ -1,6 +1,6 @@
-using MangoPay.SDK.Core;
+using System;
+using MangoPay.SDK.Core;
using MangoPay.SDK.Core.APIs;
-using System;
namespace MangoPay.SDK
{
@@ -44,6 +44,7 @@ public MangoPayApi()
Deposits = new ApiDeposits(this);
Conversions = new ApiConversions(this);
VirtualAccounts = new ApiVirtualAccounts(this);
+ IdentityVerifications = new ApiIdentityVerifications(this);
}
/// Provides authorization token methods.
@@ -130,6 +131,8 @@ public MangoPayApi()
public ApiVirtualAccounts VirtualAccounts;
+ public ApiIdentityVerifications IdentityVerifications;
+
#endregion
#region Internal and private