com.paypal.api.payments
Class Agreement

java.lang.Object
  extended by com.paypal.api.payments.Agreement

public class Agreement
extends Object


Constructor Summary
Agreement()
          Default Constructor
Agreement(String name, String description, String startDate, Payer payer, Plan plan)
          Parameterized Constructor
 
Method Summary
 void billBalance(APIContext apiContext, AgreementStateDescriptor agreementStateDescriptor)
          Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI.
 void billBalance(String accessToken, AgreementStateDescriptor agreementStateDescriptor)
          Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI.
 void cancel(APIContext apiContext, AgreementStateDescriptor agreementStateDescriptor)
          Cancel a billing agreement by passing the ID of the agreement to the request URI.
 void cancel(String accessToken, AgreementStateDescriptor agreementStateDescriptor)
          Cancel a billing agreement by passing the ID of the agreement to the request URI.
 Agreement create(APIContext apiContext)
          Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON.
 Agreement create(String accessToken)
          Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON.
 Agreement execute(APIContext apiContext)
          Execute a billing agreement after buyer approval by passing the payment token to the request URI.
 Agreement execute(String accessToken)
          Execute a billing agreement after buyer approval by passing the payment token to the request URI.
static Agreement get(APIContext apiContext, String agreementId)
          Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI.
static Agreement get(String accessToken, String agreementId)
          Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI.
 AgreementDetails getAgreementDetails()
          Getter for agreementDetails
 String getCreateTime()
          Getter for createTime
 String getDescription()
          Getter for description
 String getId()
          Getter for id
static String getLastRequest()
          Returns the last request sent to the Service
static String getLastResponse()
          Returns the last response returned by the Service
 List<Links> getLinks()
          Getter for links
 String getName()
          Getter for name
 List<OverrideChargeModel> getOverrideChargeModels()
          Getter for overrideChargeModels
 MerchantPreferences getOverrideMerchantPreferences()
          Getter for overrideMerchantPreferences
 Payer getPayer()
          Getter for payer
 Plan getPlan()
          Getter for plan
 Address getShippingAddress()
          Getter for shippingAddress
 String getStartDate()
          Getter for startDate
 String getState()
          Getter for state
 String getToken()
          Getter for token
 String getUpdateTime()
          Getter for updateTime
static OAuthTokenCredential initConfig(File file)
          Initialize using a File(Properties file)
static OAuthTokenCredential initConfig(InputStream is)
          Initialize using InputStream(of a Properties file)
static OAuthTokenCredential initConfig(Properties properties)
          Initialize using Properties
 void reActivate(APIContext apiContext, AgreementStateDescriptor agreementStateDescriptor)
          Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI.
 void reActivate(String accessToken, AgreementStateDescriptor agreementStateDescriptor)
          Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI.
 Agreement setAgreementDetails(AgreementDetails agreementDetails)
          Setter for agreementDetails
 void setBalance(APIContext apiContext, Currency currency)
          Set the balance for an agreement by passing the ID of the agreement to the request URI.
 void setBalance(String accessToken, Currency currency)
          Set the balance for an agreement by passing the ID of the agreement to the request URI.
 Agreement setCreateTime(String createTime)
          Setter for createTime
 Agreement setDescription(String description)
          Setter for description
 Agreement setId(String id)
          Setter for id
 Agreement setLinks(List<Links> links)
          Setter for links
 Agreement setName(String name)
          Setter for name
 Agreement setOverrideChargeModels(List<OverrideChargeModel> overrideChargeModels)
          Setter for overrideChargeModels
 Agreement setOverrideMerchantPreferences(MerchantPreferences overrideMerchantPreferences)
          Setter for overrideMerchantPreferences
 Agreement setPayer(Payer payer)
          Setter for payer
 Agreement setPlan(Plan plan)
          Setter for plan
 Agreement setShippingAddress(Address shippingAddress)
          Setter for shippingAddress
 Agreement setStartDate(String startDate)
          Setter for startDate
 Agreement setState(String state)
          Setter for state
 Agreement setToken(String token)
          Setter for token
 Agreement setUpdateTime(String updateTime)
          Setter for updateTime
 void suspend(APIContext apiContext, AgreementStateDescriptor agreementStateDescriptor)
          Suspend a particular billing agreement by passing the ID of the agreement to the request URI.
 void suspend(String accessToken, AgreementStateDescriptor agreementStateDescriptor)
          Suspend a particular billing agreement by passing the ID of the agreement to the request URI.
 String toJSON()
          Returns a JSON string corresponding to object state
 String toString()
           
static AgreementTransactions transactions(APIContext apiContext, String agreementId, Date startDate, Date endDate)
          List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI.
static AgreementTransactions transactions(String accessToken, String agreementId, Date startDate, Date endDate)
          List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI.
 Agreement update(APIContext apiContext, List<Patch> patchRequest)
          Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI.
 Agreement update(String accessToken, List<Patch> patchRequest)
          Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Agreement

public Agreement()
Default Constructor


Agreement

public Agreement(String name,
                 String description,
                 String startDate,
                 Payer payer,
                 Plan plan)
Parameterized Constructor

Method Detail

getLastRequest

public static String getLastRequest()
Returns the last request sent to the Service

Returns:
Last request sent to the server

getLastResponse

public static String getLastResponse()
Returns the last response returned by the Service

Returns:
Last response got from the Service

initConfig

public static OAuthTokenCredential initConfig(InputStream is)
                                       throws PayPalRESTException
Initialize using InputStream(of a Properties file)

Parameters:
is - InputStream
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.
Throws:
PayPalRESTException

initConfig

public static OAuthTokenCredential initConfig(File file)
                                       throws PayPalRESTException
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

initConfig

public static OAuthTokenCredential initConfig(Properties properties)
Initialize using Properties

Parameters:
properties - Properties object
Returns:
OAuthTokenCredential instance using client ID and client secret loaded from configuration.

setId

public Agreement setId(String id)
Setter for id


getId

public String getId()
Getter for id


setState

public Agreement setState(String state)
Setter for state


getState

public String getState()
Getter for state


setName

public Agreement setName(String name)
Setter for name


getName

public String getName()
Getter for name


setDescription

public Agreement setDescription(String description)
Setter for description


getDescription

public String getDescription()
Getter for description


setStartDate

public Agreement setStartDate(String startDate)
Setter for startDate


getStartDate

public String getStartDate()
Getter for startDate


setAgreementDetails

public Agreement setAgreementDetails(AgreementDetails agreementDetails)
Setter for agreementDetails


getAgreementDetails

public AgreementDetails getAgreementDetails()
Getter for agreementDetails


setPayer

public Agreement setPayer(Payer payer)
Setter for payer


getPayer

public Payer getPayer()
Getter for payer


setShippingAddress

public Agreement setShippingAddress(Address shippingAddress)
Setter for shippingAddress


getShippingAddress

public Address getShippingAddress()
Getter for shippingAddress


setOverrideMerchantPreferences

public Agreement setOverrideMerchantPreferences(MerchantPreferences overrideMerchantPreferences)
Setter for overrideMerchantPreferences


getOverrideMerchantPreferences

public MerchantPreferences getOverrideMerchantPreferences()
Getter for overrideMerchantPreferences


setOverrideChargeModels

public Agreement setOverrideChargeModels(List<OverrideChargeModel> overrideChargeModels)
Setter for overrideChargeModels


getOverrideChargeModels

public List<OverrideChargeModel> getOverrideChargeModels()
Getter for overrideChargeModels


setPlan

public Agreement setPlan(Plan plan)
Setter for plan


getPlan

public Plan getPlan()
Getter for plan


setCreateTime

public Agreement setCreateTime(String createTime)
Setter for createTime


getCreateTime

public String getCreateTime()
Getter for createTime


setUpdateTime

public Agreement setUpdateTime(String updateTime)
Setter for updateTime


getUpdateTime

public String getUpdateTime()
Getter for updateTime


setToken

public Agreement setToken(String token)
Setter for token


getToken

public String getToken()
Getter for token


setLinks

public Agreement setLinks(List<Links> links)
Setter for links


getLinks

public List<Links> getLinks()
Getter for links


create

public Agreement create(String accessToken)
                 throws PayPalRESTException,
                        MalformedURLException,
                        UnsupportedEncodingException
Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON.

Parameters:
accessToken - Access Token used for the API call.
Returns:
Agreement
Throws:
PayPalRESTException
UnsupportedEncodingException
MalformedURLException

create

public Agreement create(APIContext apiContext)
                 throws PayPalRESTException,
                        MalformedURLException,
                        UnsupportedEncodingException
Create a new billing agreement by passing the details for the agreement, including the name, description, start date, payer, and billing plan in the request JSON.

Parameters:
apiContext - APIContext used for the API call.
Returns:
Agreement
Throws:
PayPalRESTException
MalformedURLException
UnsupportedEncodingException

execute

public Agreement execute(String accessToken)
                  throws PayPalRESTException
Execute a billing agreement after buyer approval by passing the payment token to the request URI.

Parameters:
accessToken - Access Token used for the API call.
Returns:
Agreement
Throws:
PayPalRESTException

execute

public Agreement execute(APIContext apiContext)
                  throws PayPalRESTException
Execute a billing agreement after buyer approval by passing the payment token to the request URI.

