Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(routing): elimination routing switch for toggling the feature #6568

Merged
merged 35 commits into from
Dec 2, 2024

Conversation

prajjwalkumar17
Copy link
Contributor

@prajjwalkumar17 prajjwalkumar17 commented Nov 14, 2024

Type of Change

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

Description

This PR will add route to enable Elimination based dynamic routing for specific profiles.

curl --location --request POST 'http://localhost:8080/account/MERCHANT_ID/business_profile/PROFILE_ID/dynamic_routing/elimination/toggle?enable=none' \
--header 'api-key: API_KEY'

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?

Testing Scenarios:

  1. enable elimination routing and check Profile table for the following value:
dynamic_routing_algorithm                             | 
{"success_based_algorithm":{"algorithm_id_with_timestamp":{"algorithm_id":"routing_2hS6Dn3XRjICecmNZg5s","timestamp":1732569416},"enabled_feature":"metrics"},"elimination_routing_algorithm":{"algorithm_id_with_timestamp":{"algorithm_id":"routing_nkajfnkjanf131231","timestamp":1732569427},"enabled_feature":"metrics"}}

can be enabled by this curl:

curl --location --request POST 'http://localhost:8080/account/MERCHANT_ID/business_profile/PROFILE_ID/dynamic_routing/elimination/toggle?enable=metrics' \
--header 'api-key: API_KEY'
  1. disable elimination routing and check profile table(can be disabled by passing enable as none),
    Note: SR shouldn't be removed.
dynamic_routing_algorithm                             | 
{"success_based_algorithm":{"algorithm_id_with_timestamp":{"algorithm_id":"routing_2hS6Dn3XRjICecmNZg5s","timestamp":1732569416},"enabled_feature":"metrics"},"elimination_routing_algorithm":{"algorithm_id_with_timestamp":{"algorithm_id":null,"timestamp":1732569427},"enabled_feature":"none"}}

can be disabled by this curl:

curl --location --request POST 'http://localhost:8080/account/MERCHANT_ID/business_profile/PROFILE_ID/dynamic_routing/elimination/toggle?enable=none' \
--header 'api-key: API_KEY'

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

@prajjwalkumar17 prajjwalkumar17 added C-feature Category: Feature request or enhancement A-routing Area: Routing labels Nov 14, 2024
@prajjwalkumar17 prajjwalkumar17 added this to the November 2024 Release milestone Nov 14, 2024
@prajjwalkumar17 prajjwalkumar17 self-assigned this Nov 14, 2024
@prajjwalkumar17 prajjwalkumar17 requested review from a team as code owners November 14, 2024 08:21
Copy link

semanticdiff-com bot commented Nov 14, 2024

@prajjwalkumar17 prajjwalkumar17 marked this pull request as draft November 14, 2024 08:21
@prajjwalkumar17 prajjwalkumar17 linked an issue Nov 16, 2024 that may be closed by this pull request
@prajjwalkumar17 prajjwalkumar17 marked this pull request as ready for review November 21, 2024 09:29
@prajjwalkumar17 prajjwalkumar17 requested a review from a team as a code owner November 21, 2024 09:29
@prajjwalkumar17 prajjwalkumar17 marked this pull request as draft November 22, 2024 04:20
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 25, 2024
@prajjwalkumar17 prajjwalkumar17 changed the title feat(routing): elimination routing feature feat(routing): elimination routing switch for toggling the feature Nov 25, 2024
@prajjwalkumar17 prajjwalkumar17 marked this pull request as ready for review November 25, 2024 21:47
Copy link
Contributor

@Chethan-rao Chethan-rao left a comment

Choose a reason for hiding this comment

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

Test both success_based and elimination routes and add relevant test cases

crates/api_models/src/routing.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/pub_sub.rs Outdated Show resolved Hide resolved
crates/router/src/core/routing/helpers.rs Outdated Show resolved Hide resolved
crates/router/src/core/routing/helpers.rs Outdated Show resolved Hide resolved
crates/router/src/core/routing/helpers.rs Outdated Show resolved Hide resolved
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 2, 2024
Merged via the queue into main with commit f6dde13 Dec 2, 2024
23 of 25 checks passed
@likhinbopanna likhinbopanna deleted the feat_elimination_routing branch December 2, 2024 15:10
kashif-m pushed a commit that referenced this pull request Dec 5, 2024
…6568)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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.

Create toggle and update endpoints for ER
6 participants