com.mikeblanton.paypal.util
Class PayPalAPIUtil

java.lang.Object
  |
  +--com.mikeblanton.paypal.util.PayPalAPIUtil

public class PayPalAPIUtil
extends java.lang.Object

The PayPalAPIUtil class provides helper functions for PayPal API calls.

Version:
$Revision: 1.5 $
Author:
Michael Blanton

Constructor Summary
PayPalAPIUtil()
           
 
Method Summary
protected  int getApiTimeout()
          Retrieves the Timeout based on the given criteria in the given order: Configuration File Parameter api.timeout. System Property paypaltools.api.timeout.
protected  java.net.URL getApiUrl()
          Retrieves the Endpoint URL based on the given criteria in the given order: Configuration File Parameter api.url. System Property paypaltools.api.url.
 PayPalAPIInterface getPayPalInterface()
          Retrieves the PayPal API Interface class using the default endpoint URL and default timeout.
 PayPalAPIInterface getPayPalInterface(int _timeout)
          Retrieves the PayPal API Interface class using the default endpoint URL and specified timeout.
 PayPalAPIInterface getPayPalInterface(java.net.URL _url)
          Retrieves the PayPal API Interface class using the specified URL and the default timeout.
 PayPalAPIInterface getPayPalInterface(java.net.URL _url, int _timeout)
          Retrieves the PayPal API Interface class using the specified endpoint URL and the specified timeout.
 GetTransactionDetailsResponseType getTransactionDetails(GetTransactionDetailsRequestType _request)
          Performs a PayPal GetTransactionDetails API call using the passed GetTransactionDetailsRequestType instance.
 GetTransactionDetailsResponseType getTransactionDetails(java.lang.String _txnId)
          Performs a PayPal GetTransactionDetails API call using the passed Transaction ID.
 GetTransactionDetailsResponseType getTransactionDetails(TransactionId _txnId)
          Performs a PayPal GetTransactionDetails API call using the passed TransactionId instance.
 void processResponse(AbstractResponseType _response)
          Processes the AbstractResponseType instance, logging all errors and warnings as appropriate.
 RefundTransactionResponseType refundTransaction(RefundTransactionRequestType _request)
          Performs a PayPal Refund via API using the passed RefundTransactionRequest instance.
 RefundTransactionResponseType refundTransaction(java.lang.String _txnId, java.lang.String _amount, java.lang.String _currency, java.lang.String _memo, java.lang.String _type)
          Performs a PayPal Refund via API using the passed data.
 RefundTransactionResponseType refundTransaction(TransactionId _txnId, BasicAmountType _amount, java.lang.String _memo, RefundPurposeTypeCodeType _type)
          Performs a PayPal Refund via API using the passed data.
 TransactionSearchResponseType transactionSearch(BasicAmountType _amount, java.lang.String _auctionItemNumber, CurrencyCodeType _currencyCode, java.util.Calendar _endDate, java.lang.String _invoiceId, EmailAddressType _emailAddress, PersonNameType _payerName, java.lang.String _receiptId, EmailAddressType _receiver, java.util.Calendar _startDate, PaymentTransactionStatusCodeType _status, PaymentTransactionClassCodeType _transactionClass, TransactionId _txnId)
          Performs a PayPal TransactionSearch API call using the specified criteria.
 TransactionSearchResponseType transactionSearch(TransactionSearchRequestType _request)
          Performs a PayPal TransactionSearch API call using the criteria specified in the passed TransactionSearchRequestType instance.
 void validateRequest(AbstractRequestType _request)
          Validates the passed AbstractRequestType, ensuring it has the required fields set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PayPalAPIUtil

public PayPalAPIUtil()
Method Detail

getPayPalInterface

public PayPalAPIInterface getPayPalInterface()
                                      throws javax.xml.rpc.ServiceException
Retrieves the PayPal API Interface class using the default endpoint URL and default timeout.
Returns:
 
Throws:
javax.xml.rpc.ServiceException -  

getPayPalInterface

public PayPalAPIInterface getPayPalInterface(java.net.URL _url)
                                      throws javax.xml.rpc.ServiceException
Retrieves the PayPal API Interface class using the specified URL and the default timeout.
Parameters:
_url -  
Returns:
 
Throws:
javax.xml.rpc.ServiceException -  

getPayPalInterface

public PayPalAPIInterface getPayPalInterface(int _timeout)
                                      throws javax.xml.rpc.ServiceException
Retrieves the PayPal API Interface class using the default endpoint URL and specified timeout.
Parameters:
_timeout -  
Returns:
 
Throws:
javax.xml.rpc.ServiceException -  

getPayPalInterface

public PayPalAPIInterface getPayPalInterface(java.net.URL _url,
                                             int _timeout)
                                      throws javax.xml.rpc.ServiceException
