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 Sale  extends PayPalResource {

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 collected.
 
 	private Amount amount;

specifies payment mode of the transaction
 
 	private String paymentMode;

State of the sale transaction.
 
 	private String state;

Reason code for the transaction state being Pending or Reversed.
 
 	private String reasonCode;

Protection Eligibility of the Payer
 
Protection Eligibility Type of the Payer
 
Expected clearing time for eCheck Transactions
 
 	private String clearingTime;

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

 
 	private List<Linkslinks;

Default Constructor
 
 	public Sale() {
 	}

Parameterized Constructor
 
 	public Sale(Amount amountString stateString parentPayment) {
 		this. = amount;
 		this. = state;
 		this. = parentPayment;
 	}


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

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


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

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


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

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


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

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


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

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


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

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


Setter for reasonCode
	public Sale setReasonCode(String reasonCode) {
		this. = reasonCode;
		return this;
	}

Getter for reasonCode
	public String getReasonCode() {
		return this.;
	}


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

Getter for protectionEligibility
	}


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

Getter for protectionEligibilityType
	}


Setter for clearingTime
	public Sale setClearingTime(String clearingTime) {
		this. = clearingTime;
		return this;
	}

Getter for clearingTime
	public String getClearingTime() {
		return this.;
	}


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

Getter for parentPayment
		return this.;
	}


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

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


Obtain the Sale transaction resource for the given identifier.

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

Obtain the Sale transaction resource for the given identifier.

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


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

Parameters:
accessToken Access Token used for the API call.
refund Refund
Returns:
Refund
Throws:
com.paypal.base.rest.PayPalRESTException
	public Refund refund(String accessTokenRefund refundthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return refund(apiContextrefund);
	}

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

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
refund Refund
Returns:
Refund
Throws:
com.paypal.base.rest.PayPalRESTException
	public Refund refund(APIContext apiContextRefund refundthrows 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 (refund == null) {
			throw new IllegalArgumentException("refund cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/sale/{0}/refund";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = refund.toJSON();
		return configureAndExecute(apiContext.resourcePathpayLoadRefund.class);
	}
New to GrepCode? Check out our FAQ X