Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import java.util.HashMap;
  import java.util.List;
  
 
 public class Authorization  extends PayPalResource {

Identifier of the authorization transaction.
 
 	private String id;

Time the resource was created in UTC ISO8601 format.
 
 	private String createTime;

Time the resource was last updated in UTC ISO8601 format.
 
 	private String updateTime;

Amount being authorized for.
 
 	private Amount amount;

specifies payment mode of the transaction
 
 	private String paymentMode;

State of the authorization transaction.
 
 	private String state;

Protection Eligibility of the Payer
 
Protection Eligibility Type of the Payer
 
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;

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 paymentMode
	public Authorization setPaymentMode(String paymentMode) {
		this. = paymentMode;
		return this;
	}

Getter for paymentMode
	public String getPaymentMode() {
		return this.;
	}


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

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


Setter for protectionEligibility
	public Authorization setProtectionEligibility(String protectionEligibility) {
		this. = protectionEligibility;
		return this;
	}

Getter for protectionEligibility
	}


Setter for protectionEligibilityType
	public Authorization setProtectionEligibilityType(String protectionEligibilityType) {
		this. = protectionEligibilityType;
		return this;
	}

Getter for protectionEligibilityType
	}


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.base.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.base.rest.APIContext used for the API call.
authorizationId String
Returns:
Authorization
Throws:
com.paypal.base.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 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.base.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.base.rest.APIContext used for the API call.
capture Capture
Returns:
Capture
Throws:
com.paypal.base.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 configureAndExecute(apiContext.resourcePathpayLoadCapture.class);
	}


Voids (cancels) an Authorization.

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

Voids (cancels) an Authorization.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Authorization
Throws:
com.paypal.base.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 configureAndExecute(apiContext.resourcePathpayLoadAuthorization.class);
	}


Reauthorizes an expired Authorization.

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

Reauthorizes an expired Authorization.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Authorization
Throws:
com.paypal.base.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 configureAndExecute(apiContext.resourcePathpayLoadAuthorization.class);
	}
New to GrepCode? Check out our FAQ X