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

com.paypal.base.APICallPreHandler Maven / Gradle / Ivy

There is a newer version: 1.14.0
Show newest version
package com.paypal.base;

import com.paypal.base.exception.ClientActionRequiredException;
import com.paypal.base.exception.OAuthException;
import com.paypal.base.rest.OAuthTokenCredential;

import java.util.Map;

/**
 * APICallPreHandler defines a high level abstraction for call
 * specific operations. PayPal REST API is provided by {@link com.paypal.base.rest.RESTAPICallPreHandler}
 */
public interface APICallPreHandler {

	/**
	 * Returns headers for HTTP call
	 * 
	 * @return Map of headers with name and value
	 * @throws OAuthException
	 */
	Map getHeaderMap() throws OAuthException;

	/**
	 * Returns the payload for the API call. The implementation should take care
	 * in formatting the payload appropriately
	 * 
	 * @return Payload as String
	 */
	String getPayLoad();

	/**
	 * Returns the endpoint for the API call. The implementation may calculate
	 * the endpoint depending on parameters set on it. If no endpoint is found
	 * in the passed configuration, then SANDBOX endpoints (hardcoded in
	 * {@link Constants})are taken to be default for the API call.
	 * 
	 * @return Endpoint String.
	 */
	String getEndPoint();

	/**
	 * Returns {@link OAuthTokenCredential} configured for the api call
	 * 
	 * @return ICredential object
	 */
	OAuthTokenCredential getCredential();

	/**
	 * Validates settings and integrity before call
	 * 
	 * @throws ClientActionRequiredException
	 */
	void validate() throws ClientActionRequiredException;
	

	
	/**
	 * Return configurationMap
	 * 
	 * @return configurationMap in this call pre-handler
	 */
	public Map getConfigurationMap();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy