Implementing a payment gateway response processor class

PolicyCenter uses a Gosu object to process the result of a request to the payment gateway. The up-front payment state container, the silent post servlet, and the payment gateway forward page in the demonstration implementation of a payment gateway create these objects. The response processor saves transaction information as a PaymentGatewayTransaction entity instance before PolicyCenter requests a payment from the payment gateway. On processing a response for a successful payment request, the response processor creates an UpFrontPayment entity instance and removes this PaymentGatewayTransaction entity instance.

The gw.payment.paymentgateway.PaymentGatewayResponseProcessor class is a demonstration implementation of a payment gateway response processor. The constructor takes a payment response object and optionally, a payment information object as arguments. This class provides the following methods:

  • processPaymentResponse – Used by the up-front payment state container to process the response from a payment or credit request
  • processPaymentResponseAndRedirect – Used by the payment gateway forward page to send control to the applicable user interface
  • processPostBackPaymentResponse – Used by the silent post servlet to add a successful payment to the job
  • processSynchronizedPaymentResponse – Used by the up-front payment state container to synchronize payments that the payment gateway has processed, but which do not appear on the Payment screen

Your implementation of a response processor also sends information about the payment to the billing system as a suspense payment. For example, if the billing system is BillingCenter, the response processor calls the PaymentAPI method that creates a suspense payment. The demonstration implementation of the response processor does not send this payment information to the billing system.