org.broadleafcommerce.vendor.paypal.service.payment
Class PayPalCheckoutServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.vendor.paypal.service.payment.PayPalCheckoutServiceImpl
All Implemented Interfaces:
PayPalCheckoutService

public class PayPalCheckoutServiceImpl
extends Object
implements PayPalCheckoutService

User: elbertbautista Date: 6/13/12 This class provides an abstraction layer on top of the CompositePaymentService and the PayPalPaymentModule, allowing developers to easily call the most frequently-used methods. For custom implementation, this class should be extended or custom calls to the CompositePaymentService should be utilized.


Field Summary
protected  org.broadleafcommerce.core.checkout.service.CheckoutService checkoutService
           
protected  org.broadleafcommerce.core.payment.service.CompositePaymentService compositePaymentService
           
protected  org.broadleafcommerce.profile.core.service.CustomerService customerService
           
protected  PayPalPaymentModule payPalPaymentModule
           
 
Constructor Summary
PayPalCheckoutServiceImpl()
           
 
Method Summary
 org.broadleafcommerce.core.checkout.service.workflow.CheckoutResponse completeExpressCheckout(String token, String payerId, org.broadleafcommerce.core.order.domain.Order order)
          Completes an Express Checkout transaction by invoking the DoExpressCheckout API.
 PayPalDetailsResponse getExpressCheckoutDetails(String token)
          Obtains information about an Express Checkout transaction by invoking the GetExpressCheckoutDetails API.
 org.broadleafcommerce.core.payment.service.workflow.CompositePaymentResponse initiateExpressCheckout(org.broadleafcommerce.core.order.domain.Order order)
          Initiates an Express Checkout transaction by invoking the SetExpressCheckout API.
 org.broadleafcommerce.core.payment.service.workflow.CompositePaymentResponse refundTransaction(String transactionId, org.broadleafcommerce.core.order.domain.Order order)
          Refunds the PayPal account holder associated with a transaction by invoking the RefundTransaction API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checkoutService

protected org.broadleafcommerce.core.checkout.service.CheckoutService checkoutService

customerService

protected org.broadleafcommerce.profile.core.service.CustomerService customerService

compositePaymentService

protected org.broadleafcommerce.core.payment.service.CompositePaymentService compositePaymentService

payPalPaymentModule

protected PayPalPaymentModule payPalPaymentModule
Constructor Detail

PayPalCheckoutServiceImpl

public PayPalCheckoutServiceImpl()
Method Detail

initiateExpressCheckout

public org.broadleafcommerce.core.payment.service.workflow.CompositePaymentResponse initiateExpressCheckout(org.broadleafcommerce.core.order.domain.Order order)
                                                                                                     throws org.broadleafcommerce.core.payment.service.exception.PaymentException
Initiates an Express Checkout transaction by invoking the SetExpressCheckout API. This will verify the PayPal PaymentInfo on the order when sent to the gateway. see: https://www.x.com/developers/paypal/documentation-tools/api/setexpresscheckout-api-operation-nvp

Specified by:
initiateExpressCheckout in interface PayPalCheckoutService
Parameters:
order - - The order
Returns:
CompositePaymentResponse - the response from PayPal. In most cases you will need to check if the transaction was a success, and redirect the user to: responseItem.getAdditionalFields().get(MessageConstants.REDIRECTURL)
Throws:
org.broadleafcommerce.core.payment.service.exception.PaymentException

completeExpressCheckout

public org.broadleafcommerce.core.checkout.service.workflow.CheckoutResponse completeExpressCheckout(String token,
                                                                                                     String payerId,
                                                                                                     org.broadleafcommerce.core.order.domain.Order order)
                                                                                              throws org.broadleafcommerce.core.checkout.service.exception.CheckoutException
Completes an Express Checkout transaction by invoking the DoExpressCheckout API. If you set up a billing agreement in your SetExpressCheckout API call, the billing agreement is created when you call the DoExpressCheckout API operation. This call executes a complete checkout by calling checkoutService.performCheckout(). Make sure the payments and fulfillment groups are fully set up before invoking. see: https://www.x.com/developers/paypal/documentation-tools/api/doexpresscheckoutpayment-api-operation-nvp Note: this method must be passed in an order already initialized for checkout i.e. the order status set to SUBMITTED, the order number set, and the date submitted set.

Specified by:
completeExpressCheckout in interface PayPalCheckoutService
Parameters:
order - - The order
token - - A PayPal parameter sent back after invoking SetExpressCheckout
payerId - - A PayPal parameter sent back after invoking SetExpressCheckout
Returns:
CheckoutResponse - the response from PayPal.
Throws:
org.broadleafcommerce.core.checkout.service.exception.CheckoutException

getExpressCheckoutDetails

public PayPalDetailsResponse getExpressCheckoutDetails(String token)
                                                throws org.broadleafcommerce.core.payment.service.exception.PaymentException
Obtains information about an Express Checkout transaction by invoking the GetExpressCheckoutDetails API. This call is useful when wanting to obtain information from the PayPal transaction, such as the Shipping Address. see: https://www.x.com/developers/paypal/documentation-tools/api/getexpresscheckoutdetails-api-operation-nvp

Specified by:
getExpressCheckoutDetails in interface PayPalCheckoutService
Parameters:
token - - A PayPal parameter sent back after invoking SetExpressCheckout
Returns:
PayPalDetailsResponse - the response from PayPal.
Throws:
org.broadleafcommerce.core.payment.service.exception.PaymentException

refundTransaction

public org.broadleafcommerce.core.payment.service.workflow.CompositePaymentResponse refundTransaction(String transactionId,
                                                                                                      org.broadleafcommerce.core.order.domain.Order order)
                                                                                               throws org.broadleafcommerce.core.payment.service.exception.PaymentException
Refunds the PayPal account holder associated with a transaction by invoking the RefundTransaction API. see: https://www.x.com/developers/paypal/documentation-tools/api/refundtransaction-api-operation-nvp

Specified by:
refundTransaction in interface PayPalCheckoutService
Parameters:
order - - the Order
transactionId - - A PayPal parameter sent back after invoking SetExpressCheckout
Returns:
CompositePaymentResponse - the response from PayPal.
Throws:
org.broadleafcommerce.core.payment.service.exception.PaymentException


Copyright © 2012. All Rights Reserved.