mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-01-15 04:14:22 +01:00
Add endpoint and logic so appointment can be queried to pisa. A better implementation based on persistent storage (i.e. DB) should replace it in the future
28 lines
1000 B
Python
28 lines
1000 B
Python
from pisa.encrypted_blob import EncryptedBlob
|
|
|
|
|
|
# Basic appointment structure
|
|
class Appointment:
|
|
def __init__(self, locator, start_time, end_time, dispute_delta, encrypted_blob, cipher, hash_function):
|
|
self.locator = locator
|
|
self.start_time = start_time
|
|
self.end_time = end_time
|
|
self.dispute_delta = dispute_delta
|
|
self.encrypted_blob = EncryptedBlob(encrypted_blob)
|
|
self.cipher = cipher
|
|
self.hash_function = hash_function
|
|
|
|
def to_json(self):
|
|
appointment = {"locator": self.locator, "start_time": self.start_time, "end_time": self.end_time,
|
|
"dispute_delta": self.dispute_delta, "encrypted_blob": self.encrypted_blob.data,
|
|
"cipher": self.cipher, "hash_function": self.hash_function}
|
|
|
|
return appointment
|
|
|
|
# ToDO: We may want to add some additional things to the appointment, like
|
|
# minimum fee
|
|
# refund to be payed to the user in case of failing
|
|
|
|
|
|
|