From 37142ddcb52c00c3b6ac16bfeea236a4342e2b1a Mon Sep 17 00:00:00 2001 From: Jason Syrotuck Date: Thu, 26 Oct 2023 14:33:16 -0700 Subject: [PATCH] [FIX] missing traction webhook payload. (#2753) --- .../resources/verifiable_credential_webhook.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 b8ce00ce9c..332a5025b5 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 @@ -18,32 +18,36 @@ class VerifiableCredentialWebhookResource(Resource, UserMixin): @api.doc(description='Endpoint to recieve webhooks from Traction.', params={}) def post(self, topic): + current_app.logger.warning(f"TRACTION WEBHOOK : {request.__dict__.keys()}") current_app.logger.warning(f"TRACTION WEBHOOK : {request.args}") + current_app.logger.warning(f"TRACTION WEBHOOK : {request.data}") + current_app.logger.warning(f"TRACTION WEBHOOK : {request.values}") + current_app.logger.warning(f"TRACTION WEBHOOK : {request.get_json()}") current_app.logger.warning(f"{request.args.to_dict(flat=True).keys()}") current_app.logger.warning(f"{request.args.to_dict(flat=False)}") if topic == CONNECTIONS: - connection_id = request.args['connection_id'] + connection_id = request.values['connection_id'] vc_conn = PartyVerifiableCredentialConnection.query.unbound_unsafe().filter_by(connection_id=connection_id).first() assert vc_conn, f"{connection_id} not found" - new_state = request.args["state"] + new_state = request.values["state"] 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={connection_id} with state={new_state}") if topic == OUT_OF_BAND: - invitation_id = request.args.get("invi_msg_id") + invitation_id = request.values["invi_msg_id"] vc_conn = PartyVerifiableCredentialConnection.query.unbound_unsafe().filter_by(invitation_id=invitation_id).first() assert vc_conn, f"{invitation_id} not found" - new_state = request.args["state"] + new_state = request.values["state"] 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 invitation_id={invitation_id} with state={new_state}") if topic == CREDENTIAL_OFFER: - cred_exch_id = request.args.get("credential_exchange_id") + cred_exch_id = request.values["credential_exchange_id"] cred_exch_record = PartyVerifiableCredentialMinesActPermit.query.unbound_unsafe().filter_by(cred_exch_id=cred_exch_id).first() assert cred_exch_record - new_state = request.args["state"] + new_state = request.values["state"] if new_state != cred_exch_record.cred_exch_state: cred_exch_record.cred_exch_state=new_state cred_exch_record.save()