com.yodlee.sdk.api.VerificationApi Maven / Gradle / Ivy
/**
* Copyright (c) 2019 Yodlee, Inc. All Rights Reserved.
*
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
package com.yodlee.sdk.api;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yodlee.api.model.verification.enums.VerificationType;
import com.yodlee.api.model.verification.enums.VerifiedAccountsVerificationStatus;
import com.yodlee.api.model.verification.request.UpdateVerificationRequest;
import com.yodlee.api.model.verification.request.VerificationMatchingRequest;
import com.yodlee.api.model.verification.request.VerificationRequest;
import com.yodlee.api.model.verification.response.ClassificationSummaryResponse;
import com.yodlee.api.model.verification.response.HolderProfileResponse;
import com.yodlee.api.model.verification.response.VerificationResponse;
import com.yodlee.api.model.verification.response.VerificationStatusResponse;
import com.yodlee.api.model.verification.response.VerifiedAccountResponse;
import com.yodlee.sdk.api.exception.ApiException;
import com.yodlee.sdk.api.util.ApiUtils;
import com.yodlee.sdk.api.validators.VerificationValidator;
import com.yodlee.sdk.client.ApiCallback;
import com.yodlee.sdk.client.ApiClient;
import com.yodlee.sdk.client.ApiContext;
import com.yodlee.sdk.client.ApiResponse;
import com.yodlee.sdk.client.CallContext;
import com.yodlee.sdk.client.HttpMethod;
import com.yodlee.sdk.client.Pair;
import com.yodlee.sdk.context.Context;
import okhttp3.Call;
public class VerificationApi extends AbstractApi {
private static final String VERIFICATION_TYPE = "verificationType";
private static final String PARAM_PROVIDER_ACCOUNT_ID = "providerAccountId";
private static final String PARAM_ACCOUNT_ID = "accountId";
private static final String PARAM_VERIFICATION_STATUS = "verificationStatus";
private static final String PARAM_IS_SELECTED = "isSelected";
private static final Logger LOGGER = LoggerFactory.getLogger(VerificationApi.class);
public VerificationApi(Context> context) {
super(context);
}
/**
* Get Verification Details The get verification status service is used to retrieve the verification status of all
* accounts
* for which the MS or CDV process has been initiated.
* For the MS process, the account details object returns the aggregated information of the
* verified accounts. For the CDV process, the account details object returns the user
* provided account information.
*
* @param accountId Comma separated accountId (optional)
* @param providerAccountId Comma separated providerAccountId (optional)
* @param verificationType verificationType (optional)
* @return {@link ApiResponse}<{@link VerificationStatusResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse getVerificationDetails(Long[] accountId, Long[] providerAccountId,
VerificationType verificationType) throws ApiException {
LOGGER.info("Verification GetVerificationDetails API execution started");
VerificationValidator.validateGetVerificationDetails(this, ApiUtils.getMethodName(), providerAccountId,
accountId, verificationType);
CallContext callContext = buildGetVerificationDetailsContext(accountId, providerAccountId, verificationType);
return callContext.getApiClient().execute(callContext.getCall(), VerificationStatusResponse.class);
}
/**
* Get Verification Details The get verification status service is used to retrieve the verification status of all
* accounts
* for which the MS or CDV process has been initiated.
* For the MS process, the account details object returns the aggregated information of the
* verified accounts. For the CDV process, the account details object returns the user
* provided account information.
*
* @param accountId Comma separated accountId (optional)
* @param providerAccountId Comma separated providerAccountId (optional)
* @param verificationType verificationType (optional)
* @param apiCallback {@link ApiCallback}<{@link VerificationStatusResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void getVerificationDetailsAsync(Long[] accountId, Long[] providerAccountId,
VerificationType verificationType, ApiCallback apiCallback)
throws ApiException {
LOGGER.info("Verification GetVerificationDetailsAsync API execution started");
VerificationValidator.validateGetVerificationDetails(this, ApiUtils.getMethodName(), providerAccountId,
accountId, verificationType);
CallContext callContext = buildGetVerificationDetailsContext(accountId, providerAccountId, verificationType);
callContext.getApiClient().executeAsync(callContext.getCall(), VerificationStatusResponse.class, apiCallback);
}
private CallContext buildGetVerificationDetailsContext(Long[] accountId, Long[] providerAccountId,
VerificationType verificationType) throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.VERIFICATION, HttpMethod.GET, null);
if (accountId != null && accountId.length > 0) {
apiContext.addQueryParam(new Pair(PARAM_ACCOUNT_ID, ApiUtils.convertArrayToString(accountId)));
}
if (providerAccountId != null && providerAccountId.length > 0) {
apiContext.addQueryParam(new Pair(PARAM_PROVIDER_ACCOUNT_ID, ApiUtils.convertArrayToString(providerAccountId)));
}
if (verificationType != null) {
apiContext.addQueryParam(new Pair(VERIFICATION_TYPE, verificationType.toString()));
}
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Initiate Challenge Deposit Verification The post verification service is used to initiate thechallenge deposit
* account verification (CDV) process to verify account ownership.
* TheCDV process can verify ownership of only bank accounts (i.e., checking and savings).
* Once the CDV process is initiated Yodlee will post the microtransaction (i.e., credit and debit) in the user's
* account.
* The CDV process takes 2 to 3 days to complete as it requires the user to provide the microtransaction
* details.
* The CDV process is currently supported only in the United States.
* The verificationId in the response can be used to track the verification request.
*
* @param verificationParam(required)
* @return {@link ApiResponse}<{@link VerificationResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse initiateCDVerification(
@NotNull(message = "{verifications.VerificationRequest.required}") VerificationRequest verificationParam)
throws ApiException {
LOGGER.info("Verification InitiateCDVerification execution started");
VerificationValidator.validateInitiateCDVerification(this, ApiUtils.getMethodName(), verificationParam);
CallContext callContext = buildInitiateCDVerificationContext(verificationParam);
return callContext.getApiClient().execute(callContext.getCall(), VerificationResponse.class);
}
/**
* Initiate Challenge Deposit Verification The post verification service is used to initiate thechallenge deposit
* account verification (CDV) process to verify account ownership.
* TheCDV process can verify ownership of only bank accounts (i.e., checking and savings).
* Once the CDV process is initiated Yodlee will post the microtransaction (i.e., credit and debit) in the user's
* account.
* The CDV process takes 2 to 3 days to complete as it requires the user to provide the microtransaction
* details.
* The CDV process is currently supported only in the United States.
* The verificationId in the response can be used to track the verification request.
*
* @param verificationParam (required)
* @param apiCallback {@link ApiCallback}<{@link VerificationResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void initiateCDVerificationAsync(
@NotNull(message = "{verifications.VerificationRequest.required}") VerificationRequest verificationParam,
ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification InitiateCDVerificationAsync execution started");
VerificationValidator.validateInitiateCDVerification(this, ApiUtils.getMethodName(), verificationParam);
CallContext callContext = buildInitiateCDVerificationContext(verificationParam);
callContext.getApiClient().executeAsync(callContext.getCall(), VerificationResponse.class, apiCallback);
}
private CallContext buildInitiateCDVerificationContext(VerificationRequest verificationParam) throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.VERIFICATION, HttpMethod.POST, verificationParam);
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Perform Matching Verification The post verification service is used to initiate the matching service (MS) to
* verify account ownership.
* The MS can verify ownership of only bank accounts (i.e., checking and savings).
* MS verification - The MS verification can be initiated only for an already aggregated account or a
* providerAccount.
* The prerequisite for the MS verification process is to request the following ACCT_PROFILE dataset attributes
* FULL_ACCT_NUMBER
* BANK_TRANSFER_CODE (optional based on the configuration done for the customer)
* HOLDER_NAME
* In the MS verification process, a string-match of the account holder name with the registered user name is
* performed instantaneously.
* Contact the Yodlee CustomerCare team to configure the full name or only the last name match.
*
* @param verificationParam verification information (required)
* @return {@link ApiResponse}<{@link VerificationResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse performMatchingVerification(
@NotNull(message = "{verifications.VerificationMatchingRequest.required}") VerificationMatchingRequest verificationParam)
throws ApiException {
LOGGER.info("Verification PerformMatchingVerificationAsync execution started");
VerificationValidator.validateMatchingVerification(this, ApiUtils.getMethodName(), verificationParam);
CallContext callContext = buildPerformMatchingVerificationContext(verificationParam);
return callContext.getApiClient().execute(callContext.getCall(), VerificationResponse.class);
}
/**
* Perform Matching Verification The post verification service is used to initiate the matching service (MS) to
* verify account ownership.
* The MS can verify ownership of only bank accounts (i.e., checking and savings).
* MS verification - The MS verification can be initiated only for an already aggregated account or a
* providerAccount.
* The prerequisite for the MS verification process is to request the following ACCT_PROFILE dataset attributes
* FULL_ACCT_NUMBER
* BANK_TRANSFER_CODE (optional based on the configuration done for the customer)
* HOLDER_NAME
* In the MS verification process, a string-match of the account holder name with the registered user name is
* performed instantaneously.
* Contact the Yodlee CustomerCare team to configure the full name or only the last name match.
*
* @param verificationParam verification information (required)
* @param apiCallback {@link ApiCallback}<{@link VerificationResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void performMatchingVerificationAsync(
@NotNull(message = "{verifications.VerificationMatchingRequest.required}") VerificationMatchingRequest verificationParam,
ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification PerformMatchingVerificationAsync execution started");
VerificationValidator.validateMatchingVerification(this, ApiUtils.getMethodName(), verificationParam);
CallContext callContext = buildPerformMatchingVerificationContext(verificationParam);
callContext.getApiClient().executeAsync(callContext.getCall(), VerificationResponse.class, apiCallback);
}
private CallContext buildPerformMatchingVerificationContext(VerificationMatchingRequest verificationParam)
throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.VERIFICATION, HttpMethod.POST, verificationParam);
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Perform Challenge Deposit Verification The put verification service is used to complete the CDV process.
* In the CDV process, the user-provided microtransaction details (i.e., credit and debit) is matched against the
* microtransactions posted by Yodlee.
* For a successful verification of the account's ownership both microtransaction details should match.
* The CDV process is currently supported only in the United States.
*
* @param updateVerificationRequest verification information (required)
* @return {@link ApiResponse}<{@link VerificationResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse performCDVerification(
@NotNull(message = "{verifications.UpdateVerificationRequest.required}") UpdateVerificationRequest updateVerificationRequest)
throws ApiException {
LOGGER.info("Verification PerformCDVerification API execution started");
VerificationValidator.validatePerformCDVerification(this, ApiUtils.getMethodName(), updateVerificationRequest);
CallContext callContext = buildPerformCDVerificationContext(updateVerificationRequest);
return callContext.getApiClient().execute(callContext.getCall(), VerificationResponse.class);
}
/**
* Perform Challenge Deposit Verification The put verification service is used to complete the CDV process.
* In the CDV process, the user-provided microtransaction details (i.e., credit and debit) is matched against the
* microtransactions posted by Yodlee.
* For a successful verification of the account's ownership both microtransaction details should match.
* The CDV process is currently supported only in the United States.
*
* @param updateVerificationRequest verification information (required)
* @param apiCallback {@link ApiCallback}<{@link VerificationResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void performCDVerificationAsync(
@NotNull(message = "{verifications.UpdateVerificationRequest.required}") UpdateVerificationRequest updateVerificationRequest,
ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification PerformCDVerificationAsync API execution started");
VerificationValidator.validatePerformCDVerification(this, ApiUtils.getMethodName(), updateVerificationRequest);
CallContext callContext = buildPerformCDVerificationContext(updateVerificationRequest);
callContext.getApiClient().executeAsync(callContext.getCall(), VerificationResponse.class, apiCallback);
}
private CallContext buildPerformCDVerificationContext(UpdateVerificationRequest updateVerificationRequest)
throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.VERIFICATION, HttpMethod.PUT, updateVerificationRequest);
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Verified Accounts
* The Verified Accounts API v1.1 provides information of bank and investment accounts that are verified by the user
* and applies only to Instant Account Verification (IAV) customers using FastLink 4.0.
* By default, the API only returns successfully verified accounts' information.
*
* @param providerAccountId providerAccountId (required)
* @param accountId accountId (optional)
* @param verificationStatus verificationStatus (optional)
* @param isSelected isSelected (optional)
* @return {@link ApiResponse}<{@link VerifiedAccountResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse
getVerifiedAccounts(//
@NotNull(message = "{verifications.param.providerAccountId.provided}") long providerAccountId,
@Size(min = 0, max = 10, message = "{verifications.param.accountId.length.invalid}") Long[] accountId,
@Size(min = 0, max = 2, message = "{verifications.param.verificationstatus.length.invalid}") VerifiedAccountsVerificationStatus[] verificationStatus,//todo:: use @Min and @Max
@Size(min = 0, max = 2, message = "{verifications.param.isselected.length.invalid}") String[] isSelected)
throws ApiException {
LOGGER.info("Verification getVerifiedAccounts API execution started");
VerificationValidator.validateVerifiedAccounts(this, ApiUtils.getMethodName(), providerAccountId, accountId, verificationStatus, isSelected);
CallContext callContext = buildVerifiedAccountsContext(providerAccountId, accountId, verificationStatus, isSelected);
return callContext.getApiClient().execute(callContext.getCall(), VerifiedAccountResponse.class);
}
/**
* Verified Accounts
* The Verified Accounts API v1.1 provides information of bank and investment accounts that are verified by the user
* and applies only to Instant Account Verification (IAV) customers using FastLink 4.0.
* By default, the API only returns successfully verified accounts' information.
*
* @param providerAccountId providerAccountId (required)
* @param accountId accountId (optional)
* @param verificationStatus verificationStatus (optional)
* @param isSelected isSelected (optional)
* @param apiCallback {@link ApiResponse}<{@link VerifiedAccountResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void getVerifiedAccountsAsync(
@NotNull(message = "{providerAccounts.param.providerAccountId.required}")//
long providerAccountId,
Long[] accountId,//
VerifiedAccountsVerificationStatus[] verificationStatus,
String[] isSelected, ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification getVerifiedAccounts API execution started");
VerificationValidator.validateVerifiedAccounts(this, ApiUtils.getMethodName(), providerAccountId, accountId, verificationStatus, isSelected);
CallContext callContext = buildVerifiedAccountsContext(providerAccountId, accountId, verificationStatus, isSelected);
callContext.getApiClient().executeAsync(callContext.getCall(), VerifiedAccountResponse.class, apiCallback);
}
private CallContext buildVerifiedAccountsContext(long providerAccountId, Long[] accountId, VerifiedAccountsVerificationStatus[] verificationStatus,
String[] isSelected) throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.VERIFIED_ACCOUNTS, HttpMethod.GET, null);
apiContext.addQueryParam(new Pair(PARAM_PROVIDER_ACCOUNT_ID, String.valueOf(providerAccountId)));
if(null != accountId) {
apiContext.addQueryParam(new Pair(PARAM_ACCOUNT_ID, ApiUtils.convertArrayToString(accountId)));
}
if(null != verificationStatus) {
apiContext.addQueryParam(new Pair(PARAM_VERIFICATION_STATUS, ApiUtils.convertArrayToString(verificationStatus)));
}
if(null != isSelected) {
apiContext.addQueryParam(new Pair(PARAM_IS_SELECTED, ApiUtils.convertArrayToString(isSelected)));
}
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Get Holder Profile
* The Holder Profile API service allows retrieving the user's profile details
* (i.e., PII data such as name, email, phone number, and address) that are available
* at the provider account and each account level. The API accepts the providerAccountId and
* retrieves the profile information available under it and all the details available under each
* of the associated accounts. .
*
* @param providerAccountId providerAccountId (required)
* @param accountId accountId (optional)
* @return {@link ApiResponse}<{@link HolderProfileResponse}>
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public ApiResponse
getHolderProfileDetails(//
@NotNull(message = "{providerAccounts.param.providerAccountId.required}") long providerAccountId,
long accountId)
throws ApiException {
LOGGER.info("Verification getHolderProfileDetails API execution started");
VerificationValidator.validateHolderProfile(this, ApiUtils.getMethodName(), providerAccountId, accountId);
CallContext callContext = buildHolderProfileContext(providerAccountId, accountId);
return callContext.getApiClient().execute(callContext.getCall(), HolderProfileResponse.class);
}
/**
* Get Holder Profile
* The Holder Profile API service allows retrieving the user's profile details
* (i.e., PII data such as name, email, phone number, and address) that are available
* at the provider account and each account level. The API accepts the providerAccountId and
* retrieves the profile information available under it and all the details available under each
* of the associated accounts.
*
* @param providerAccountId providerAccountId (required)
* @param accountId accountId (optional)
* @param apiCallback {@link ApiResponse}<{@link HolderProfileResponse}> (required)
* @throws ApiException If the input validation fails or API call fails, e.g. server error or cannot deserialize the
* response body
*/
public void getHolderProfileDetailsAsync(
@NotNull(message = "{providerAccounts.param.providerAccountId.required}")//
long providerAccountId,
long accountId,//
ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification getHolderProfileDetails API execution started");
VerificationValidator.validateHolderProfile(this, ApiUtils.getMethodName(), providerAccountId, accountId);
CallContext callContext = buildHolderProfileContext(providerAccountId, accountId);
callContext.getApiClient().executeAsync(callContext.getCall(), HolderProfileResponse.class, apiCallback);
}
private CallContext buildHolderProfileContext(long providerAccountId, long accountId) throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.HOLDER_PROFILE, HttpMethod.GET, null);
apiContext.addQueryParam(new Pair(PARAM_PROVIDER_ACCOUNT_ID, String.valueOf(providerAccountId)));
if(0L != accountId) {
apiContext.addQueryParam(new Pair(PARAM_ACCOUNT_ID, String.valueOf(accountId)));
}
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
/**
* Get Classification Summary
* The get classification summary API service returns attributes that provide account-level and transaction-level summary for a user's account.
* As a prerequisite, the Account Verification customers should have Transactions enabled to fetch a response.
* The API can be invoked only for an account verified by the user following the get verified accounts API call.
* If the prerequisite is not satisfied, an appropriate error will be returned on invoking the API.
*
* @param accountId accountId (required)
* @return {@link ApiResponse}<{@link ClassificationSummaryResponse}>
* @throws ApiException If the input validation fails or API call fails
*/
public ApiResponse
getClassificationSummary(//
@NotNull(message = "{verifications.param.accountId.required}") long accountId)
throws ApiException {
LOGGER.info("Verification getClassificationSummary API execution started");
VerificationValidator.validateClassificationmSummary(this, ApiUtils.getMethodName(), accountId);
CallContext callContext = buildClassificationSummaryContext(accountId);
return callContext.getApiClient().execute(callContext.getCall(), ClassificationSummaryResponse.class);
}
/**
* Get Classification Summary
* The get classification summary API service returns attributes that provide account-level and transaction-level summary for a user's account.
* As a prerequisite, the Account Verification customers should have Transactions enabled to fetch a response.
* The API can be invoked only for an account verified by the user following the get verified accounts API call.
* If the prerequisite is not satisfied, an appropriate error will be returned on invoking the API.
*
* @param accountId accountId (required)
* @param apiCallback {@link ApiResponse}<{@link ClassificationSummaryResponse}> (required)
* @throws ApiException If the input validation fails or API call fails
*/
public void getClassificationSummaryAsync(
@NotNull(message = "{verifications.param.accountId.required}")//
long accountId,//
ApiCallback apiCallback) throws ApiException {
LOGGER.info("Verification getClassificationSummary API execution started");
VerificationValidator.validateClassificationmSummary(this, ApiUtils.getMethodName(), accountId);
CallContext callContext = buildClassificationSummaryContext(accountId);
callContext.getApiClient().executeAsync(callContext.getCall(), ClassificationSummaryResponse.class, apiCallback);
}
private CallContext buildClassificationSummaryContext(long accountId) throws ApiException {
ApiClient apiClient = getContext().getApiClient(getRequestHeaderMap());
ApiContext apiContext = new ApiContext(ApiEndpoint.CLASSIFICATION_SUMMARY, HttpMethod.GET, null);
apiContext.addQueryParam(new Pair(PARAM_ACCOUNT_ID, String.valueOf(accountId)));
registerResponseInterceptor(apiClient);
Call call = apiClient.buildCall(apiContext, requestListener());
return new CallContext(apiClient, call);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy