Skip to content

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented May 22, 2025

Type of Change

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

Description

This pull request introduces a new feature for retrieving dynamic routing volume split configurations and includes related updates across multiple files. The changes primarily focus on adding a new API endpoint, defining associated data structures, and integrating the functionality into the existing routing system.

New Feature: Retrieve Dynamic Routing Volume Split

API Enhancements:

  • Added a new endpoint /get_volume_split to retrieve dynamic routing volume split configurations. This endpoint is defined in crates/router/src/routes/app.rs and implemented in crates/router/src/routes/routing.rs. [1] [2]

Data Structures:

  • Introduced a new struct RoutingVolumeSplitResponse in crates/api_models/src/routing.rs to encapsulate the volume split value (split: u8).
  • Updated the ApiEventMetric trait implementation to include RoutingVolumeSplitResponse and ToggleDynamicRoutingPath.

Backend Logic:

  • Added a new function retrieve_dynamic_routing_volume_split in crates/router/src/core/routing.rs to handle the business logic for fetching the volume split value from the database and returning it as a response.

Dependency Updates:

  • Updated imports in crates/api_models/src/events/routing.rs and crates/openapi/src/openapi.rs to include the new RoutingVolumeSplitResponse type. [1] [2]

Additional Changes

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

Motivation and Context

How did you test it?

  1. Create merchant account and api_key
  2. Using the default profile created during merchant account creation, hit below api to set volume split
curl --location --request POST 'http://localhost:8080/account/merchant_1747932999/business_profile/pro_kXrizzzc7yklUW8sfxXz/dynamic_routing/set_volume_split?split=50' \
--header 'api-key: xyz'
  1. Hit get api which is added in this PR to get the volume split set in above api
curl --location 'http://localhost:8080/account/merchant_1747932999/business_profile/pro_kXrizzzc7yklUW8sfxXz/dynamic_routing/get_volume_split' \
--header 'api-key: xyz'

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

@Chethan-rao Chethan-rao self-assigned this May 22, 2025
@Chethan-rao Chethan-rao requested review from a team as code owners May 22, 2025 16:54
@Chethan-rao Chethan-rao added C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes A-routing Area: Routing labels May 22, 2025
Copy link

semanticdiff-com bot commented May 22, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js  100% smaller
  crates/api_models/src/events/routing.rs  30% smaller
  crates/router/src/routes/app.rs  18% smaller
  crates/openapi/src/openapi.rs  13% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/routing.rs  0% smaller
  crates/router/src/core/routing.rs  0% smaller
  crates/router/src/routes/routing.rs  0% smaller

@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label May 22, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label May 22, 2025
Sarthak1799
Sarthak1799 previously approved these changes May 22, 2025
@@ -1502,3 +1502,44 @@ pub async fn set_dynamic_routing_volume_split(
))
.await
}

#[cfg(all(feature = "olap", feature = "v1"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add dynamic_routing feature flag for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to. I've opened an issue for that and can be picked later.
#8117

ShankarSinghC
ShankarSinghC previously approved these changes May 23, 2025
tsdk02
tsdk02 previously approved these changes May 23, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue May 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 26, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue May 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 26, 2025
@hyperswitch-bot hyperswitch-bot bot requested a review from a team as a code owner May 27, 2025 15:21
ShankarSinghC
ShankarSinghC previously approved these changes May 27, 2025
@likhinbopanna likhinbopanna enabled auto-merge May 27, 2025 16:36
@likhinbopanna likhinbopanna added this pull request to the merge queue May 27, 2025
Merged via the queue into main with commit b7c5f1f May 27, 2025
14 of 20 checks passed
@likhinbopanna likhinbopanna deleted the add-get-api-for-volume-split-dr branch May 27, 2025 17:51
pixincreate added a commit that referenced this pull request May 30, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch: (30 commits)
  chore(version): 2025.05.30.0
  chore(ci): update postman ci credentials (#8172)
  chore(docs): remove old add_connector.md file (#8143)
  refactor: Payment Attempt as mandatory field in PaymentStatusData (#8126)
  fix(payment_link): sanitize embedded payment link data (#7736)
  chore(version): 2025.05.29.0
  feat(analytics): Add ckh columns for 3ds intelligence analytics (#8136)
  refactor(debit_routing): Handle missing merchant_business_country by defaulting to US (#8141)
  chore(version): 2025.05.28.0
  refactor(success_based): add support for exploration (#8158)
  feat(dynamic_routing): add get api for dynamic routing volume split (#8114)
  fix: incorrect payout_method_id in payouts table (#8107)
  feat(router): Enable client_secret auth for payments_get_intent [v2] (#8119)
  chore: address Rust 1.87.0 clippy lints (#8130)
  feat: list for dynamic routing (#8111)
  ci(cypress): fix mandates unsupported connectors (#8086)
  feat(connector): [Barclaycard] Implement Cards - Non 3DS flow (#8068)
  fix(authentication): add Organization context validation in `Merchant Create` and `Merchant List` APIs (#8103)
  feat(connector): [Worldpayxml] add card payment (#8076)
  feat(connector): Stripe revolut pay wallet integration (#8066)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-routing Area: Routing C-feature Category: Feature request or enhancement 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(dynamic_routing): add get api for dynamic routing volume split
6 participants