Posted By:
neal_ravindran
Posted On:
Monday, May 3, 2004 07:57 AM
I have many payment transactions to make with many payment processors. I have a struts page for each payment transaction (sale has its saleProcess struts page, credit has its creditProcess struts page). In each of the payment transaction struts pages, I need to make a call to submit the transaction to a particular payment processor. Each payment processor has its own way of processing the transaction...and the way of processing a transaction can change now and then and then would need to modify the code (manually and redeploy). Currently I use an ejb with a function (I named submitTransactionToProcessor()) that has many ifs in it..and this ejb is called from each payment transaction struts page. The ej
More>>
I have
many
payment transactions to make with
many
payment processors. I have a struts page for each payment transaction (sale has its saleProcess struts page, credit has its creditProcess struts page).
In each of the payment transaction struts pages, I need to make a call to submit the transaction to a particular payment processor. Each payment processor has its own way of processing the transaction...and the way of processing a transaction can change now and then and then would need to modify the code (manually and redeploy).
Currently I use an ejb with a function (I named submitTransactionToProcessor()) that has many ifs in it..and this ejb is called from each payment transaction struts page. The ejb submitTransactionToProcessor() function, goes like this:-
//Transaction X
if(transaction=X)
{
if(processor=A)
{
//code for processor A
}
if(processor=B)
{
//code for processor B
}
}
//Transaction Y
if(transaction=Y)
{
if(processor=A)
{
//code for processor A
}
if(processor=B)
{
//code for processor B
}
}
Question:
If there is a better pattern to my ejb-pattern solution, kindly let me know.
<<Less