KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > epayment > request > PaymentRequest


1 package epayment.request;
2
3 import epayment.framework.IPaymentRequest;
4
5 /**
6  * The <code>PaymentRequest</code> class is an
7  * <code>IPaymentRequest</code> that encapsulates
8  * the basic payment request information.
9  * <p>
10  * This class is strictly an example.
11  *
12  * @author <a HREF="mailto:mike@clarkware.com">Mike Clark</a>
13  * @author <a HREF="http://www.clarkware.com">Clarkware Consulting</a>
14  */

15
16 public class PaymentRequest implements IPaymentRequest {
17
18     private String JavaDoc _userId;
19     private String JavaDoc _userPassword;
20     private String JavaDoc _name;
21     private String JavaDoc _accountNumber;
22     private double _amount;
23     private String JavaDoc _comment;
24     
25     /**
26      * Constructs a <code>PaymentRequest</code>.
27      * with default values.
28      */

29     public PaymentRequest() {
30         _userId = "";
31         _userPassword = "";
32         _name = "";
33         _accountNumber = "";
34         _amount = 0.0;
35         _comment = "";
36     }
37     
38     /**
39      * Sets the user id.
40      *
41      * @param id User id.
42      */

43     public void setUserId(String JavaDoc id) {
44         _userId = id;
45     }
46     
47     /**
48      * Returns the user id.
49      *
50      * @return User id.
51      */

52     protected String JavaDoc getUserId() {
53         return _userId;
54     }
55     
56     /**
57      * Sets the user password.
58      *
59      * @param password User password.
60      */

61     public void setUserPassword(String JavaDoc password) {
62         _userPassword = password;
63     }
64     
65     /**
66      * Returns the user password.
67      *
68      * @return User password.
69      */

70     protected String JavaDoc getUserPassword() {
71         return _userPassword;
72     }
73     
74     /**
75      * Sets the name.
76      *
77      * @param name Name.
78      */

79     public void setAccountName(String JavaDoc name) {
80         _name = name;
81     }
82     
83     /**
84      * Returns the name.
85      *
86      * @return Name.
87      */

88     protected String JavaDoc getAccountName() {
89         return _name;
90     }
91     
92     /**
93      * Sets the account number.
94      *
95      * @param number Account number.
96      */

97     public void setAccountNumber(String JavaDoc number) {
98         _accountNumber = number;
99     }
100     
101     /**
102      * Returns the account number.
103      *
104      * @return Account number.
105      */

106     protected String JavaDoc 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 JavaDoc comment) {
134         _comment = comment;
135     }
136     
137     /**
138      * Returns the reporting comment.
139      *
140      * @return Reporting comment.
141      */

142     protected String JavaDoc getComment() {
143         return _comment;
144     }
145     
146     /**
147      * Returns the string representation of this object.
148      *
149      * @return String representation.
150      */

151     public String JavaDoc toString() {
152     
153         StringBuffer JavaDoc contents = new StringBuffer JavaDoc();
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 }
164
165
166
167
168  
169  
170
Popular Tags