Skip to content

feat(core): Add Support for redirection inside Iframe #7976

Merged
Gnanasundari24 merged 2 commits intomainfrom
fix/iframe-redirection
May 15, 2025
Merged

feat(core): Add Support for redirection inside Iframe #7976
Gnanasundari24 merged 2 commits intomainfrom
fix/iframe-redirection

Conversation

@awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented May 7, 2025

Type of Change

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

Description

This pull request introduces support for payment redirection inside an iframe.

  • New flag added:

    • is_iframe_redirection_enabled has been introduced in both:
      • PaymentIntent
      • BusinessProfile
  • New NextActionType:

    • Added RedirectInsidePopup to NextActionType and NextActionData enums to support redirection within a popup (iframe-based).

Behavior of is_iframe_redirection_enabled

  • The flag is resolved in the following order of precedence:
    1. The value provided in the PaymentIntent request (if explicitly set)
    2. If not set in the request, the value from the BusinessProfile is used
    3. If the flag is not set in either place, iframe redirection is disabled by default

Flag Resolution Scenarios

Case PaymentIntent Flag BusinessProfile Flag Resulting Behavior
1 true false Iframe redirection enabled
2 false true Iframe redirection disabled
3 not set true Iframe redirection enabled
4 not set false or not set Iframe redirection disabled

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?

🟢 Case 1: PaymentIntent = true, BusinessProfile = false

Attribute Value
PaymentIntent "is_iframe_redirection_enabled": true
BusinessProfile "is_iframe_redirection_enabled": false
Expected Result Iframe redirection enabled
NextActionType RedirectInsidePopup
Screen.Recording.2025-05-13.at.6.59.54.PM.mov

🟢 Case 1: PaymentIntent = False, BusinessProfile = True

Screen.Recording.2025-05-13.at.7.09.43.PM.mov

This change is done only for cards 3ds where we get the authenticationData .

Screen.Recording.2025-05-15.at.4.41.07.PM.mov

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

@awasthi21 awasthi21 self-assigned this May 7, 2025
@awasthi21 awasthi21 requested review from a team as code owners May 7, 2025 11:18
@semanticdiff-com
Copy link

semanticdiff-com bot commented May 7, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/transformers.rs  38% smaller
  crates/router/src/core/payments.rs  28% smaller
  crates/api_models/src/admin.rs  0% smaller
  crates/api_models/src/payments.rs  0% smaller
  crates/diesel_models/src/business_profile.rs  0% smaller
  crates/diesel_models/src/payment_intent.rs  0% smaller
  crates/diesel_models/src/schema.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/hyperswitch_domain_models/src/business_profile.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  0% smaller
  crates/router/src/compatibility/stripe/payment_intents/types.rs  0% smaller
  crates/router/src/compatibility/stripe/setup_intents/types.rs  0% smaller
  crates/router/src/core/admin.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_confirm.rs  0% smaller
  crates/router/src/core/payments/operations/payment_create.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update_intent.rs  0% smaller
  crates/router/src/core/utils.rs  0% smaller
  crates/router/src/types/api/admin.rs  0% smaller
  crates/router/src/utils/user/sample_data.rs  0% smaller
  crates/router/tests/payments.rs  0% smaller
  crates/router/tests/payments2.rs  0% smaller
  migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/down.sql Unsupported file format
  migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/up.sql Unsupported file format
  migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/down.sql Unsupported file format
  migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels May 7, 2025
@awasthi21 awasthi21 force-pushed the fix/iframe-redirection branch from fd573dc to ade5b93 Compare May 8, 2025 15:49
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels May 8, 2025
SanchithHegde
SanchithHegde previously approved these changes May 12, 2025
@awasthi21 awasthi21 force-pushed the fix/iframe-redirection branch from c0fda12 to d699073 Compare May 13, 2025 05:33
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels May 13, 2025
@awasthi21 awasthi21 changed the title Fix/iframe redirection feat(core): Add Support for redirection inside Iframe May 13, 2025
@awasthi21 awasthi21 force-pushed the fix/iframe-redirection branch from 7eed867 to bdab7aa Compare May 13, 2025 07:08
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels May 13, 2025
@awasthi21 awasthi21 force-pushed the fix/iframe-redirection branch 2 times, most recently from 9e5af1c to 2c1c828 Compare May 13, 2025 11:43
@awasthi21 awasthi21 requested a review from a team as a code owner May 13, 2025 11:43
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label May 13, 2025
@awasthi21 awasthi21 force-pushed the fix/iframe-redirection branch from 2c1c828 to 03f8503 Compare May 13, 2025 13:34
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 left a comment

Choose a reason for hiding this comment

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

Dashboard specific change looks fine.

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 15, 2025
Merged via the queue into main with commit 831149c May 15, 2025
21 of 27 checks passed
@Gnanasundari24 Gnanasundari24 deleted the fix/iframe-redirection branch May 15, 2025 11:46
iemyashasvi pushed a commit that referenced this pull request May 22, 2025
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

M-database-changes Metadata: This PR involves database schema changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants