Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Identifier of the billing plan. 128 characters max.
 
 	private String id;

Name of the billing plan. 128 characters max.
 
 	private String name;

Description of the billing plan. 128 characters max.
 
 	private String description;

Type of the billing plan. Allowed values: `FIXED`, `INFINITE`.
 
 	private String type;

Status of the billing plan. Allowed values: `CREATED`, `ACTIVE`, `INACTIVE`, and `DELETED`.
 
 	private String state;

Time when the billing plan was created. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
 
 	private String createTime;

Time when this billing plan was updated. Format YYYY-MM-DDTimeTimezone, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
 
 	private String updateTime;

Array of payment definitions for this billing plan.
 
Array of terms for this billing plan.
 
 	private List<Termsterms;

Specific preferences such as: set up fee, max fail attempts, autobill amount, and others that are configured for this billing plan.
 
 
 	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:
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 Plan() {
	}

Parameterized Constructor
	public Plan(String nameString descriptionString type) {
		this. = name;
		this. = description;
		this. = type;
	}


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

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


Setter for name
	public Plan setName(String name) {
		this. = name;
		return this;
	}

Getter for name
	public String getName() {
		return this.;
	}


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

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


Setter for type
	public Plan setType(String type) {
		this. = type;
		return this;
	}

Getter for type
	public String getType() {
		return this.;
	}


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

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


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

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


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

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


Setter for paymentDefinitions
	public Plan setPaymentDefinitions(List<PaymentDefinitionpaymentDefinitions) {
		this. = paymentDefinitions;
		return this;
	}

Getter for paymentDefinitions
		return this.;
	}


Setter for terms
	public Plan setTerms(List<Termsterms) {
		this. = terms;
		return this;
	}

Getter for terms
	public List<TermsgetTerms() {
		return this.;
	}


Setter for merchantPreferences
	public Plan setMerchantPreferences(MerchantPreferences merchantPreferences) {
		this. = merchantPreferences;
		return this;
	}

Getter for merchantPreferences
		return this.;
	}


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

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


Retrieve the details for a particular billing plan by passing the billing plan ID to the request URI.

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

Retrieve the details for a particular billing plan by passing the billing plan ID to the request URI.

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


Create a new billing plan by passing the details for the plan, including the plan name, description, and type, to the request URI.

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

Create a new billing plan by passing the details for the plan, including the plan name, description, and type, to the request URI.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Plan
Throws:
com.paypal.base.rest.PayPalRESTException
	public Plan create(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());
		String resourcePath = "v1/payments/billing-plans";
		String payLoad = this.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadPlan.class);
	}


Replace specific fields within a billing plan by passing the ID of the billing plan to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, field to update, and new value for each update.

Parameters:
accessToken Access Token used for the API call.
patchRequest PatchRequest
Returns:
Throws:
com.paypal.base.rest.PayPalRESTException
	public void update(String accessTokenList<PatchpatchRequestthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		update(apiContextpatchRequest);
		return;
	}

Replace specific fields within a billing plan by passing the ID of the billing plan to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, field to update, and new value for each update.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
patchRequest PatchRequest
Returns:
Throws:
com.paypal.base.rest.PayPalRESTException
	public void update(APIContext apiContextList<PatchpatchRequestthrows 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 (patchRequest == null) {
			throw new IllegalArgumentException("patchRequest cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/billing-plans/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = new GsonBuilder().create().toJson(patchRequest);
		PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadnull);
		return;
	}


List billing plans according to optional query string parameters specified.

Parameters:
accessToken Access Token used for the API call.
containerMap Map<String, String>
Returns:
PlanList
Throws:
com.paypal.base.rest.PayPalRESTException
	public static PlanList list(String accessTokenMap<StringStringcontainerMapthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return list(apiContextcontainerMap);
	}

List billing plans according to optional query string parameters specified.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
containerMap Map<String, String>
Returns:
PlanList
Throws:
com.paypal.base.rest.PayPalRESTException
	public static PlanList list(APIContext apiContextMap<StringStringcontainerMapthrows 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 (containerMap == null) {
			throw new IllegalArgumentException("containerMap cannot be null");
		}
		Object[] parameters = new Object[] {containerMap};
		String pattern = "v1/payments/billing-plans?page_size={0}&status={1}&page={2}&total_required={3}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadPlanList.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