Skip to content

Conversation

@hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Nov 25, 2025

Based on the git diff analysis, I can see this is a significant refactoring PR that implements UCS (Unified Connector Service) granular flows. Let me create a comprehensive PR description and title for you.

PR Title

feat: Implement UCS granular flows with gateway context refactoring

Type of Change

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

Description

This PR implements a major refactoring to support granular flows in the Unified Connector Service (UCS) architecture. The changes include:

Core Changes:

  1. Gateway Context Refactoring: Introduced RouterGatewayContext as a unified context structure passed throughout payment flows
  2. UCS Granular Flows Support: Extended granular gateway support to Authorize and SetupMandate flows (previously only PSync)
  3. Dependency Updates: Updated connector-service dependency from rev b5a367c1 to 452d4966
  4. Flow Interface Updates: Modified all payment flow traits to accept gateway context parameter

Key Technical Changes:

  • Added gateway_context parameter to all flow methods (add_access_token, add_session_token, add_payment_method_token, etc.)
  • Refactored UCS response handlers to return simplified response types
  • Updated transformer implementations for better address handling
  • Enhanced gateway context creation with default constructor
  • Improved error handling and response mapping in UCS integration

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

This change is required to enable granular flow support in the Unified Connector Service architecture. The previous implementation had limited UCS support and inconsistent context handling across different payment flows. This refactoring:

  1. Standardizes Context Management: Provides a unified way to pass gateway context through all payment flows
  2. Enables Granular UCS Support: Extends UCS capabilities to Authorize and SetupMandate flows
  3. Improves Maintainability: Reduces code duplication and provides consistent interfaces
  4. Enhances Debugging: Better context tracking for payment flow execution

How did you test it?

The changes should be tested with:

  1. Unit Tests: Test the new gateway context creation and default constructor
  2. Integration Tests: Verify Authorize and SetupMandate flows work with UCS
  3. Manual Testing: Test payment flows with connectors that support granular UCS operations
  4. Regression Testing: Ensure existing PSync and direct connector flows continue to work

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 self-assigned this Nov 25, 2025
@hrithikesh026 hrithikesh026 requested review from a team as code owners November 25, 2025 01:01
@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 25, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/access_token.rs  94% smaller
  crates/router/src/core/unified_connector_service/transformers.rs  67% smaller
  crates/router/src/core/payments/gateway.rs  65% smaller
  crates/router/src/core/payments/flows/setup_mandate_flow.rs  60% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  56% smaller
  crates/router/src/core/payments/flows/session_flow.rs  49% smaller
  crates/router/src/core/payments/flows/complete_authorize_flow.rs  49% smaller
  crates/router/src/core/unified_connector_service.rs  47% smaller
  crates/router/src/core/payments/gateway/setup_mandate.rs  25% smaller
  crates/router/src/core/refunds.rs  22% smaller
  crates/router/src/core/payments/flows/external_proxy_flow.rs  20% smaller
  crates/router/src/core/payments.rs  16% smaller
  crates/router/src/core/payments/customers.rs  11% smaller
  crates/router/src/core/payments/tokenization.rs  8% smaller
  crates/router/src/core/payments/helpers.rs  2% smaller
  crates/router/src/core/payments/gateway/context.rs  2% smaller
  Cargo.lock Unsupported file format
  crates/external_services/Cargo.toml Unsupported file format
  crates/hyperswitch_domain_models/src/router_flow_types/access_token_auth.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/hyperswitch_interfaces/Cargo.toml Unsupported file format
  crates/router/Cargo.toml Unsupported file format
  crates/router/src/core/payments/flows.rs  0% smaller
  crates/router/src/core/payments/flows/approve_flow.rs  0% smaller
  crates/router/src/core/payments/flows/cancel_flow.rs  0% smaller
  crates/router/src/core/payments/flows/cancel_post_capture_flow.rs  0% smaller
  crates/router/src/core/payments/flows/capture_flow.rs  0% smaller
  crates/router/src/core/payments/flows/extend_authorization_flow.rs  0% smaller
  crates/router/src/core/payments/flows/incremental_authorization_flow.rs  0% smaller
  crates/router/src/core/payments/flows/post_session_tokens_flow.rs  0% smaller
  crates/router/src/core/payments/flows/psync_flow.rs  0% smaller
  crates/router/src/core/payments/flows/reject_flow.rs  0% smaller
  crates/router/src/core/payments/flows/session_update_flow.rs  0% smaller
  crates/router/src/core/payments/flows/update_metadata_flow.rs  0% smaller
  crates/router/src/core/payments/gateway/access_token_gateway.rs  0% smaller
  crates/router/src/core/payments/gateway/authorize_gateway.rs  0% smaller
  crates/router/src/core/payments/gateway/create_order_gateway.rs  0% smaller
  crates/router/src/core/payments/gateway/payment_method_token_create_gateway.rs  0% smaller
  crates/router/src/core/payments/gateway/session_token_gateway.rs  0% smaller
  crates/router/src/core/payments/vault_session.rs Unsupported file format
  crates/router/src/core/refunds_v2.rs Unsupported file format

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@19f3137). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10420   +/-   ##
=======================================
  Coverage        ?    9.14%           
=======================================
  Files           ?      186           
  Lines           ?    19386           
  Branches        ?        0           
=======================================
  Hits            ?     1773           
  Misses          ?    17613           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hrithikesh026 hrithikesh026 changed the title feat(core): Implement ucs granular flows feat: Implement UCS granular flows with gateway context refactoring Nov 25, 2025
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