01: package epayment.framework;
02:
03: /**
04: * The <code>AbstractPaymentCommand</code> class provides
05: * the default behavior for the <code>IPaymentCommand</code>
06: * interface.
07: * <p>
08: * This class is strictly an example.
09: *
10: * @author <a href="mailto:mike@clarkware.com">Mike Clark</a>
11: * @author <a href="http://www.clarkware.com">Clarkware Consulting</a>
12: */
13:
14: public abstract class AbstractPaymentCommand implements IPaymentCommand {
15:
16: private IPaymentRequest _request;
17:
18: /**
19: * Constructs an <code>AbstractPaymentCommand</code>
20: * instance.
21: */
22: public AbstractPaymentCommand(IPaymentRequest request) {
23: _request = request;
24: }
25:
26: /**
27: * Executes this command using the specified payment
28: * adapter and returns a payment response.
29: *
30: * @param adapter Payment adapter.
31: * @return response Payment response.
32: * @throws PaymentException If an error occurs.
33: */
34: public abstract IPaymentResponse execute(IGatewayAdapter adapter)
35: throws PaymentException;
36:
37: /**
38: * Returns the payment request.
39: *
40: * @return Payment request.
41: */
42: protected IPaymentRequest getPaymentRequest() {
43: return _request;
44: }
45: }
|