All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yodlee.sdk.api.validators.ProvidersValidator Maven / Gradle / Ivy

There is a newer version: 1.0.29.beta1
Show newest version
/**
 * 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.validators;

import java.util.List;
import com.yodlee.api.model.validator.Problem;
import com.yodlee.sdk.api.ProvidersApi;
import com.yodlee.sdk.api.exception.ApiException;
import com.yodlee.sdk.api.util.ApiUtils;

public class ProvidersValidator {

	private ProvidersValidator() {}

	public enum ProvidersPriorityType {
		SUGGESTED("suggested"),//
		POPULAR("popular"), //
		COBRAND("cobrand");

		private String type;

		private ProvidersPriorityType(String type) {
			this.type = type;
		}

		public String getType() {
			return type;
		}
	}

	public enum ProvidersCapability {
		CHALLENGE_DEPOSIT_VERIFICATION
	}

	public static void validateGetProviders(ProvidersApi providersApi, String method, ProvidersCapability capability,
			String datasetFilter, String name, ProvidersPriorityType priority, Integer skip, Integer top,
			String fullAccountNumberFields) throws ApiException {
		Class[] argTypes = new Class[] {ProvidersCapability.class, String.class, String.class,
				ProvidersPriorityType.class, Integer.class, Integer.class, String.class};
		Object[] argValues =
				new Object[] {capability, datasetFilter, name, priority, skip, top, fullAccountNumberFields};
		List methodProblems = ApiValidator.validate(providersApi, method, argTypes, argValues);
		List contextProblems = ApiValidator.validateCobrandContext(providersApi);
		methodProblems.addAll(ApiUtils.isConflictingParams(name, top, "providers.param.name.top.invalid"));
		methodProblems.addAll(ApiUtils.isConflictingParams(name, skip, "providers.param.name.skip.invalid"));
		ApiValidator.collectProblems(methodProblems, contextProblems);
	}

	public static void validateGetProviderDetails(ProvidersApi providersApi, String method, Long providerId)
			throws ApiException {
		Class[] argTypes = new Class[] {Long.class};
		Object[] argValues = new Object[] {providerId};
		List methodProblems = ApiValidator.validate(providersApi, method, argTypes, argValues);
		List contextProblems = ApiValidator.validateCobrandContext(providersApi);
		ApiValidator.collectProblems(methodProblems, contextProblems);
	}

	public static void validateGetProvidersCount(ProvidersApi providersApi, String method,
			ProvidersCapability capability, String datasetFilter, String name, ProvidersPriorityType priority,
			String fullAccountNumberFields) throws ApiException {
		Class[] argTypes = new Class[] {ProvidersCapability.class, String.class, String.class,
				ProvidersPriorityType.class, String.class};
		Object[] argValues = new Object[] {capability, datasetFilter, name, priority, fullAccountNumberFields};
		List methodProblems = ApiValidator.validate(providersApi, method, argTypes, argValues);
		List contextProblems = ApiValidator.validateCobrandContext(providersApi);
		ApiValidator.collectProblems(methodProblems, contextProblems);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy