try{
Context ctx = getInitialContext();
CustomerHome ch = (CustomerHome)getInitialContext().lookup("CustomerHome");
CustomerPK pk = new CustomerPK();
pk.id = 1;
Customer customer = ch.findByPrimaryKey(pk);
ProcessPaymentHome home = (ProcessPaymentHome)ctx.lookup("ProcessPaymentHome");
ProcessPayment p = home.create( );
boolean b;
java.util.GregorianCalendar calendar = new java.util.GregorianCalendar();
calendar.add(java.util.GregorianCalendar.DAY_OF_YEAR,1);
CreditCard card = new CreditCard(4029302, calendar.getTime(), CreditCard.VISA);
try{
b = p.byCredit(customer,card, 7400.00);
System.out.println(b);
}catch(PaymentException pe){
pe.printStackTrace();
}
b = p.byCash(customer,774.00);
System.out.println(b);
Check check = new Check("8374938-48384",100);
b = p.byCheck(customer, check, 8438.09);
System.out.println(b);
}catch(Exception e){e.printStackTrace();}