Retrieves the PayPal API Interface class using the specified endpoint URL and the specified timeout. NOTE: API Interface Instances are cached to increase performance.
Parameters:
_url -  
_timeout -  
Returns:
 
Throws:
javax.xml.rpc.ServiceException -  

getApiUrl

protected java.net.URL getApiUrl()
Retrieves the Endpoint URL based on the given criteria in the given order:
Returns:
 

getApiTimeout

protected int getApiTimeout()
Retrieves the Timeout based on the given criteria in the given order:
Returns:
 

validateRequest

public void validateRequest(AbstractRequestType _request)
Validates the passed AbstractRequestType, ensuring it has the required fields set.
Parameters:
_request -  

processResponse

public void processResponse(AbstractResponseType _response)
Processes the AbstractResponseType instance, logging all errors and warnings as appropriate.
Parameters:
_response -  

refundTransaction

public RefundTransactionResponseType refundTransaction(RefundTransactionRequestType _request)
                                                throws java.rmi.RemoteException,
                                                       javax.xml.rpc.ServiceException
Performs a PayPal Refund via API using the passed RefundTransactionRequest instance.
Parameters:
_request -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  
See Also:
RefundTransactionResponseType, RefundTransactionRequestType

refundTransaction

public RefundTransactionResponseType refundTransaction(TransactionId _txnId,
                                                       BasicAmountType _amount,
                                                       java.lang.String _memo,
                                                       RefundPurposeTypeCodeType _type)
                                                throws java.rmi.RemoteException,
                                                       javax.xml.rpc.ServiceException
Performs a PayPal Refund via API using the passed data.
Parameters:
_txnId -  
_amount -  
_memo -  
_type -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

refundTransaction

public RefundTransactionResponseType refundTransaction(java.lang.String _txnId,
                                                       java.lang.String _amount,
                                                       java.lang.String _currency,
                                                       java.lang.String _memo,
                                                       java.lang.String _type)
                                                throws java.rmi.RemoteException,
                                                       javax.xml.rpc.ServiceException
Performs a PayPal Refund via API using the passed data.
Parameters:
_txnId -  
_amount -  
_currency -  
_memo -  
_type -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

getTransactionDetails

public GetTransactionDetailsResponseType getTransactionDetails(GetTransactionDetailsRequestType _request)
                                                        throws java.rmi.RemoteException,
                                                               javax.xml.rpc.ServiceException
Performs a PayPal GetTransactionDetails API call using the passed GetTransactionDetailsRequestType instance.
Parameters:
_request -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

getTransactionDetails

public GetTransactionDetailsResponseType getTransactionDetails(TransactionId _txnId)
                                                        throws java.rmi.RemoteException,
                                                               javax.xml.rpc.ServiceException
Performs a PayPal GetTransactionDetails API call using the passed TransactionId instance.
Parameters:
_txnId -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

getTransactionDetails

public GetTransactionDetailsResponseType getTransactionDetails(java.lang.String _txnId)
                                                        throws java.rmi.RemoteException,
                                                               javax.xml.rpc.ServiceException
Performs a PayPal GetTransactionDetails API call using the passed Transaction ID.
Parameters:
_txnId -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

transactionSearch

public TransactionSearchResponseType transactionSearch(TransactionSearchRequestType _request)
                                                throws java.rmi.RemoteException,
                                                       javax.xml.rpc.ServiceException
Performs a PayPal TransactionSearch API call using the criteria specified in the passed TransactionSearchRequestType instance.
Parameters:
_request -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -  

transactionSearch

public TransactionSearchResponseType transactionSearch(BasicAmountType _amount,
                                                       java.lang.String _auctionItemNumber,
                                                       CurrencyCodeType _currencyCode,
                                                       java.util.Calendar _endDate,
                                                       java.lang.String _invoiceId,
                                                       EmailAddressType _emailAddress,
                                                       PersonNameType _payerName,
                                                       java.lang.String _receiptId,
                                                       EmailAddressType _receiver,
                                                       java.util.Calendar _startDate,
                                                       PaymentTransactionStatusCodeType _status,
                                                       PaymentTransactionClassCodeType _transactionClass,
                                                       TransactionId _txnId)
                                                throws java.rmi.RemoteException,
                                                       javax.xml.rpc.ServiceException
Performs a PayPal TransactionSearch API call using the specified criteria. You should specify at least one parameter when performing your search.
Parameters:
_amount -  
_auctionItemNumber -  
_currencyCode -  
_endDate -  
_invoiceId -  
_emailAddress -  
_payerName -  
_receiptId -  
_receiver -  
_startDate -  
_status -  
_transactionClass -  
_txnId -  
Returns:
 
Throws:
java.rmi.RemoteException -  
javax.xml.rpc.ServiceException -