Remove payment info again

This commit is contained in:
Lynn Ochs 2023-01-09 20:49:51 +01:00
parent 000b481745
commit d9bfc66ac7

View File

@ -37,9 +37,9 @@ class DoorControlNfc(util.Loggable):
lines =[ s.strip() for s in open(self._config.valid_tokens, "r").readlines() ] lines =[ s.strip() for s in open(self._config.valid_tokens, "r").readlines() ]
for i, line in enumerate(lines): for i, line in enumerate(lines):
l = [s.strip() for s in line.split('|')] l = [s.strip() for s in line.split('|')]
if len(l) == 6: if len(l) == 5:
if not l[0].strip().startswith('#'): if not l[0].strip().startswith('#'):
token, name, organization, email, valid_thru, paid = l token, name, organization, email, valid_thru = l
try: try:
if len(valid_thru.strip()) > 0: if len(valid_thru.strip()) > 0:
valid_thru = datetime.date.fromisoformat(valid_thru) valid_thru = datetime.date.fromisoformat(valid_thru)
@ -56,10 +56,9 @@ class DoorControlNfc(util.Loggable):
'organization': organization, 'organization': organization,
'email': email, 'email': email,
'valid_thru': valid_thru, 'valid_thru': valid_thru,
'paid': paid.strip().lower() == 'yes'
} }
else: else:
self._logger().warning(f"Skipping line {i} ({line}) since it does not contain exactly 6 data field") self._logger().warning(f"Skipping line {i} ({line}) since it does not contain exactly 5 data field")
except Exception as e: except Exception as e:
valid = {} valid = {}
self._logger().error(f"Error reading token file. Exception: {e}") self._logger().error(f"Error reading token file. Exception: {e}")
@ -105,10 +104,6 @@ class DoorControlNfc(util.Loggable):
authorized = datetime.date.today() <= data['valid_thru'] authorized = datetime.date.today() <= data['valid_thru']
if not authorized: if not authorized:
self._logger().info(f"Expired token: {token} of {data['name']}") self._logger().info(f"Expired token: {token} of {data['name']}")
elif not data['paid']:
authorized = datetime.date.today() <= datetime.date(2023, 3, 1)
if not authorized:
self._logger().info(f"Unpaid token: {token} of {data['name']}")
else: else:
authorized = True authorized = True