-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from Mangopay/feature/identity-verification
[Feature] Identity Verification
- Loading branch information
Showing
11 changed files
with
440 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/mangopay/core/APIs/IdentityVerificationApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.mangopay.core.APIs; | ||
|
||
import com.mangopay.core.IdentityVerificationCheck; | ||
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; | ||
|
||
/** | ||
* 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; | ||
|
||
/** | ||
* 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; | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/mangopay/core/APIs/implementation/IdentityVerificationApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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.core.IdentityVerificationCheck; | ||
import com.mangopay.entities.IdentityVerification; | ||
|
||
/** | ||
* API for Identity Verification Sessions. | ||
*/ | ||
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); | ||
} | ||
|
||
@Override | ||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: | ||
* <p>BUSINESS_VERIFICATION - Verification of the business entity of a Legal User.</p> | ||
* <p>IDENTITY_DOCUMENT_VERIFICATION - Verification of the identity document of a Natural User or the legal representative of a Legal User.</p> | ||
* <p>PERSONS_SIGNIFICANT_CONTROL - Verification of a person of significant control of a Legal User.</p> | ||
*/ | ||
@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<CheckData> 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<CheckData> getData() { | ||
return data; | ||
} | ||
|
||
public void setData(List<CheckData> data) { | ||
this.data = data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, <a href="https://mangopay-idv.mintlify.app/guides/users/verification/hosted?_gl=1*1unwn0t*_up*MQ..*_ga*ODg5MjI4ODQzLjE3Mzg5MjY2NjE.*_ga_VZLQHP6CFB*MTczODkyNjY2MC4xLjAuMTczODkyNjY2MC4wLjAuMA..#verified-data-returned">see the Verified data returned.</a> | ||
*/ | ||
@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; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/main/java/com/mangopay/core/IdentityVerificationCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: | ||
* <p>PENDING – The session is available on the HostedUrl, to which the user must be redirected to complete it.</p> | ||
* <p>VALIDATED – The session was successful.</p> | ||
* <p>REFUSED – The session was refused.</p> | ||
* <p>REVIEW – The session is under manual review by Mangopay.</p> | ||
* <p>OUTDATED – The session is no longer valid (likely due to expired documents used during the session).</p> | ||
* <p>TIMEOUT – The session timed out due to inactivity.</p> | ||
* <p>ERROR – The session was not completed because an error occurred.</p> | ||
*/ | ||
@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<Check> 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<Check> getChecks() { | ||
return checks; | ||
} | ||
|
||
public void setChecks(List<Check> checks) { | ||
this.checks = checks; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.