Implementing the silent post servlet for the payment gateway
A typical payment gateway uses a postback action to process the response for a payment that you take from an electronic payment instrument. This postback action is an HTTP POST command that sends the result of the payment request to the application that calls the payment gateway, which is PolicyCenter. The payment gateway calls the servlet and typically displays a page that shows the result of the request. PolicyCenter uses a servlet that has no user interaction to process the postback. Using a servlet ensures that processing of the electronic payment does not get lost if the user closes the browser and that payment occurs only once. The servlet/servlets.xml file identifies the servlet class.
PolicyCenter provides a demonstration implementation of the payment gateway silent post servlet in the gw.payment.paymentgateway.PaymentGatewaySilentPostServlet class. This servlet calls the PaymentGatewayPlugin plugin method mapSilentPostRequestToPaymentGatewayResponse to create a gw.payment.paymentgateway.PaymentGatewayResponse object from the HttpServletRequest object from the payment gateway. The servlet then uses the PolicyCenter response processor to create an UpFrontPayment entity instance that stores information about the payment. The response processor updates the set of up-front payments on the job.
Create your own servlet or change the implementation of the doPost method in the demonstration servlet to process the HttpServletRequest from your payment gateway. If you create your own servlet, include its definition in the servlets.xml file. Configure your payment gateway to use the URL to this servlet to perform the postback.
