Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Identifier of the order transaction.
 
 	private String id;

Identifier to the purchase unit associated with this object
 
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 collected.
 
 	private Amount amount;

specifies payment mode of the transaction
 
 	private String paymentMode;

State of the order transaction.
 
 	private String state;

Protection Eligibility of the Payer
 
Protection Eligibility Type of the Payer
 
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
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
com.paypal.base.rest.PayPalRESTException
 
 		return PayPalResource.initConfig(is);
 	}

Initialize using a File(Properties file)

Parameters:
file File object of a properties entity
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
com.paypal.base.rest.PayPalRESTException
	public static OAuthTokenCredential initConfig(File filethrows PayPalRESTException {
		return PayPalResource.initConfig(file);
	}

Initialize using Properties

Parameters:
properties Properties object
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
	public static OAuthTokenCredential initConfig(Properties properties) {
		return PayPalResource.initConfig(properties);
	}
Default Constructor
	public Order() {
	}

Parameterized Constructor
	public Order(String idAmount amountString state) {
		this. = id;
		this. = amount;
		this. = state;
	}


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

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


Setter for purchaseUnitReferenceId
	public Order setPurchaseUnitReferenceId(String purchaseUnitReferenceId) {
		this. = purchaseUnitReferenceId;
		return this;
	}

Getter for purchaseUnitReferenceId
	}


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

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


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

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


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

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


Setter for paymentMode
	public Order setPaymentMode(String paymentMode) {
		this. = paymentMode;
		return this;
	}

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


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

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


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

Getter for protectionEligibility
	}


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

Getter for protectionEligibilityType
	}


Obtain the Order resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
orderId String
Returns:
Order
Throws:
com.paypal.base.rest.PayPalRESTException
	public static Order get(String accessTokenString orderIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextorderId);
	}

Obtain the Order resource for the given identifier.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
orderId String
Returns:
Order
Throws:
com.paypal.base.rest.PayPalRESTException
	public static Order get(APIContext apiContextString orderIdthrows 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 (orderId == null) {
			throw new IllegalArgumentException("orderId cannot be null");
		}
		Object[] parameters = new Object[] {orderId};
		String pattern = "v1/payments/orders/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadOrder.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/orders/{0}/capture";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = capture.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCapture.class);
	}


Voids (cancels) an Order.

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

Voids (cancels) an Order.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Order
Throws:
com.paypal.base.rest.PayPalRESTException
	public Order 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/orders/{0}/do-void";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadOrder.class);
	}


Creates an authorization on an order

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

Creates an authorization on an order

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Authorization
Throws:
com.paypal.base.rest.PayPalRESTException
	public Authorization authorize(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/orders/{0}/authorization";
		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