01: package epayment.framework;
02:
03: /**
04: * The <code>IGatewayAdapter</code> interface defines
05: * the common interface for all electronic payment
06: * gateways.
07: * <p>
08: * Implementors of this interface serve as interface
09: * adapters to vendor-specific payment gateways.
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 interface IGatewayAdapter {
18:
19: /**
20: * Sets the payment gateway host.
21: *
22: * @param host Gateway host.
23: */
24: public void setHost(String host);
25:
26: /**
27: * Performs an authorizes for the specified payment request
28: * information and returns a payment response.
29: *
30: * @param request Payment request.
31: * @return Payment response.
32: * @throws PaymentException If an error occurs.
33: */
34: public IPaymentResponse authorize(IPaymentRequest request)
35: throws PaymentException;
36:
37: /**
38: * Performs a capture for the specified payment request
39: * information and returns a payment response.
40: *
41: * @param request Payment request.
42: * @return Payment response.
43: * @throws PaymentException If an error occurs.
44: */
45: public IPaymentResponse capture(IPaymentRequest request)
46: throws PaymentException;
47:
48: /**
49: * Performs a sale (authorize and capture) for the specified
50: * payment request information and returns a payment response.
51: *
52: * @param request Payment request.
53: * @return Payment response.
54: * @throws PaymentException If an error occurs.
55: */
56: public IPaymentResponse sale(IPaymentRequest request)
57: throws PaymentException;
58:
59: /**
60: * Performs a credit for the specified payment request
61: * information and returns a payment response.
62: *
63: * @param request Payment request.
64: * @return Payment response.
65: * @throws PaymentException If an error occurs.
66: */
67: public IPaymentResponse credit(IPaymentRequest request)
68: throws PaymentException;
69:
70: /**
71: * Performs a void for the specified payment request
72: * information and returns a payment response.
73: *
74: * @param request Payment request.
75: * @return Payment response.
76: * @throws PaymentException If an error occurs.
77: */
78: public IPaymentResponse voidSale(IPaymentRequest request)
79: throws PaymentException;
80: }
|