-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transaction.java
68 lines (56 loc) · 1.42 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
import java.sql.Timestamp;
public class Transaction{
private String uTxnID;
private String senderID;
private String receiverID;
private float amount;
private Timestamp txnTime;
private boolean isValid = true;
//Default constructor
Transaction(String uTxnID, String senderID, String receiverID, float amount, Timestamp txnTime){
this.uTxnID = uTxnID;
this.senderID = senderID;
this.receiverID = receiverID;
this.amount = amount;
this.txnTime = txnTime;
}
Transaction(String uTxnID, String creatorID, Timestamp txnTime){
this.uTxnID = uTxnID;
this.senderID = "Created";
this.receiverID = creatorID;
this.amount = 50;
this.txnTime = txnTime;
}
//function to return unique transaction id
public String getTxnID(){
return uTxnID;
}
//to return transaction amount
public float getAmount(){
return amount;
}
//to return senderID
public String getSenderID(){
return senderID;
}
//to return recieverID
public String getReceiverID(){
return receiverID;
}
//to return time of transaction
public Timestamp getTxnTime(){
return txnTime;
}
//setting the transaction to false
public void setFalse(){
this.isValid = false;
}
//to return transaction status
public boolean getTxnStatus(){
return isValid;
}
//to update the amount of transaction
public void updateAmount(float newAmount){
this.amount = newAmount;
}
}