I obtained the following code from PayPal's git hub. I am making recurring payments and would like to receive notification on the system when canceling. This could block the provision of my services if the user cancels. I have the servlet code, but I do not know how to get it to respond on my system in JSF. I already mapped in web.xml.
package br.com.spacnet.util;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.paypal.core.LoggingManager;
import com.paypal.ipn.IPNMessage;
import br.com.spacnet.util.Configuration;
public class IPNListenerServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
/*
* receiver for PayPal ipn call back.
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// For a full list of configuration parameters refer in wiki page.
// (https://github.com/paypal/sdk-core-java/wiki/SDK-Configuration-Parameters)
Map<String,String> configurationMap = Configuration.getConfig();
IPNMessage ipnlistener = new IPNMessage(request,configurationMap);
boolean isIpnVerified = ipnlistener.validate();
String transactionType = ipnlistener.getTransactionType();
Map<String,String> map = ipnlistener.getIpnMap();
LoggingManager.info(IPNListenerServlet.class, "******* IPN (name:value) pair : "+ map + " " +
"######### TransactionType : "+transactionType+" ======== IPN verified : "+ isIpnVerified);
}
}
My web.xml looks like this:
<servlet>
<description></description>
<display-name>IPNListenerServlet</display-name>
<servlet-name>IPNListenerServlet</servlet-name>
<servlet-class>com.sample.ipn.IPNListenerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>IPNListenerServlet</servlet-name>
<url-pattern>/IPNListener</url-pattern>
</servlet-mapping>