-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransactions.py
More file actions
27 lines (23 loc) · 1.05 KB
/
Transactions.py
File metadata and controls
27 lines (23 loc) · 1.05 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
class Transaction:
def __init__(self):
self.transactions = []
def add_transaction(self, manufacturer, distributor, client, amount=None):
transaction_data = {
"manufacturer": manufacturer,
"distributor": distributor,
"client": client,
"amount": amount,
"timestamp_get_from_manufacturer": None,
"timestamp_dispatched": None,
"timestamp_received": None,
}
self.transactions.append(transaction_data)
def set_timestamp_get_from_manufacturer(self, index, timestamp):
if 0 <= index < len(self.transactions):
self.transactions[index]["timestamp_get_from_manufacturer"] = timestamp
def set_timestamp_dispatched(self, index, timestamp):
if 0 <= index < len(self.transactions):
self.transactions[index]["timestamp_dispatched"] = timestamp
def set_timestamp_received(self, index, timestamp):
if 0 <= index < len(self.transactions):
self.transactions[index]["timestamp_received"] = timestamp