diff --git a/services/core-api/app/api/parties/party/models/party.py b/services/core-api/app/api/parties/party/models/party.py index 332e4a9a45..d462c027e2 100644 --- a/services/core-api/app/api/parties/party/models/party.py +++ b/services/core-api/app/api/parties/party/models/party.py @@ -115,10 +115,13 @@ def business_roles_codes(self): @hybrid_property def digital_wallet_connection_status(self): - dwi = [i for i in self.digital_wallet_invitations if i.connection_state] # filter empty conn_state + dwi = set([i.connection_state for i in self.digital_wallet_invitations if i.connection_state]) # filter empty conn_state if dwi: current_app.logger.warning(dwi) - return dwi.connection_state # active >> invitation + if "active" in dwi: + return "active" + else: + return dwi[0].connection_state # active >> invitation else: return None diff --git a/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_webhook.py b/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_webhook.py index e58e18a372..5a3d42ae54 100644 --- a/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_webhook.py +++ b/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_webhook.py @@ -30,16 +30,18 @@ def post(self, topic): if new_state != vc_conn.connection_state: vc_conn.connection_state=new_state vc_conn.save() - current_app.logger.debug(f"Updated party_vc_conn connection_id={vc_conn.connection_id} with state={new_state}") + current_app.logger.info(f"Updated party_vc_conn connection_id={vc_conn.connection_id} with state={new_state}") elif topic == OUT_OF_BAND: invitation_id = webhook_body["invi_msg_id"] vc_conn = PartyVerifiableCredentialConnection.query.unbound_unsafe().filter_by(invitation_id=invitation_id).first() assert vc_conn, f"out_of_band.invi_msg_id={invitation_id} not found" new_state = webhook_body["state"] - if new_state != vc_conn.connection_state: + if new_state == "await-response": vc_conn.connection_state=new_state vc_conn.save() - current_app.logger.debug(f"Updated party_vc_conn invitation_id={invitation_id} with state={new_state}") + current_app.logger.info(f"Updated party_vc_conn invitation_id={invitation_id} with state={new_state}") + else: + current_app.logger.debug(f"do not update connection_state with oob_message state") elif topic == CREDENTIAL_OFFER: cred_exch_id = webhook_body["credential_exchange_id"] cred_exch_record = PartyVerifiableCredentialMinesActPermit.query.unbound_unsafe().filter_by(cred_exch_id=cred_exch_id).first() @@ -48,7 +50,7 @@ def post(self, topic): if new_state != cred_exch_record.cred_exch_state: cred_exch_record.cred_exch_state=new_state cred_exch_record.save() - current_app.logger.debug(f"Updated cred_exch_record cred_exch_id={cred_exch_id} with state={new_state}") + current_app.logger.info(f"Updated cred_exch_record cred_exch_id={cred_exch_id} with state={new_state}") else: current_app.logger.info(f"unknown topic '{topic}'")