diff --git a/services/core-api/app/api/services/traction_service.py b/services/core-api/app/api/services/traction_service.py index 6373b83d89..e4d4a92864 100644 --- a/services/core-api/app/api/services/traction_service.py +++ b/services/core-api/app/api/services/traction_service.py @@ -93,21 +93,17 @@ def create_oob_connection_invitation(self, party: Party): def delete_connection(self, connection_id) -> bool: delete_resp = requests.delete( traction_connections + "/" + str(connection_id), headers=self.get_headers()) - current_app.logger.info(f"traction_service.delete_connection returned {delete_resp.status_code}") + current_app.logger.info( + f"traction_service.delete_connection returned {delete_resp.status_code}") return delete_resp.ok def reject_invitation(self, connection_id) -> bool: reject_resp = requests.delete( traction_reject_invitation(connection_id), headers=self.get_headers()) - current_app.logger.info(f"traction_service.delete_connection returned {reject_resp.status_code}") + current_app.logger.info( + f"traction_service.delete_connection returned {reject_resp.status_code}") return reject_resp.ok - def reject_invitation(self, connection_id) -> bool: - reject_resp = requests.delete( - traction_reject_invitation(connection_id), headers=self.get_headers()) - assert reject_resp.status_code == 200, f"reject_resp={reject_resp.json()}" - return True - def offer_mines_act_permit_111(self, connection_id, attributes): # https://github.com/bcgov/bc-vcpedia/blob/main/credentials/bc-mines-act-permit/1.1.1/governance.md#261-schema-definition payload = { diff --git a/services/core-api/app/api/verifiable_credentials/resources/traction_webhook.py b/services/core-api/app/api/verifiable_credentials/resources/traction_webhook.py index 1be3e07167..ff48f466bc 100644 --- a/services/core-api/app/api/verifiable_credentials/resources/traction_webhook.py +++ b/services/core-api/app/api/verifiable_credentials/resources/traction_webhook.py @@ -45,10 +45,12 @@ def post(self, topic): if not vc_conn.connection_id: # check if party already has a connection existing_vc_conn = PartyVerifiableCredentialConnection.query.unbound_unsafe( - ).filter(PartyVerifiableCredentialConnection.party_guid == vc_conn.party_guid, - PartyVerifiableCredentialConnection.connection_id != webhook_body["connection_id"], - PartyVerifiableCredentialConnection.connection_id != None).first() - + ).filter( + PartyVerifiableCredentialConnection.party_guid == vc_conn.party_guid, + PartyVerifiableCredentialConnection.connection_id + != webhook_body["connection_id"], + PartyVerifiableCredentialConnection.connection_id != None).first() + if existing_vc_conn: current_app.logger.warning( f"party_guid={vc_conn.party_guid} already has a connection_id={existing_vc_conn.connection_id}" @@ -56,11 +58,9 @@ def post(self, topic): #acapy has started creating a connection delete it so it cannot be completed. traction_svc = TractionService() - #delete connection record - if not traction_svc.delete_connection(webhook_body["connection_id"]): - current_app.logger.error( - f"error when deleting connection in traction, active aries connnection unusable by CORE, connection_id={webhook_body['connection_id']}" - ) + #delete connection record, do not care about result. + traction_svc.delete_connection(webhook_body["connection_id"]) + #delete oob invitation record if not traction_svc.reject_invitation(webhook_body["connection_id"]): current_app.logger.error(