-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTransaction.java
155 lines (138 loc) · 3.98 KB
/
Transaction.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import java.io.Serializable;
/**
* This class creates a transaction object which is used whenever the customer transfer money/make a payment.
*/
public class Transaction implements Serializable
{
String sender;
String receiver;
String accountFrom;
double amount;
int id;
double senderRemaining;
double receiverRemaining;
/**
* Constructor for transactions. 3 types of transaction:
* Transaction types:
* 1- If sender = "Chequing" and receiver = "Savings", transfer funds between accounts locally, and vice versa between accounts
* 2- If sender = "Current" and receiver = Valid Email, etransfer funds
* 3- If sender = "Current" and receiver = 5-digit number, bank transfer to that account number
* @param sender the sender/sending account of the transaction
* @param receiver the receiving account/email/bank account number of the transaction
* @param amount the amount to be transferred
* @param id the id of the transaction
*/
public Transaction(String sender, String receiver, double amount, int id)
{
this.sender = sender;
this.receiver = receiver;
this.amount = amount;
this.id = id;
}
/**
* Gets the sender of the transaction
* @return the sender of the transaction
*/
public String getSender() {
return sender;
}
/**
* Sets the sender of the transaction
* @param sender the sender of the transaction
*/
public void setSender(String sender){
this.sender = sender;
}
/**
* Gets the receiver of the transaction
* @return the receiver of the transaction
*/
public String getReceiver() {
return receiver;
}
/**
* Sets the receiver of the transaction
* @param receiver the receiver of the transaction
*/
public void setReceiver(String receiver) {
this.receiver = receiver;
}
/**
* Gets the amount of the transaction
* @return the amount of the transaction
*/
public double getAmount() {
return amount;
}
/**
* Sets the amount of the transaction
* @param amount the amount of the transaction
*/
public void setAmount(double amount) {
this.amount = amount;
}
/**
* Gets the id of the transaction
* @return the id of the transaction
*/
public int getId() {
return id;
}
/**
* Sets the id of the transaction
* @param id the id of the transaction
*/
public void setId(int id) {
this.id=id;
}
/**
* Gets the account the transaction was sent from
* @return the account the transaction was sent from
*/
public String getAccountFrom()
{
return accountFrom;
}
/**
* Sets the account the transaction was sent from
* @param from the account that initiated the transaction
*/
public void setAccountFrom(String from)
{
this.accountFrom = from;
}
/**
* Gets the remaining amount the sender has in their account after the transaction
* @return the remaining amount
*/
public double getSenderRemaining()
{
return senderRemaining;
}
/**
* Sets the remaining amount the sender has in their account after the transaction
* @param remaining the amount remaining in the sender's account
*
*/
public void setSenderRemaining(double remaining)
{
this.senderRemaining = remaining;
}
/**
* Gets the remaining amount the receiver has in their account after the transaction
* @return the remaining amount
*
*/
public double getReceiverRemaining()
{
return receiverRemaining;
}
/**
* Sets the remaining amount the receiver has in their account after the transaction
* @param remaining the amount remaining in the receiver's account
*/
public void setReceiverRemaining(double remaining)
{
this.receiverRemaining = remaining;
}
}