Skip to content

feat(router): Add support for confirm-intent proxy flow #8923

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

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

Conversation

prasunna09
Copy link
Contributor

Type of Change

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

Description

Add support for confirm-intent proxy flow which accepts Card payment method data with card number vault token instead of raw card number.

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?

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

@prasunna09 prasunna09 requested review from a team as code owners August 12, 2025 10:17
Copy link

semanticdiff-com bot commented Aug 12, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/types/api/payments.rs  91% smaller
  crates/router/src/types.rs  47% smaller
  crates/hyperswitch_domain_models/src/types.rs  45% smaller
  crates/hyperswitch_connectors/src/utils.rs  33% smaller
  crates/hyperswitch_interfaces/src/api/payments.rs  26% smaller
  crates/hyperswitch_interfaces/src/api/payments_v2.rs  24% smaller
  crates/router/src/routes/app.rs  17% smaller
  crates/hyperswitch_connectors/src/default_implementations_v2.rs  9% smaller
  crates/hyperswitch_connectors/src/default_implementations.rs  7% smaller
  crates/router/src/core/unified_connector_service/transformers.rs  6% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs  2% smaller
  crates/router/src/routes/payments.rs  1% smaller
  Cargo.lock Unsupported file format
  crates/api_models/src/payments.rs  0% smaller
  crates/external_services/Cargo.toml Unsupported file format
  crates/hyperswitch_domain_models/src/payment_method_data.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_data.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_flow_types/payments.rs  0% smaller
  crates/router/Cargo.toml Unsupported file format
  crates/router/src/core/payments.rs  0% smaller
  crates/router/src/core/payments/flows.rs  0% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  0% smaller
  crates/router/src/core/payments/flows/external_proxy_flow.rs  0% smaller
  crates/router/src/core/payments/operations.rs  0% smaller
  crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs  0% smaller
  crates/router/src/core/payments/operations/payment_confirm_intent.rs  0% smaller
  crates/router/src/core/payments/operations/payment_response.rs  0% smaller
  crates/router/src/core/payments/operations/proxy_payments_intent.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/unified_connector_service.rs  0% smaller
  crates/router/src/services/api.rs  0% smaller


/// The card holder's name
#[schema(value_type = String, example = "John Test")]
pub card_holder_name: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make this Optional

charges: None,
client_source: None,
client_version: None,
customer_acceptance: None,
Copy link
Contributor

Choose a reason for hiding this comment

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

please fill this data since it is collected in the request

organization_id: payment_intent.organization_id.clone(),
payment_method_type: payment_method_type_data
.unwrap_or(common_enums::PaymentMethod::Card),
payment_method_id: None,
Copy link
Contributor

Choose a reason for hiding this comment

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

please fill this as well

@@ -9,7 +9,7 @@ readme = "README.md"
license.workspace = true

[features]
default = ["common_default", "v1"]
default = ["common_default", "v2"]
Copy link
Contributor

Choose a reason for hiding this comment

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

revert this to v1

Comment on lines +57 to +69
Box::pin(
transformers::construct_external_vault_proxy_payment_router_data(
state,
self.clone(),
connector_id,
merchant_context,
customer,
merchant_connector_account,
merchant_recipient_data,
header_payload,
),
)
.await
Copy link
Contributor

Choose a reason for hiding this comment

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

can we construct v2 router data and then convert to v1 router data for future compatibility

@@ -880,6 +880,7 @@ where
pub mandate_data: Option<api_models::payments::MandateIds>,
pub payment_method: Option<payment_methods::PaymentMethod>,
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
pub external_vault_pmd: Option<payment_method_data::ExternalVaultPaymentMethodData>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have separate PaymentData for External Vault Confirm

Some(status) => status,
None => match error.status_code {
500..=511 => common_enums::enums::AttemptStatus::Pending,
_ => common_enums::enums::AttemptStatus::Failure,
Copy link
Member

Choose a reason for hiding this comment

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

For unknown things we should not mark failure, only for the known and definite failure we should mark failure

Some(status) => status,
None => match error_response.status_code {
500..=511 => common_enums::enums::AttemptStatus::Pending,
_ => common_enums::enums::AttemptStatus::Failure,
Copy link
Member

Choose a reason for hiding this comment

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

For unknown things we should not mark failure, only for the known and definite failure we should mark failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants