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: add routing support for v2 sdk session flow #6763

Merged
merged 68 commits into from
Mar 26, 2025

Conversation

hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Dec 6, 2024

Type of Change

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

Description

Added session routing support for session call in v2. And store the prerouting results in the payment_intent tabled prerouting_algorithm column.

Other changes:

  • used MerchantConnectorAccounts Wrapper instead of Vec<MerchantConnectorAccount> across the codebase.

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?

follow the steps mentioned in this PR.
#6502

In addition to that check if prerouting_algorithm column in payment_intent is updated.
use this query.

select prerouting_algorithm from payment_intent where id ='payment_id';

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

@hrithikesh026 hrithikesh026 added A-core Area: Core flows C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed api-v2 labels Dec 6, 2024
@hrithikesh026 hrithikesh026 added this to the December 2024 Release milestone Dec 6, 2024
@hrithikesh026 hrithikesh026 self-assigned this Dec 6, 2024
@hrithikesh026 hrithikesh026 requested review from a team as code owners December 6, 2024 06:34
Copy link

semanticdiff-com bot commented Dec 6, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/utils.rs  68% smaller
  crates/router/src/core/payments/operations/payment_session.rs  65% smaller
  crates/router/src/core/payment_methods/cards.rs  64% smaller
  crates/router/src/core/admin.rs  60% smaller
  crates/router/src/consts.rs  52% smaller
  crates/router/src/core/payout_link.rs  51% smaller
  crates/storage_impl/src/payments/payment_intent.rs  49% smaller
  crates/kgraph_utils/src/error.rs  49% smaller
  crates/router/src/db/merchant_connector_account.rs  48% smaller
  crates/hyperswitch_interfaces/src/conversion_impls.rs  27% smaller
  crates/openapi/src/openapi.rs  21% smaller
  crates/openapi/src/openapi_v2.rs  21% smaller
  crates/common_utils/src/macros.rs  21% smaller
  crates/router/src/core/payments/operations/payment_session_intent.rs  17% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  15% smaller
  crates/router/src/core/payments/flows.rs  14% smaller
  crates/router/src/core/payments/helpers.rs  14% smaller
  crates/hyperswitch_interfaces/src/connector_integration_v2.rs  10% smaller
  crates/router/src/core/payments/routing.rs  8% smaller
  crates/router/src/core/payments.rs  8% smaller
  crates/router/src/types/api/authentication.rs  7% smaller
  crates/router/src/types/storage.rs  6% smaller
  crates/hyperswitch_connectors/src/default_implementations_v2.rs  5% smaller
  crates/hyperswitch_connectors/src/default_implementations.rs  5% smaller
  crates/router/src/types/api/authentication_v2.rs  3% smaller
  crates/hyperswitch_domain_models/src/payments.rs  3% smaller
  crates/hyperswitch_domain_models/src/merchant_connector_account.rs  3% smaller
  crates/router/src/types/api.rs  2% smaller
  crates/hyperswitch_interfaces/src/api.rs  1% smaller
  crates/router/src/types/api/fraud_check_v2.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/nexinets.rs  1% smaller
  crates/hyperswitch_connectors/src/connectors/helcim.rs  1% smaller
  .typos.toml Unsupported file format
  Cargo.lock Unsupported file format
  crates/api_models/src/admin.rs  0% smaller
  crates/api_models/src/routing.rs  0% smaller
  crates/common_enums/src/connector_enums.rs  0% smaller
  crates/diesel_models/src/payment_intent.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/coinbase.rs  0% smaller
  crates/hyperswitch_domain_models/Cargo.toml Unsupported file format
  crates/hyperswitch_domain_models/src/configs.rs  0% smaller
  crates/hyperswitch_domain_models/src/consts.rs  0% smaller
  crates/hyperswitch_domain_models/src/lib.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_flow_types.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_flow_types/authentication.rs  0% smaller
  crates/hyperswitch_domain_models/src/routing.rs  0% smaller
  crates/hyperswitch_interfaces/src/api/authentication.rs  0% smaller
  crates/hyperswitch_interfaces/src/api/authentication_v2.rs  0% smaller
  crates/hyperswitch_interfaces/src/api/fraud_check.rs  0% smaller
  crates/hyperswitch_interfaces/src/api/fraud_check_v2.rs  0% smaller
  crates/hyperswitch_interfaces/src/configs.rs  0% smaller
  crates/hyperswitch_interfaces/src/connector_integration_interface.rs Unsupported file format
  crates/hyperswitch_interfaces/src/lib.rs  0% smaller
  crates/kgraph_utils/Cargo.toml Unsupported file format
  crates/kgraph_utils/src/mca.rs  0% smaller
  crates/router/Cargo.toml Unsupported file format
  crates/router/src/core/payments/connector_integration_v2_impls.rs  0% smaller
  crates/router/src/core/payments/session_operation.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/routing.rs  0% smaller
  crates/router/src/core/routing/helpers.rs  0% smaller
  crates/router/src/db/kafka_store.rs  0% smaller
  crates/router/src/services.rs  0% smaller
  crates/router/src/services/connector_integration_interface.rs Unsupported file format
  crates/router/src/types/api/fraud_check.rs  0% smaller

