From dfff5440971de91d671acdcb14bd096420ce63b3 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 7 Feb 2025 10:58:01 +0200 Subject: [PATCH 1/4] implemented creation of IdentityVerification --- src/main/java/com/mangopay/MangoPayApi.java | 14 +++++ .../java/com/mangopay/core/APIs/ApiBase.java | 3 + .../core/APIs/IdentityVerificationApi.java | 25 ++++++++ .../IdentityVerificationApiImpl.java | 31 ++++++++++ .../entities/IdentityVerification.java | 62 +++++++++++++++++++ .../core/IdentityVerificationApiImplTest.java | 24 +++++++ .../com/mangopay/core/PayInApiImplTest.java | 2 +- 7 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java create mode 100644 src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java create mode 100644 src/main/java/com/mangopay/entities/IdentityVerification.java create mode 100644 src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java diff --git a/src/main/java/com/mangopay/MangoPayApi.java b/src/main/java/com/mangopay/MangoPayApi.java index 99fb0462..6c8f081f 100644 --- a/src/main/java/com/mangopay/MangoPayApi.java +++ b/src/main/java/com/mangopay/MangoPayApi.java @@ -54,6 +54,7 @@ public MangoPayApi() { setDepositApi(new DepositApiImpl(this)); setVirtualAccountApi(new VirtualAccountApiImpl(this)); setConversionsApi(new ConversionsApiImpl(this, gsonBuilder)); + setIdentityVerificationApi(new IdentityVerificationApiImpl(this)); setGson(gsonBuilder.create()); } @@ -214,6 +215,11 @@ public MangoPayApi() { */ private ConversionsApi conversionApi; + /** + * Provides Identity Verification methods + */ + private IdentityVerificationApi identityVerificationApi; + private Gson gson; /** @@ -469,4 +475,12 @@ public ConversionsApi getConversionsApi() { public void setConversionsApi(ConversionsApi conversionApi) { this.conversionApi = conversionApi; } + + public IdentityVerificationApi getIdentityVerificationApi() { + return identityVerificationApi; + } + + public void setIdentityVerificationApi(IdentityVerificationApi identityVerificationApi) { + this.identityVerificationApi = identityVerificationApi; + } } diff --git a/src/main/java/com/mangopay/core/APIs/ApiBase.java b/src/main/java/com/mangopay/core/APIs/ApiBase.java index c6467005..8c73847b 100644 --- a/src/main/java/com/mangopay/core/APIs/ApiBase.java +++ b/src/main/java/com/mangopay/core/APIs/ApiBase.java @@ -250,6 +250,9 @@ protected MangoPayApi getRoot() { put("virtual_account_get", new String[]{"/wallets/%s/virtual-accounts/%s", RequestType.GET.toString()}); put("virtual_account_get_all", new String[]{"/wallets/%s/virtual-accounts", RequestType.GET.toString()}); put("virtual_account_get_availabilities", new String[]{"/virtual-accounts/availability", RequestType.GET.toString()}); + + // identity verification + put("identify_verification_create", new String[]{"/users/%s/identity-verifications", RequestType.POST.toString()}); }}; /** diff --git a/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java new file mode 100644 index 00000000..2bf4f2d8 --- /dev/null +++ b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java @@ -0,0 +1,25 @@ +package com.mangopay.core.APIs; + +import com.mangopay.entities.IdentityVerification; + + +public interface IdentityVerificationApi { + /** + * Start an identity verification session and get a link for the hosted experience + * + * @param identityVerification The IdentityVerification object. 'ReturnUrl' is required + * @param userId The user id + * @return IdentityVerification instance + */ + IdentityVerification create(IdentityVerification identityVerification, String userId) throws Exception; + + /** + * Start an identity verification session and get a link for the hosted experience + * + * @param identityVerification the IdentityVerification object. 'ReturnUrl' is required + * @param userId the user id + * @param idempotencyKey idempotency key for this request. + * @return IdentityVerification instance + */ + IdentityVerification create(IdentityVerification identityVerification, String userId, String idempotencyKey) throws Exception; +} diff --git a/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java new file mode 100644 index 00000000..5cd86086 --- /dev/null +++ b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java @@ -0,0 +1,31 @@ +package com.mangopay.core.APIs.implementation; + +import com.mangopay.MangoPayApi; +import com.mangopay.core.APIs.ApiBase; +import com.mangopay.core.APIs.IdentityVerificationApi; +import com.mangopay.entities.IdentityVerification; + +/** + * API for cards. + */ +public class IdentityVerificationApiImpl extends ApiBase implements IdentityVerificationApi { + + /** + * Creates new API instance. + * + * @param root Root/parent instance that holds the OAuthToken and Configuration instance. + */ + public IdentityVerificationApiImpl(MangoPayApi root) { + super(root); + } + + @Override + public IdentityVerification create(IdentityVerification identityVerification, String userId) throws Exception { + return create(identityVerification, userId, null); + } + + @Override + public IdentityVerification create(IdentityVerification identityVerification, String userId, String idempotencyKey) throws Exception { + return this.createObject(IdentityVerification.class, idempotencyKey, "identify_verification_create", identityVerification, userId); + } +} diff --git a/src/main/java/com/mangopay/entities/IdentityVerification.java b/src/main/java/com/mangopay/entities/IdentityVerification.java new file mode 100644 index 00000000..ee8b0e2a --- /dev/null +++ b/src/main/java/com/mangopay/entities/IdentityVerification.java @@ -0,0 +1,62 @@ +package com.mangopay.entities; + +import com.google.gson.annotations.SerializedName; +import com.mangopay.core.EntityBase; + +/** + * Card entity. + */ +public class IdentityVerification extends EntityBase { + + /** + * The URL to redirect the user to for the hosted identity verification session. + */ + @SerializedName("HostedUrl") + private String hostedUrl; + + /** + * 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.

+ */ + @SerializedName("Status") + private String status; + + /** + * The URL to which the user is returned after the hosted identity verification session, regardless of the outcome. + */ + @SerializedName("ReturnUrl") + private String returnUrl; + + public String getHostedUrl() { + return hostedUrl; + } + + public IdentityVerification setHostedUrl(String hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + public String getStatus() { + return status; + } + + public IdentityVerification setStatus(String status) { + this.status = status; + return this; + } + + public String getReturnUrl() { + return returnUrl; + } + + public IdentityVerification setReturnUrl(String returnUrl) { + this.returnUrl = returnUrl; + return this; + } +} diff --git a/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java new file mode 100644 index 00000000..cfe44705 --- /dev/null +++ b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java @@ -0,0 +1,24 @@ +package com.mangopay.core; + +import com.mangopay.entities.IdentityVerification; +import com.mangopay.entities.UserNatural; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class IdentityVerificationApiImplTest extends BaseTest { + + @Test + public void createIdentityVerification() throws Exception { + UserNatural user = this.getJohn(); + IdentityVerification createObject = new IdentityVerification().setReturnUrl("https://example.com"); + IdentityVerification identityVerification = this.getApi().getIdentityVerificationApi() + .create(createObject, user.getId()); + + assertNotNull(identityVerification); + assertNotNull(identityVerification.getHostedUrl()); + assertNotNull(identityVerification.getReturnUrl()); + assertEquals("PENDING", identityVerification.getStatus()); + } +} diff --git a/src/test/java/com/mangopay/core/PayInApiImplTest.java b/src/test/java/com/mangopay/core/PayInApiImplTest.java index 41542ee9..c2a3ed8b 100644 --- a/src/test/java/com/mangopay/core/PayInApiImplTest.java +++ b/src/test/java/com/mangopay/core/PayInApiImplTest.java @@ -774,7 +774,7 @@ public void testDirectApplepayPayin() { assertEquals(applePayPayin.getAuthorId(), createdPayin.getAuthorId()); assertEquals(createdPayin.getPaymentType(), PayInPaymentType.APPLEPAY); - // TODO: enable after updating the PaymentData + // SUCCEEDED payment can only be tested manually with updated payment data // assertEquals(createdPayin.getStatus(), TransactionStatus.SUCCEEDED); } catch (Exception e) { fail(e.getMessage()); From d6388c8584f3d4e268ee43a78078b41b05ab1142 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 7 Feb 2025 11:35:24 +0200 Subject: [PATCH 2/4] added support for fetching an IdentityVerification --- .../java/com/mangopay/core/APIs/ApiBase.java | 1 + .../core/APIs/IdentityVerificationApi.java | 8 ++++++ .../IdentityVerificationApiImpl.java | 5 ++++ .../core/IdentityVerificationApiImplTest.java | 28 +++++++++++++++---- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/mangopay/core/APIs/ApiBase.java b/src/main/java/com/mangopay/core/APIs/ApiBase.java index 8c73847b..3039fa41 100644 --- a/src/main/java/com/mangopay/core/APIs/ApiBase.java +++ b/src/main/java/com/mangopay/core/APIs/ApiBase.java @@ -253,6 +253,7 @@ protected MangoPayApi getRoot() { // identity verification put("identify_verification_create", new String[]{"/users/%s/identity-verifications", RequestType.POST.toString()}); + put("identify_verification_get", new String[]{"/identity-verifications/%s", RequestType.GET.toString()}); }}; /** diff --git a/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java index 2bf4f2d8..e70b368a 100644 --- a/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java +++ b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java @@ -22,4 +22,12 @@ public interface IdentityVerificationApi { * @return IdentityVerification instance */ IdentityVerification create(IdentityVerification identityVerification, String userId, String idempotencyKey) throws Exception; + + /** + * See the status and basic details of an identity verification session + * + * @param id The unique identifier of the identity verification session. + * @return IdentityVerification instance + */ + IdentityVerification get(String id) throws Exception; } diff --git a/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java index 5cd86086..b88f0de8 100644 --- a/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java +++ b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java @@ -28,4 +28,9 @@ public IdentityVerification create(IdentityVerification identityVerification, St public IdentityVerification create(IdentityVerification identityVerification, String userId, String idempotencyKey) throws Exception { return this.createObject(IdentityVerification.class, idempotencyKey, "identify_verification_create", identityVerification, userId); } + + @Override + public IdentityVerification get(String id) throws Exception { + return this.getObject(IdentityVerification.class, "identify_verification_get", id); + } } diff --git a/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java index cfe44705..283e9407 100644 --- a/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java +++ b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java @@ -2,6 +2,7 @@ import com.mangopay.entities.IdentityVerification; import com.mangopay.entities.UserNatural; +import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -9,16 +10,33 @@ public class IdentityVerificationApiImplTest extends BaseTest { + private static IdentityVerification identityVerification; + + @Before + public void initialize() throws Exception { + identityVerification = getNewIdentityVerification(); + } + @Test public void createIdentityVerification() throws Exception { - UserNatural user = this.getJohn(); - IdentityVerification createObject = new IdentityVerification().setReturnUrl("https://example.com"); - IdentityVerification identityVerification = this.getApi().getIdentityVerificationApi() - .create(createObject, user.getId()); - assertNotNull(identityVerification); assertNotNull(identityVerification.getHostedUrl()); assertNotNull(identityVerification.getReturnUrl()); assertEquals("PENDING", identityVerification.getStatus()); } + + @Test + public void getIdentityVerification() throws Exception { + IdentityVerification fetched = getApi().getIdentityVerificationApi().get(identityVerification.getId()); + assertNotNull(identityVerification); + assertEquals(identityVerification.getHostedUrl(), fetched.getHostedUrl()); + assertEquals(identityVerification.getReturnUrl(), fetched.getReturnUrl()); + assertEquals(identityVerification.getStatus(), fetched.getStatus()); + } + + private IdentityVerification getNewIdentityVerification() throws Exception { + UserNatural user = this.getJohn(); + IdentityVerification createObject = new IdentityVerification().setReturnUrl("https://example.com"); + return this.getApi().getIdentityVerificationApi().create(createObject, user.getId()); + } } From 01f45a53f4ceadcd2755a0aae1bae93b9634be99 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 7 Feb 2025 11:39:33 +0200 Subject: [PATCH 3/4] added event types for IdentityVerification --- src/main/java/com/mangopay/core/enumerations/EventType.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/mangopay/core/enumerations/EventType.java b/src/main/java/com/mangopay/core/enumerations/EventType.java index df9ef695..d15d6d46 100644 --- a/src/main/java/com/mangopay/core/enumerations/EventType.java +++ b/src/main/java/com/mangopay/core/enumerations/EventType.java @@ -105,4 +105,10 @@ public enum EventType { VIRTUAL_ACCOUNT_BLOCKED, VIRTUAL_ACCOUNT_CLOSED, VIRTUAL_ACCOUNT_FAILED, + + IDENTITY_VERIFICATION_VALIDATED, + IDENTITY_VERIFICATION_FAILED, + IDENTITY_VERIFICATION_INCONCLUSIVE, + IDENTITY_VERIFICATION_OUTDATED, + IDENTITY_VERIFICATION_TIMEOUT } From 19aa94b222e2c35ef7d2848e7831f3eb21efb984 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 7 Feb 2025 14:19:40 +0200 Subject: [PATCH 4/4] added IdentityVerification checks support --- .../java/com/mangopay/core/APIs/ApiBase.java | 1 + .../core/APIs/IdentityVerificationApi.java | 9 ++ .../IdentityVerificationApiImpl.java | 8 +- src/main/java/com/mangopay/core/Check.java | 95 +++++++++++++++++++ .../java/com/mangopay/core/CheckData.java | 35 +++++++ .../core/IdentityVerificationCheck.java | 85 +++++++++++++++++ .../core/IdentityVerificationApiImplTest.java | 19 +++- 7 files changed, 247 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/mangopay/core/Check.java create mode 100644 src/main/java/com/mangopay/core/CheckData.java create mode 100644 src/main/java/com/mangopay/core/IdentityVerificationCheck.java diff --git a/src/main/java/com/mangopay/core/APIs/ApiBase.java b/src/main/java/com/mangopay/core/APIs/ApiBase.java index 3039fa41..d9c0e972 100644 --- a/src/main/java/com/mangopay/core/APIs/ApiBase.java +++ b/src/main/java/com/mangopay/core/APIs/ApiBase.java @@ -254,6 +254,7 @@ protected MangoPayApi getRoot() { // identity verification put("identify_verification_create", new String[]{"/users/%s/identity-verifications", RequestType.POST.toString()}); put("identify_verification_get", new String[]{"/identity-verifications/%s", RequestType.GET.toString()}); + put("identify_verification_checks_get", new String[]{"/identity-verifications/%s/checks", RequestType.GET.toString()}); }}; /** diff --git a/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java index e70b368a..93221c51 100644 --- a/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java +++ b/src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java @@ -1,5 +1,6 @@ package com.mangopay.core.APIs; +import com.mangopay.core.IdentityVerificationCheck; import com.mangopay.entities.IdentityVerification; @@ -30,4 +31,12 @@ public interface IdentityVerificationApi { * @return IdentityVerification instance */ IdentityVerification get(String id) throws Exception; + + /** + * Obtain verified user data and results of each check performed + * + * @param id The unique identifier of the identity verification session. + * @return IdentityVerificationCheck instance + */ + IdentityVerificationCheck getChecks(String id) throws Exception; } diff --git a/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java index b88f0de8..392486f5 100644 --- a/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java +++ b/src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java @@ -3,10 +3,11 @@ import com.mangopay.MangoPayApi; import com.mangopay.core.APIs.ApiBase; import com.mangopay.core.APIs.IdentityVerificationApi; +import com.mangopay.core.IdentityVerificationCheck; import com.mangopay.entities.IdentityVerification; /** - * API for cards. + * API for Identity Verification Sessions. */ public class IdentityVerificationApiImpl extends ApiBase implements IdentityVerificationApi { @@ -33,4 +34,9 @@ public IdentityVerification create(IdentityVerification identityVerification, St public IdentityVerification get(String id) throws Exception { return this.getObject(IdentityVerification.class, "identify_verification_get", id); } + + @Override + public IdentityVerificationCheck getChecks(String id) throws Exception { + return this.getObject(IdentityVerificationCheck.class, "identify_verification_checks_get", id); + } } diff --git a/src/main/java/com/mangopay/core/Check.java b/src/main/java/com/mangopay/core/Check.java new file mode 100644 index 00000000..e3a0cd99 --- /dev/null +++ b/src/main/java/com/mangopay/core/Check.java @@ -0,0 +1,95 @@ +package com.mangopay.core; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class Check extends Dto { + + /** + * The unique identifier of the verification check. + */ + @SerializedName("CheckId") + private String checkId; + + /** + * 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.

+ */ + @SerializedName("Type") + private String type; + + /** + * Returned values: VALIDATED, REFUSED, REVIEW + */ + @SerializedName("CheckStatus") + private String checkStatus; + + /** + * The date and time at which the check was created. + */ + @SerializedName("CreationDate") + private long creationDate; + + /** + * The date and time at which the check was last updated. + */ + @SerializedName("LastUpdate") + private long lastUpdate; + + /** + * The data points collected and verified during the check. + */ + @SerializedName("Data") + private List data; + + public String getCheckId() { + return checkId; + } + + public void setCheckId(String checkId) { + this.checkId = checkId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCheckStatus() { + return checkStatus; + } + + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public long getCreationDate() { + return creationDate; + } + + public void setCreationDate(long creationDate) { + this.creationDate = creationDate; + } + + public long getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(long lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/src/main/java/com/mangopay/core/CheckData.java b/src/main/java/com/mangopay/core/CheckData.java new file mode 100644 index 00000000..1f9e6e7e --- /dev/null +++ b/src/main/java/com/mangopay/core/CheckData.java @@ -0,0 +1,35 @@ +package com.mangopay.core; + +import com.google.gson.annotations.SerializedName; + +public class CheckData extends Dto { + + /** + * The type of the data point. + * For more details, see the Verified data returned. + */ + @SerializedName("Type") + private String type; + + /** + * The value of the data point. + */ + @SerializedName("Value") + private String value; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/src/main/java/com/mangopay/core/IdentityVerificationCheck.java b/src/main/java/com/mangopay/core/IdentityVerificationCheck.java new file mode 100644 index 00000000..9ffb77da --- /dev/null +++ b/src/main/java/com/mangopay/core/IdentityVerificationCheck.java @@ -0,0 +1,85 @@ +package com.mangopay.core; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class IdentityVerificationCheck extends Dto { + + /** + * Unique identifier for the entire verification session. + */ + @SerializedName("SessionId") + private String sessionId; + + /** + * 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.

+ */ + @SerializedName("Status") + private String status; + + /** + * The date and time at which the session was created. + */ + @SerializedName("CreationDate") + private long creationDate; + + /** + * The date and time at which the session was last updated. + */ + @SerializedName("LastUpdate") + private long lastUpdate; + + /** + * The details of the individual verification checks performed during the session. + */ + @SerializedName("Checks") + private List checks; + + public String getSessionId() { + return sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public long getCreationDate() { + return creationDate; + } + + public void setCreationDate(long creationDate) { + this.creationDate = creationDate; + } + + public long getLastUpdate() { + return lastUpdate; + } + + public void setLastUpdate(long lastUpdate) { + this.lastUpdate = lastUpdate; + } + + public List getChecks() { + return checks; + } + + public void setChecks(List checks) { + this.checks = checks; + } +} diff --git a/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java index 283e9407..6b958969 100644 --- a/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java +++ b/src/test/java/com/mangopay/core/IdentityVerificationApiImplTest.java @@ -5,8 +5,7 @@ import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; public class IdentityVerificationApiImplTest extends BaseTest { @@ -34,9 +33,21 @@ public void getIdentityVerification() throws Exception { assertEquals(identityVerification.getStatus(), fetched.getStatus()); } + @Test + public void getIdentityVerificationChecks() throws Exception { + IdentityVerificationCheck check = getApi().getIdentityVerificationApi().getChecks(identityVerification.getId()); + assertNotNull(check); + assertEquals(identityVerification.getId(), check.getSessionId()); + assertEquals("PENDING", check.getStatus()); + assertTrue(check.getCreationDate() > 0); + assertTrue(check.getLastUpdate() > 0); + assertNotNull(check.getChecks()); + } + private IdentityVerification getNewIdentityVerification() throws Exception { - UserNatural user = this.getJohn(); + UserNatural user = getJohn(); IdentityVerification createObject = new IdentityVerification().setReturnUrl("https://example.com"); - return this.getApi().getIdentityVerificationApi().create(createObject, user.getId()); + createObject.setTag("Created by the Java SDK"); + return getApi().getIdentityVerificationApi().create(createObject, user.getId()); } }