com.bea.alcs.sfweb.controller.impl
Class GoogleCallbackControllerImpl

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.AbstractController
                  extended by org.springframework.web.servlet.mvc.BaseCommandController
                      extended by com.bea.alcs.sfweb.controller.impl.AbstractEpControllerImpl
                          extended by com.bea.alcs.sfweb.controller.impl.GoogleCallbackControllerImpl
All Implemented Interfaces:
EpController, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller

public class GoogleCallbackControllerImpl
extends AbstractEpControllerImpl

The Spring MVC controller for the google callbacks.


Field Summary
 
Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController
DEFAULT_COMMAND_NAME
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
protected GoogleCallbackControllerImpl()
          Constructor.
 
Method Summary
 java.lang.String handleEvent(com.google.checkout.event.MerchantCalculationCallbackEvent event)
          Implement this method to handle <merchant-calculation-callback> requests.
 void handleEvent(com.google.checkout.event.NewOrderNotificationEvent event)
          Implement this method to handle new order notifications To retrieve the JAXB objects that were unmarshalled from the new order notification, you can use the following code: NewOrderNotification notification = event.getNewOrderNote(); You can then access individual components of the new order notification by calling the methods in the generated JAXB classes.
 org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          To handle request sent from Google.
 javax.xml.bind.JAXBElement parseToJAXB(org.xml.sax.InputSource inputSource)
          The parseToJAXB method receives a Merchant Calculations API or Notification API request (in XML format) from Google Checkout and converts that request to JAXB objects.
 void setGoogleCallbackService(GoogleCallbackService googleCallbackService)
          Sets the google callback service.
 void setGoogleCheckoutService(GoogleCheckoutService googleCheckoutService)
          Sets the google checkout service.
 
Methods inherited from class com.bea.alcs.sfweb.controller.impl.AbstractEpControllerImpl
getElasticPath, getRequestHelper, setElasticPath, setRequestHelper
 
Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommand, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, suppressBinding, suppressValidation, suppressValidation, suppressValidation, useDirectFieldAccess
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.web.servlet.mvc.Controller
handleRequest
 

Constructor Detail

GoogleCallbackControllerImpl

protected GoogleCallbackControllerImpl()
Constructor.

Method Detail

handleRequestInternal

public org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
                                                                          javax.servlet.http.HttpServletResponse response)
                                                                   throws java.io.IOException
To handle request sent from Google. The available types of callback from Google are: - ChargeAmountNotification - ChargebackAmountNotification - NewOrderNotification - OrderStateChangeNotification - RefundAmountNotification - RiskInformationNotification - MerchantCalculationCallback

Specified by:
handleRequestInternal in class org.springframework.web.servlet.mvc.AbstractController
Parameters:
request - the request
response - the response
Returns:
null since this is to handle callback from Google it's always returning a null
Throws:
java.io.IOException - exception
See Also:
HttpServlet.doPost(HttpServletRequest request, HttpServletResponse response)

handleEvent

public void handleEvent(com.google.checkout.event.NewOrderNotificationEvent event)
Implement this method to handle new order notifications To retrieve the JAXB objects that were unmarshalled from the new order notification, you can use the following code: NewOrderNotification notification = event.getNewOrderNote(); You can then access individual components of the new order notification by calling the methods in the generated JAXB classes. For example:
ShoppingCart shoppingCart = notification.getShoppingCart();
String googleOrderNumber = notification.getGoogleOrderNumber();

Parameters:
event - the callback event from Google

handleEvent

public java.lang.String handleEvent(com.google.checkout.event.MerchantCalculationCallbackEvent event)
Implement this method to handle <merchant-calculation-callback> requests. To retrieve the JAXB objects that were unmarshalled from the merchant calculation callback request, you can use the following code: MerchantCalculationCallback merchantCalculationCallback = event.getMerchantCalculationNote(); You can then access individual components of the notification by calling the methods in the generated JAXB classes. For example:
ShoppingCart shoppingCart = merchantCalculationCallback.getShoppingCart();
String googleOrderNumber = merchantCalculationCallback.getGoogleOrderNumber();

When you receive a <merchant-calculation-callback> request, you should respond with a <merchant-calculation-results> response. Please see MerchantCalculationResultBuilder for methods used to construct a <merchant-calculation-results> response.

Parameters:
event - the callback event from Google
Returns:
clearXml the xml response to Google

parseToJAXB

public final javax.xml.bind.JAXBElement parseToJAXB(org.xml.sax.InputSource inputSource)
                                             throws com.google.checkout.protocol.ProtocolException
The parseToJAXB method receives a Merchant Calculations API or Notification API request (in XML format) from Google Checkout and converts that request to JAXB objects.

Parameters:
inputSource - The XML source data to be converted to JAXB objects
Returns:
a JAXBElement
Throws:
com.google.checkout.protocol.ProtocolException - A ProtocolException if the input source does not comply with the Google Checkout schema

setGoogleCheckoutService

public void setGoogleCheckoutService(GoogleCheckoutService googleCheckoutService)
Sets the google checkout service.

Parameters:
googleCheckoutService - the google checkout service

setGoogleCallbackService

public void setGoogleCallbackService(GoogleCallbackService googleCallbackService)
Sets the google callback service.

Parameters:
googleCallbackService - the google callback service