KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > epayment > commands > SaleCommand


1 package epayment.commands;
2
3 import epayment.framework.*;
4
5 /**
6  * The <code>SaleCommand</code> class is an
7  * <code>AbstractPaymentCommand</code> for authorizing
8  * and capturing a purchase in an
9  * atomic operation.
10  * <p>
11  * This class is strictly an example.
12  *
13  * @author <a HREF="mailto:mike@clarkware.com">Mike Clark</a>
14  * @author <a HREF="http://www.clarkware.com">Clarkware Consulting</a>
15  */

16
17 public class SaleCommand extends AbstractPaymentCommand {
18
19     /**
20      * Constructs an <code>SaleCommand</code> with
21      * the specified payment request.
22      *
23      * @param request Payment request.
24      */

25     public SaleCommand(IPaymentRequest request) {
26         super(request);
27     }
28     
29     /**
30      * Executes this command using the specified payment
31      * adapter and returns a payment response.
32      *
33      * @param adapter Payment adapter.
34      * @return response Payment response.
35      * @throws PaymentException If an error occurs.
36      */

37     public IPaymentResponse execute(IGatewayAdapter adapter)
38         throws PaymentException {
39         
40         return adapter.sale(getPaymentRequest());
41     }
42 }
43
Popular Tags