Skip to content

feat(recovery-events): add revenue recovery topic and vector config to push these events to s3#8285

Merged
likhinbopanna merged 139 commits intomainfrom
setup_revenue_recovery_topic
Jul 25, 2025
Merged

feat(recovery-events): add revenue recovery topic and vector config to push these events to s3#8285
likhinbopanna merged 139 commits intomainfrom
setup_revenue_recovery_topic

Conversation

@NISHANTH1221
Copy link
Contributor

@NISHANTH1221 NISHANTH1221 commented Jun 9, 2025

Type of Change

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

Description

This new Kafka Event consume the revenue recovery related events which will be constructed from both RecoveryPaymentIntent and RecoveryPaymentAttempt in revenue recovery flow. The events form Kafka will be picked up by vector and this be eventually batched and pushed to s3 based on the set config. They file path will look like this merchant_id/Year/month/timestamp.csv.

The events will be recorded at two places. Webhook Flow(External Payments done by billing processor) and Internal Proxy Flow(Internal Done by Hyperswitch as a part of retrying). The event structure is mentioned in the kafka message in code.

The estimated size of each event is around 1000bytes. We want to keep the config at 1000 batches and one day(86400s) timeout in vector. So that vector collects all the events till the end of the time out or till it hits 1000 events and push them to s3 file in the designated file path in a csv format in the order mentioned in the config. Based on the above config vector needs 10mb size buffer to support this. S3 auth will be done using the IAM Instance profile which will be taken care off at the time of the deployment.

Additional Changes

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

Motivation and Context

As for the Revenue Recovery System we needed a pipeline which can move transaction based data to s3 where we store the entire transactional data which can be further used to train models. The transactional data consists of various parameters from both payment intent and payment attempt. So we created a new topic to facilitate this requirement.

How did you test it?

At the time of this pr getting merged, Kafka is not enabled for V2 . So we cannot test it.
It can be tested by the following steps once kafka is enabled for v2.
Follow the steps in this pr #7461 and check the s3 attached to that kafka topic to find a file after waiting for one day.
Sample Kafka Event :
Screenshot 2025-07-07 at 4 57 59 PM

Here is the S3 File Path:
Screenshot 2025-06-11 at 7 20 08 PM

Here is the AWS File sample
Screenshot 2025-07-07 at 5 01 25 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

Nishanth Challa and others added 30 commits April 2, 2025 14:06
tsdk02
tsdk02 previously approved these changes Jul 14, 2025
@NISHANTH1221 NISHANTH1221 dismissed stale reviews from tsdk02 and su-shivanshmathur via 6c72941 July 14, 2025 06:59
srujanchikke
srujanchikke previously approved these changes Jul 17, 2025
tsdk02
tsdk02 previously approved these changes Jul 17, 2025
jarnura
jarnura previously approved these changes Jul 17, 2025
@likhinbopanna likhinbopanna enabled auto-merge July 24, 2025 07:38
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 24, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 24, 2025
@NISHANTH1221 NISHANTH1221 dismissed stale reviews from jarnura, tsdk02, and srujanchikke via 3bc3df2 July 24, 2025 10:42
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 25, 2025
Merged via the queue into main with commit 17d34a2 Jul 25, 2025
17 of 23 checks passed
@likhinbopanna likhinbopanna deleted the setup_revenue_recovery_topic branch July 25, 2025 12:00
pixincreate added a commit that referenced this pull request Jul 28, 2025
…rver

* 'main' of github.com:juspay/hyperswitch: (24 commits)
  chore(version): 2025.07.28.1
  feat(core): Hyperswitch <|> UCS Mandate flow integration (#8738)
  feat(themes): Create user APIs for managing themes (#8387)
  chore: update devDependencies for cypress (#8735)
  refactor: Add routing_approach other variant to handle unknown data (#8754)
  chore(version): 2025.07.28.0
  refactor(connector): [facilitapay] move destination bank account number to connector metadata (#8704)
  feat(recovery-events): add revenue recovery topic and vector config to push these events to s3 (#8285)
  ci(cypress): add authorizedotnet connector (#8688)
  refactor(schema): add a new column for storing large customer user agents in mandate table (#8616)
  feat(authentication): add authentication api for modular authentication (#8459)
  feat(connector): [MPGS] template code (#8544)
  fix(chat): append request id to headers for chat request (#8680)
  feat(connector): [Flexiti]template code for flexiti connector (#8714)
  chore(version): 2025.07.25.0
  feat(core): Consuming locale in PaymentsAuthorizeData from SessionState (#8731)
  fix(payment-methods): fetch payment method details in payouts flow (#8729)
  refactor(core): remove hardcoded timeout limit of 5s for outgoing webhook requests (#8725)
  feat(connector): [Breadpay]Add support for Breadpay connector (#8676)
  fix(feature_matrix): refunds are supported by jpmorgan (#8699)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 M-api-contract-changes Metadata: This PR involves API contract changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(recovery-events): add revenue recovery topic and vector config to push these events to s3

6 participants