001: package epayment.request;
002:
003: import epayment.framework.IPaymentRequest;
004:
005: /**
006: * The <code>PaymentRequest</code> class is an
007: * <code>IPaymentRequest</code> that encapsulates
008: * the basic payment request information.
009: * <p>
010: * This class is strictly an example.
011: *
012: * @author <a href="mailto:mike@clarkware.com">Mike Clark</a>
013: * @author <a href="http://www.clarkware.com">Clarkware Consulting</a>
014: */
015:
016: public class PaymentRequest implements IPaymentRequest {
017:
018: private String _userId;
019: private String _userPassword;
020: private String _name;
021: private String _accountNumber;
022: private double _amount;
023: private String _comment;
024:
025: /**
026: * Constructs a <code>PaymentRequest</code>.
027: * with default values.
028: */
029: public PaymentRequest() {
030: _userId = "";
031: _userPassword = "";
032: _name = "";
033: _accountNumber = "";
034: _amount = 0.0;
035: _comment = "";
036: }
037:
038: /**
039: * Sets the user id.
040: *
041: * @param id User id.
042: */
043: public void setUserId(String id) {
044: _userId = id;
045: }
046:
047: /**
048: * Returns the user id.
049: *
050: * @return User id.
051: */
052: protected String getUserId() {
053: return _userId;
054: }
055:
056: /**
057: * Sets the user password.
058: *
059: * @param password User password.
060: */
061: public void setUserPassword(String password) {
062: _userPassword = password;
063: }
064:
065: /**
066: * Returns the user password.
067: *
068: * @return User password.
069: */
070: protected String getUserPassword() {
071: return _userPassword;
072: }
073:
074: /**
075: * Sets the name.
076: *
077: * @param name Name.
078: */
079: public void setAccountName(String name) {
080: _name = name;
081: }
082:
083: /**
084: * Returns the name.
085: *
086: * @return Name.
087: */
088: protected String getAccountName() {
089: return _name;
090: }
091:
092: /**
093: * Sets the account number.
094: *
095: * @param number Account number.
096: */
097: public void setAccountNumber(String number) {
098: _accountNumber = number;
099: }
100:
101: /**
102: * Returns the account number.
103: *
104: * @return Account number.
105: */
106: protected String getAccountNumber() {
107: return _accountNumber;
108: }
109:
110: /**
111: * Sets the amount of the transaction.
112: *
113: * @param amount Amount in dollars.
114: */
115: public void setAmount(double amount) {
116: _amount = amount;
117: }
118:
119: /**
120: * Returns the amount of the transaction.
121: *
122: * @return Amount in dollars.
123: */
124: protected double getAmount() {
125: return _amount;
126: }
127:
128: /**
129: * Sets the reporting comment.
130: *
131: * @param comment Reporting comment.
132: */
133: public void setComment(String comment) {
134: _comment = comment;
135: }
136:
137: /**
138: * Returns the reporting comment.
139: *
140: * @return Reporting comment.
141: */
142: protected String getComment() {
143: return _comment;
144: }
145:
146: /**
147: * Returns the string representation of this object.
148: *
149: * @return String representation.
150: */
151: public String toString() {
152:
153: StringBuffer contents = new StringBuffer();
154:
155: contents.append("User ID = " + _userId + "\n");
156: contents.append("User Password = " + _userPassword + "\n");
157: contents.append("Name = " + _name + "\n");
158: contents.append("Account Number = " + _accountNumber + "\n");
159: contents.append("Amount = " + _amount + "\n");
160:
161: return contents.toString();
162: }
163: }
|