Parameters:
apiContext - APIContext used for the API call.
Returns:
Agreement
Throws:
PayPalRESTException

get

public static Agreement get(String accessToken,
                            String agreementId)
                     throws PayPalRESTException
Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI.

Parameters:
accessToken - Access Token used for the API call.
agreementId - String
Returns:
Agreement
Throws:
PayPalRESTException

get

public static Agreement get(APIContext apiContext,
                            String agreementId)
                     throws PayPalRESTException
Retrieve details for a particular billing agreement by passing the ID of the agreement to the request URI.

Parameters:
apiContext - APIContext used for the API call.
agreementId - String
Returns:
Agreement
Throws:
PayPalRESTException

update

public Agreement update(String accessToken,
                        List<Patch> patchRequest)
                 throws PayPalRESTException
Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI.

Parameters:
accessToken - Access Token used for the API call.
patchRequest - PatchRequest
Returns:
Agreement
Throws:
PayPalRESTException

update

public Agreement update(APIContext apiContext,
                        List<Patch> patchRequest)
                 throws PayPalRESTException
Update details of a billing agreement, such as the description, shipping address, and start date, by passing the ID of the agreement to the request URI.

Parameters:
apiContext - APIContext used for the API call.
patchRequest - PatchRequest (list of patches)
Returns:
Agreement
Throws:
PayPalRESTException

suspend

public void suspend(String accessToken,
                    AgreementStateDescriptor agreementStateDescriptor)
             throws PayPalRESTException
Suspend a particular billing agreement by passing the ID of the agreement to the request URI.

Parameters:
accessToken - Access Token used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

suspend

public void suspend(APIContext apiContext,
                    AgreementStateDescriptor agreementStateDescriptor)
             throws PayPalRESTException
Suspend a particular billing agreement by passing the ID of the agreement to the request URI.

Parameters:
apiContext - APIContext used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

reActivate

public void reActivate(String accessToken,
                       AgreementStateDescriptor agreementStateDescriptor)
                throws PayPalRESTException
Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
accessToken - Access Token used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

reActivate

public void reActivate(APIContext apiContext,
                       AgreementStateDescriptor agreementStateDescriptor)
                throws PayPalRESTException
Reactivate a suspended billing agreement by passing the ID of the agreement to the appropriate URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
apiContext - APIContext used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

cancel

public void cancel(String accessToken,
                   AgreementStateDescriptor agreementStateDescriptor)
            throws PayPalRESTException
Cancel a billing agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
accessToken - Access Token used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

cancel

public void cancel(APIContext apiContext,
                   AgreementStateDescriptor agreementStateDescriptor)
            throws PayPalRESTException
Cancel a billing agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
apiContext - APIContext used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

billBalance

public void billBalance(String accessToken,
                        AgreementStateDescriptor agreementStateDescriptor)
                 throws PayPalRESTException
Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
accessToken - Access Token used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

billBalance

public void billBalance(APIContext apiContext,
                        AgreementStateDescriptor agreementStateDescriptor)
                 throws PayPalRESTException
Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.

Parameters:
apiContext - APIContext used for the API call.
agreementStateDescriptor - AgreementStateDescriptor
Throws:
PayPalRESTException

setBalance

public void setBalance(String accessToken,
                       Currency currency)
                throws PayPalRESTException
Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a common_currency object in the request JSON that specifies the currency type and value of the balance.

Parameters:
accessToken - Access Token used for the API call.
currency - Currency
Throws:
PayPalRESTException

setBalance

public void setBalance(APIContext apiContext,
                       Currency currency)
                throws PayPalRESTException
Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a common_currency object in the request JSON that specifies the currency type and value of the balance.

Parameters:
apiContext - APIContext used for the API call.
currency - Currency
Throws:
PayPalRESTException

transactions

public static AgreementTransactions transactions(String accessToken,
                                                 String agreementId,
                                                 Date startDate,
                                                 Date endDate)
                                          throws PayPalRESTException
List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI.

Parameters:
accessToken - Access Token used for the API call.
agreementId - String
Returns:
AgreementTransactions
Throws:
PayPalRESTException

transactions

public static AgreementTransactions transactions(APIContext apiContext,
                                                 String agreementId,
                                                 Date startDate,
                                                 Date endDate)
                                          throws PayPalRESTException
List transactions for a billing agreement by passing the ID of the agreement, as well as the start and end dates of the range of transactions to list, to the request URI.

Parameters:
apiContext - APIContext used for the API call.
agreementId - String
Returns:
AgreementTransactions
Throws:
PayPalRESTException

toJSON

public String toJSON()
Returns a JSON string corresponding to object state

Returns:
JSON representation

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All Rights Reserved.