Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import java.util.List;
 import java.io.File;
 
 public class Authorization  {

Identifier of the authorization transaction.
 
 	private String id;

Time the resource was created.
 
 	private String createTime;

Time the resource was last updated.
 
 	private String updateTime;

Amount being authorized for.
 
 	private Amount amount;

State of the authorization transaction.
 
 	private String state;

ID of the Payment resource that this transaction is based on.
 
 	private String parentPayment;

Date/Time until which funds may be captured against this resource.
 
 	private String validUntil;

 
 	private List<Linkslinks;

Returns the last request sent to the Service

Returns:
Last request sent to the server
 
 	public static String getLastRequest() {
 		return PayPalResource.getLastRequest();
 	}

Returns the last response returned by the Service

Returns:
Last response got from the Service
 
 	public static String getLastResponse() {
 		return PayPalResource.getLastResponse();
 	}

Initialize using InputStream(of a Properties file)

Parameters:
is InputStream
Throws:
com.paypal.core.rest.PayPalRESTException
 
 	public static void initConfig(InputStream isthrows PayPalRESTException {
 		PayPalResource.initConfig(is);
 	}

Initialize using a File(Properties file)

Parameters:
file File object of a properties entity
Throws:
com.paypal.core.rest.PayPalRESTException
 
 	public static void initConfig(File filethrows PayPalRESTException {
		PayPalResource.initConfig(file);
	}

Initialize using Properties

Parameters:
properties Properties object
	public static void initConfig(Properties properties) {
		PayPalResource.initConfig(properties);
	}
Default Constructor
	public Authorization() {
	}


Setter for id
	public Authorization setId(String id) {
		this. = id;
		return this;
	}

Getter for id
	public String getId() {
		return this.;
	}


Setter for createTime
	public Authorization setCreateTime(String createTime) {
		this. = createTime;
		return this;
	}

Getter for createTime
	public String getCreateTime() {
		return this.;
	}


Setter for updateTime
	public Authorization setUpdateTime(String updateTime) {
		this. = updateTime;
		return this;
	}

Getter for updateTime
	public String getUpdateTime() {
		return this.;
	}


Setter for amount
	public Authorization setAmount(Amount amount) {
		this. = amount;
		return this;
	}

Getter for amount
	public Amount getAmount() {
		return this.;
	}


Setter for state
	public Authorization setState(String state) {
		this. = state;
		return this;
	}

Getter for state
	public String getState() {
		return this.;
	}


Setter for parentPayment
	public Authorization setParentPayment(String parentPayment) {
		this. = parentPayment;
		return this;
	}

Getter for parentPayment
		return this.;
	}


Setter for validUntil
	public Authorization setValidUntil(String validUntil) {
		this. = validUntil;
		return this;
	}

Getter for validUntil
	public String getValidUntil() {
		return this.;
	}


Setter for links
	public Authorization setLinks(List<Linkslinks) {
		this. = links;
		return this;
	}

Getter for links
	public List<LinksgetLinks() {
		return this.;
	}


Obtain the Authorization transaction resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
authorizationId String
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public static Authorization get(String accessTokenString authorizationIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextauthorizationId);
	}

Obtain the Authorization transaction resource for the given identifier.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
authorizationId String
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public static Authorization get(APIContext apiContextString authorizationIdthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (authorizationId == null) {
			throw new IllegalArgumentException("authorizationId cannot be null");
		}
		Object[] parameters = new Object[] {authorizationId};
		String pattern = "v1/payments/authorization/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadAuthorization.class);
	}


Creates (and processes) a new Capture Transaction added as a related resource.

Parameters:
accessToken Access Token used for the API call.
capture Capture
Returns:
Capture
Throws:
com.paypal.core.rest.PayPalRESTException
	public Capture capture(String accessTokenCapture capturethrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return capture(apiContextcapture);
	}

Creates (and processes) a new Capture Transaction added as a related resource.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
capture Capture
Returns:
Capture
Throws:
com.paypal.core.rest.PayPalRESTException
	public Capture capture(APIContext apiContextCapture capturethrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
		if (capture == null) {
			throw new IllegalArgumentException("capture cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/authorization/{0}/capture";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = capture.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCapture.class);
	}


Voids (cancels) an Authorization.

Parameters:
accessToken Access Token used for the API call.
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public Authorization doVoid(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return doVoid(apiContext);
	}

Voids (cancels) an Authorization.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public Authorization doVoid(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/authorization/{0}/void";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadAuthorization.class);
	}


Reauthorizes an expired Authorization.

Parameters:
accessToken Access Token used for the API call.
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public Authorization reauthorize(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return reauthorize(apiContext);
	}

Reauthorizes an expired Authorization.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
Returns:
Authorization
Throws:
com.paypal.core.rest.PayPalRESTException
	public Authorization reauthorize(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/authorization/{0}/reauthorize";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = this.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadAuthorization.class);
	}

Returns a JSON string corresponding to object state

Returns:
JSON representation
	public String toJSON() {
		return JSONFormatter.toJSON(this);
	}
	public String toString() {
		return toJSON();
	}
New to GrepCode? Check out our FAQ X