@ RequestMapping ( value = "/checkout/complete" , method = RequestMethod . POST ) public String completeCheckout ( ) throws PaymentException { paymentService . updatePayPalPaymentForFulfillment ( ) ; String paymentId = paymentService . getPayPalPaymentIdFromCurrentOrder ( ) ; String payerId = paymentService . getPayPalPayerIdFromCurrentOrder ( ) ; if ( StringUtils . isBlank ( paymentId ) ) { throw new PaymentException ( "Unable to complete checkout because no PayPal payment id was found on the current order" ) ; } if ( StringUtils . isBlank ( payerId ) ) { throw new PaymentException ( "Unable to complete checkout because no PayPal payer id was found on the current order" ) ; } return "redirect:/paypal-checkout/return?" + MessageConstants . HTTP_PAYMENTID + "=" + paymentId + "&" + MessageConstants . HTTP_PAYERID + "=" + payerId ; }
Completes checkout for a PayPal payment . If there s already a PayPal payment we go ahead and make sure the details of the payment are updated to all of the forms filled out by the customer since they could ve updated shipping information added a promotion or other various things to the order .