@hrithikesh026 hrithikesh026 added M-database-changes Metadata: This PR involves database schema changes and removed M-database-changes Metadata: This PR involves database schema changes labels Dec 9, 2024
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 20, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 20, 2025
Comment on lines +582 to +584
impl TryFrom<Connector> for RoutableConnectors {
type Error = &'static str;

Copy link
Contributor

Choose a reason for hiding this comment

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

We already have the ForeignFrom implementation in router crate , maybe we could replace that with this , in the next PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. I've added that to this list.
#6763 (review)

Aprabhat19
Aprabhat19 previously approved these changes Mar 20, 2025
#[cfg(feature = "v2")]
fn compile_payment_method_enabled(
builder: &mut cgraph::ConstraintGraphBuilder<dir::DirValue>,
enabled: common_types::payment_methods::PaymentMethodsEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this , can we do a from conversion between the types and use it here , instead of de-duplicating the function. In another PR?

jarnura
jarnura previously approved these changes Mar 20, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 21, 2025
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 23, 2025
@hrithikesh026 hrithikesh026 dismissed stale reviews from jarnura and Aprabhat19 via 45d931a March 23, 2025 19:13
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 26, 2025
Merged via the queue into main with commit c3e8c67 Mar 26, 2025
16 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the add-routing-support-for-v2-sdk-session-flow branch March 26, 2025 08:52
pixincreate added a commit that referenced this pull request Mar 26, 2025
…acilitapay

* 'main' of github.com:juspay/hyperswitch:
  chore(cypress): bump cypress to `v14.2.0` (#7640)
  feat(connector): [BRAINTREE] Pass connector request reference id (#7609)
  fix(connector): [GlobalPay] Address `5xx` when cancelling a paypal transaction (#7605)
  feat(dashboard_metadata): Add `ReconStatus` in `dashboard_metadata` (#7595)
  fix(connectors): [Adyen] remove redundant enums  (#7601)
  feat: add routing support for v2 sdk session flow (#6763)
  chore(version): 2025.03.26.0
  feat(connector): [Coingate] add wasm changes for coingate metadata (#7632)
  feat(connector): [TRUSTPAY]  implement Banktransfer PaymentMethod (#7575)
  feat(connector): [BANKOFAMERICA] Implement Samsung Pay (#6888)
  fix(connector):  add Nomupay in payout_connector_list for all environment (#7521)
  chore(version): 2025.03.25.0
pixincreate added a commit that referenced this pull request Mar 27, 2025
…e-status-check

* 'main' of github.com:juspay/hyperswitch:
  build(docker): specify user for runner stage (#7641)
  chore(version): 2025.03.27.0
  fix(connector): [Nexixpay] update status mapping nexixpay (#7612)
  refactor(connector): [TrustPay] Fix status and wasm changes  (#7649)
  fix(connector): [redsys] psync transaction type mapping (#7628)
  feat(themes): Add email configuration support for themes (#7580)
  feat(core): add profile level config for debit routing feature (#7470)
  fix(connector): [CYBERSOURCE]  change ucaf_collection_indicator for mastercard payments via netcetera (#7623)
  fix(connector): fix required fields for mandates supported connectors (#6930)
  chore(cypress): bump cypress to `v14.2.0` (#7640)
  feat(connector): [BRAINTREE] Pass connector request reference id (#7609)
  fix(connector): [GlobalPay] Address `5xx` when cancelling a paypal transaction (#7605)
  feat(dashboard_metadata): Add `ReconStatus` in `dashboard_metadata` (#7595)
  fix(connectors): [Adyen] remove redundant enums  (#7601)
  feat: add routing support for v2 sdk session flow (#6763)
@hyperswitch-bot hyperswitch-bot bot removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows api-v2 C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants