Fix transaction user attribute
All checks were successful
ci/woodpecker/push/docker Pipeline was successful

This commit is contained in:
Oliver Traber 2024-04-20 19:36:57 +02:00
parent 332bdc00d7
commit 9041c922f7

View file

@ -176,7 +176,7 @@ class ChargePoint(cp):
) )
if "id_token" in kwargs.keys(): if "id_token" in kwargs.keys():
if id_token_info.status == AuthorizationStatusType.accepted: if id_token_info.status == AuthorizationStatusType.accepted:
transaction.user_id = UUID(token_owner_id) transaction.user_id = token_owner_id
db.add(transaction) db.add(transaction)
elif event_type == str(TransactionEventType.updated): elif event_type == str(TransactionEventType.updated):
transaction = db.get(DbTransaction, transaction_info["transaction_id"]) transaction = db.get(DbTransaction, transaction_info["transaction_id"])
@ -202,7 +202,7 @@ class ChargePoint(cp):
db.add(db_meter_value) db.add(db_meter_value)
if "id_token" in kwargs.keys(): if "id_token" in kwargs.keys():
if id_token_info.status == AuthorizationStatusType.accepted: if id_token_info.status == AuthorizationStatusType.accepted:
transaction.user_id = UUID(token_owner_id) transaction.user_id = token_owner_id
elif event_type == str(TransactionEventType.ended): elif event_type == str(TransactionEventType.ended):
transaction = db.get(DbTransaction, transaction_info["transaction_id"]) transaction = db.get(DbTransaction, transaction_info["transaction_id"])
transaction.status = TransactionStatus.ENDED transaction.status = TransactionStatus.ENDED
@ -220,7 +220,7 @@ class ChargePoint(cp):
transaction.meter_end = meter_end transaction.meter_end = meter_end
if "id_token" in kwargs.keys(): if "id_token" in kwargs.keys():
if id_token_info.status == AuthorizationStatusType.accepted: if id_token_info.status == AuthorizationStatusType.accepted:
transaction.user_id = UUID(token_owner_id) transaction.user_id = token_owner_id
db.commit() db.commit()
if "id_token" in kwargs.keys(): if "id_token" in kwargs.keys():