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.HttpMethod;
  import  com.paypal.core.rest.RESTUtil;
  import  com.paypal.core.rest.APIContext;
 import  com.paypal.core.Constants;
 import java.io.File;
 
 public class Event  {

Identifier of the Webhooks event resource.
 
 	private String id;

Time the resource was created.
 
 	private String createTime;

Name of the resource contained in resource element.
 
 	private String resourceType;

Name of the event type that occurred on resource, identified by data_resource element, to trigger the Webhooks event.
 
 	private String eventType;

A summary description of the event. E.g. A successful payment authorization was created for $$
 
 	private String summary;

This contains the resource that is identified by resource_type element.
 
 	private Object resource;

Hateoas links.
 
 	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 void initConfig(InputStream isthrows PayPalRESTException {
 		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 void initConfig(File filethrows PayPalRESTException {
 		PayPalResource.initConfig(file);
 	}

Initialize using Properties

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


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

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


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

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


Setter for resourceType
	public Event setResourceType(String resourceType) {
		this. = resourceType;
		return this;
	}

Getter for resourceType
	public String getResourceType() {
		return this.;
	}


Setter for eventType
	public Event setEventType(String eventType) {
		this. = eventType;
		return this;
	}

Getter for eventType
	public String getEventType() {
		return this.;
	}


Setter for summary
	public Event setSummary(String summary) {
		this. = summary;
		return this;
	}

Getter for summary
	public String getSummary() {
		return this.;
	}


Setter for resource
	public Event setResource(Object resource) {
		this. = resource;
		return this;
	}

Getter for resource
	public Object getResource() {
		return this.;
	}


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

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


Retrieves the Webhooks event resource identified by event_id. Can be used to retrieve the payload for an event.

Parameters:
accessToken Access Token used for the API call.
eventId String
Returns:
Event
Throws:
PayPalRESTException
	public static Event get(String accessTokenString eventIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContexteventId);
	}

Retrieves the Webhooks event resource identified by event_id. Can be used to retrieve the payload for an event.

Parameters:
apiContext APIContext used for the API call.
eventId String
Returns:
Event
Throws:
PayPalRESTException
	public static Event get(APIContext apiContextString eventIdthrows 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 (eventId == null) {
			throw new IllegalArgumentException("eventId cannot be null");
		}
		Object[] parameters = new Object[] {eventId};
		String pattern = "v1/notifications/webhooks-events/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.GET, resourcePathpayLoadEvent.class);
	}


Resends the Webhooks event resource identified by event_id.

Parameters:
accessToken Access Token used for the API call.
Returns:
Event
Throws:
PayPalRESTException
	public Event resend(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return resend(apiContext);
	}

Resends the Webhooks event resource identified by event_id.

Parameters:
apiContext APIContext used for the API call.
Returns:
Event
Throws:
PayPalRESTException
	public Event resend(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.getHTTPHeaders().put(Constants.HTTP_CONTENT_TYPE_HEADER, Constants.HTTP_CONTENT_TYPE_JSON);
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/notifications/webhooks-events/{0}/resend";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.POST, resourcePathpayLoadEvent.class);
	}


Retrieves the list of Webhooks events resources for the application associated with token. The developers can use it to see list of past webhooks events.

Parameters:
accessToken Access Token used for the API call.
Returns:
EventList
Throws:
PayPalRESTException
	public static EventList list(String accessTokenString queryParamsthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return list(apiContextqueryParams);
	}

Retrieves the list of Webhooks events resources for the application associated with token. The developers can use it to see list of past webhooks events.

Parameters:
apiContext APIContext used for the API call.
Returns:
EventList
Throws:
PayPalRESTException
	public static EventList list(APIContext apiContextString queryParamsthrows 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());
		String resourcePath = "v1/notifications/webhooks-events" + queryParams;
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext, HttpMethod.GET, resourcePathpayLoadEventList.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