Skip to content

Commit

Permalink
[FIX] missing traction webhook payload. (#2753)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jsyro authored Oct 26, 2023
1 parent f515749 commit 37142dd
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <topic={topic}>: {request.__dict__.keys()}")
current_app.logger.warning(f"TRACTION WEBHOOK <topic={topic}>: {request.args}")
current_app.logger.warning(f"TRACTION WEBHOOK <topic={topic}>: {request.data}")
current_app.logger.warning(f"TRACTION WEBHOOK <topic={topic}>: {request.values}")
current_app.logger.warning(f"TRACTION WEBHOOK <topic={topic}>: {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()
Expand Down

0 comments on commit 37142dd

Please sign in to comment.