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): Integrate global success rates #6950

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Sarthak1799
Copy link
Contributor

@Sarthak1799 Sarthak1799 commented Dec 26, 2024

Type of Change

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

Description

Integrate global Success rates for dynamic routing

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. toggle success based routing with dynamic connector selection enabled
curl --location --request POST 'http://localhost:8080/account/sarthak2/business_profile/pro_F5mC1GGXHPLTtfcBnZEP/dynamic_routing/success_based/toggle?enable=dynamic_connector_selection' \
--header 'api-key: dev_RQxKf8JqHb5tTfTp13JMnI7TyWgXIHaa2AP5VkjLtst1CRJPArSfqasfGQI1oIAQ'
  1. Set volume split for dynamic routing
curl --location --request POST 'http://localhost:8080/account/sarthak2/business_profile/pro_F5mC1GGXHPLTtfcBnZEP/dynamic_routing/set_volume_split?split=80' \
--header 'api-key: dev_RQxKf8JqHb5tTfTp13JMnI7TyWgXIHaa2AP5VkjLtst1CRJPArSfqasfGQI1oIAQ'
  1. Make a payment
  2. Global SR connector should be populated in DB
image

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

@Sarthak1799 Sarthak1799 self-assigned this Dec 26, 2024
@Sarthak1799 Sarthak1799 requested review from a team as code owners December 26, 2024 13:46
Copy link

semanticdiff-com bot commented Dec 26, 2024

crates/api_models/src/routing.rs Show resolved Hide resolved
crates/api_models/src/routing.rs Outdated Show resolved Hide resolved
crates/router/src/core/routing/helpers.rs Outdated Show resolved Hide resolved
))?;

let outcome = get_success_based_metrics_outcome_for_payment(
payment_status_attribute,
payment_connector.to_string(),
first_success_based_connector.to_string(),
first_merchant_success_based_connector.to_string(),
);

let dynamic_routing_stats = DynamicRoutingStatsNew {
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 create a new column here which stores the globally_top_performing_connector at the time this particular payment was made?
cc: @prajjwalkumar17

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes we should do this.

@Chethan-rao
Copy link
Contributor

Chethan-rao commented Dec 30, 2024

there's conflicts too. please add test cases as well

crates/api_models/src/routing.rs Outdated Show resolved Hide resolved
crates/router/src/core/payments/routing.rs Outdated Show resolved Hide resolved
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jan 2, 2025
@Sarthak1799 Sarthak1799 linked an issue Jan 3, 2025 that may be closed by this pull request
2 tasks
@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Integrate global SR
3 participants