Skip to content

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Jun 7, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Added an event each time a payment capture happens with the relevant contextual info

  • Pass along request_state to payment_core
  • Modify the UpdateTracker trait to accept request state
  • Modify the PaymentCapture implementation of UpdateTracker to generate an event
  • Showing the capture_amount and multiple_capture_count fields in the event
  • Added tenant_id field for the event

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

To generate audit events whenever the payment state changes so we can get a brief overview without needing to comb through the logs.

How did you test it?

  • Implemented an event trigger that activates whenever the payment capture API is utilized. This event triggers an audit event, the details of which are subsequently reflected in the Kafka UI.
  • Create a payment & then capture it.
  • Fields that need to be tested are: capture_amount, multiple_capture_count and tenant_id.
{"topic": "hyperswitch-audit-events"}
Screenshot 2024-06-10 at 4 09 13 PM Screenshot 2024-06-10 at 4 09 51 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@tsdk02 tsdk02 requested a review from lsampras June 7, 2024 11:15
@tsdk02 tsdk02 self-assigned this Jun 7, 2024
@tsdk02 tsdk02 requested review from a team as code owners June 7, 2024 11:15
@tsdk02 tsdk02 linked an issue Jun 7, 2024 that may be closed by this pull request
@tsdk02 tsdk02 requested a review from a team as a code owner June 10, 2024 09:40
lsampras
lsampras previously approved these changes Jun 10, 2024
@tsdk02 tsdk02 requested review from ivor11 and su-shivanshmathur and removed request for ivor11 June 10, 2024 10:34
@tsdk02 tsdk02 dismissed stale reviews from su-shivanshmathur and lsampras via d65b0d1 June 11, 2024 07:41
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 12, 2024
Merged via the queue into main with commit 40a996e Jun 12, 2024
@Gnanasundari24 Gnanasundari24 deleted the add-audit-events-payment-capture-update branch June 12, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add audit events for PaymentCapture update
4 participants