Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import  com.paypal.core.rest.JSONFormatter;
  import java.util.List;
  import  com.paypal.core.rest.PayPalRESTException;
  import  com.paypal.core.rest.PayPalResource;
  import  com.paypal.core.rest.OAuthTokenCredential;
 import  com.paypal.core.rest.HttpMethod;
 import  com.paypal.core.rest.RESTUtil;
 import  com.paypal.core.rest.QueryParameters;
 import  com.paypal.core.rest.APIContext;
 import  com.paypal.core.Constants;
 import  com.paypal.core.SDKVersion;
 import java.io.File;
 import java.util.Map;
 
 public class Refund  {

Identifier of the refund transaction in UTC ISO8601 format.
 
 	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;

Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund.
 
 	private Amount amount;

State of the refund transaction.
 
 	private String state;

ID of the Sale transaction being refunded.
 
 	private String saleId;

ID of the Capture transaction being refunded.
 
 	private String captureId;

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

Description of what is being refunded for.
 
 	private String description;

 
 	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
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
PayPalRESTException
	public static OAuthTokenCredential initConfig(InputStream isthrows 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:
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 Refund() {
	}


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

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


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

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


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

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


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

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


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

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


Setter for saleId
	public Refund setSaleId(String saleId) {
		this. = saleId;
		return this;
	}

Getter for saleId
	public String getSaleId() {
		return this.;
	}


Setter for captureId
	public Refund setCaptureId(String captureId) {
		this. = captureId;
		return this;
	}

Getter for captureId
	public String getCaptureId() {
		return this.;
	}


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

Getter for parentPayment
		return this.;
	}


Setter for description
	public Refund setDescription(String description) {
		this. = description;
		return this;
	}

Getter for description
	public String getDescription() {
		return this.;
	}


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

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


Obtain the Refund transaction resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
refundId String
Returns:
Refund
Throws:
PayPalRESTException
	public static Refund get(String accessTokenString refundIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextrefundId);
	}

Obtain the Refund transaction resource for the given identifier.

Parameters:
apiContext APIContext used for the API call.
refundId String
Returns:
Refund
Throws:
PayPalRESTException
	public static Refund get(APIContext apiContextString refundIdthrows 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.getHTTPHeaders().put(Constants.HTTP_CONTENT_TYPE_HEADER, Constants.HTTP_CONTENT_TYPE_JSON);
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (refundId == null) {
			throw new IllegalArgumentException("refundId cannot be null");
		}
		Object[] parameters = new Object[] {refundId};
		String pattern = "v1/payments/refund/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.GET, resourcePathpayLoadRefund.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