-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransaction_task.py
More file actions
65 lines (46 loc) · 2.2 KB
/
Copy pathtransaction_task.py
File metadata and controls
65 lines (46 loc) · 2.2 KB
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
import datetime
class TransactionTask:
def __init__(self, sender_uid: int, recipient_uid: int,
amount: float, date: datetime.datetime) -> None:
self._sender_uid = sender_uid
self._recipient_uid = recipient_uid
if (amount <= 0):
print("Insufficient balance")
else:
self._amount = amount
self._date = date
self._sender_update_success = False
self._recipient_update_success = False
self._transaction_history_update_success = False
def __repr__(self) -> str:
return f"TransactionTask(sender_uid={self._sender_uid}, recipient_uid={self._recipient_uid}, amount={self._amount}, date={self._date})"
def get_sender_uid(self) -> int:
return self._sender_uid
def get_recipient_uid(self) -> int:
return self._recipient_uid
def get_amount(self) -> float:
return self._amount
def get_date(self) -> str:
return self._date
def get_sender_update_success(self) -> bool:
return self._sender_update_success
def get_recipient_update_success(self) -> bool:
return self._recipient_update_success
def get_transaction_history_update_success(self) -> bool:
return self._transaction_history_update_success
def set_sender_uid(self, sender_uid: int) -> None:
self._sender_uid = sender_uid
def set_recipient_uid(self, recipient_uid: int) -> None:
self._recipient_uid = recipient_uid
def set_amount(self, amount: float) -> None:
self._amount = amount
def set_date(self, date: str) -> None:
self._date = date
def set_sender_update_success(self, sender_update_success: bool) -> None:
self._sender_update_success = sender_update_success
def set_recipient_update_success(self, recipient_update_success: bool) -> None:
self._recipient_update_success = recipient_update_success
def set_transaction_history_update_success(self, transaction_history_update_success: bool) -> None:
self._transaction_history_update_success = transaction_history_update_success
def to_row(self):
return (self._sender_uid, self._recipient_uid, self._amount, self._date)