Can we have a class which will provide utility methods which can be used
when implementing a payment gateway, I guess this will help in code
redundancy, to make code more readable and maybe more.

Currently the thing that we can put in PaymentUtil, can be methods to create
payment gateway responses, as below,

toAuthorisationMap((Boolean authResult, String authCode, String authFlag,
BigDecimal processAmount, String authRefNum, String authAltRefNum, String
authMessage)

toCaptureMap(Boolean captureResult, String captureCode, String captureFlag,
BigDecimal captureAmount, String captureRefNum, String captureAltRefNum,
String captureMessage)

..... same for other responses

This method will create the map from parameters and return the map back,
this will help in reducing the code (map creation code)  as we will be
implementing more & more payment gateways, right now we have 9 implemented,
so instead of creating the map manually we can have this utility method.

And as the payment gateway response fields are not dynamic, I mean they are
restricted to only the fields defined in processAuthResult service, I guess
this will help.

I have already implemented this class for use in implementing payment
gateway that I am using.

Please let me know your thoughts.

Reply via email to