-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(core): Hyperswitch <|> UCS integration v2 #8439
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
Conversation
Changed Files
|
/// Optional API key used for authentication. | ||
pub api_key: Option<String>, | ||
|
||
/// Optional additional key used by some authentication types. | ||
pub key1: Option<String>, | ||
|
||
/// Optional API secret used for signature or secure authentication. | ||
pub api_secret: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields would have to be Secret
.
config/development.toml
Outdated
@@ -200,7 +200,7 @@ outgoing_enabled = true | |||
redis_lock_expiry_seconds = 180 # 3 * 60 seconds | |||
|
|||
[merchant_id_auth] | |||
merchant_id_auth_enabled = false | |||
merchant_id_auth_enabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert this change?
crates/external_services/src/lib.rs
Outdated
/// Header key used to specify the connector name in UCS requests. | ||
pub const UCS_HEADER_CONNECTOR: &str = "x-connector"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we make the constants only used in this crate to be pub(crate)
?
crates/router/src/core/payments.rs
Outdated
#[cfg(feature = "frm")] | ||
None, | ||
#[cfg(not(feature = "frm"))] | ||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We can just pass None
always, without the feature gates.
#[cfg(feature = "frm")] | |
None, | |
#[cfg(not(feature = "frm"))] | |
None, | |
None, |
crates/router/src/core/payments.rs
Outdated
#[cfg(feature = "frm")] | ||
None, | ||
#[cfg(not(feature = "frm"))] | ||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
- refactored Order creation flow in authorize_flow
_ => { | ||
return Err(UnifiedConnectorServiceError::NotImplemented(format!( | ||
"Unimplemented card payment method type: {:?}", | ||
payment_method_type | ||
)) | ||
.into()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Why does the error message say "card payment method type"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I will change it to "Unimplemented card type: {:?}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is not a card payment method at all right, we were matching against UPI data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah bro based on payment_method_type we are creating the pm data
So it has both cards and upi for now and will extend further
#[allow(clippy::too_many_arguments)] | ||
#[allow(clippy::type_complexity)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You can combine these two lines.
#[allow(clippy::too_many_arguments)] | |
#[allow(clippy::type_complexity)] | |
#[allow(clippy::too_many_arguments, clippy::type_complexity)] |
…ayload-webhooks * 'main' of github.com:juspay/hyperswitch: feat(payments): propagate additional payment method data for apple pay during MIT (#7170) feat(core): Hyperswitch <|> UCS integration v2 (#8439) feat(connector): [payload] add webhook support (#8558) ci(cypress): Added Dlocal Connector Test (#8362) feat(connector): [AIRWALLEX] - Added Paypal, Trustly, Klarna , Atome, Blik Payment Methods (#8475) refactor(cypress): update skip logic and test flow for cypress incremental auth tests (#8594) chore(version): 2025.07.11.0 chore: address Rust 1.88.0 clippy lints (#8607) chore(version): 2025.07.10.0
Type of Change
Fixes #8440
Description
This PR implements V2 UCS (Unified Connector Service) Integration for authorization and synchronization flows, building upon the existing V1 UCS integration (PR#8280), with enhanced
V2 schema support according to updated gRPC contract.
Key Features Implemented:
Key Changes from V1 to V2:
Updated gRPC Schema:
PaymentsAuthorizeRequest
toPaymentServiceAuthorizeRequest
PaymentServiceGetRequest
for PSync flowNew Payment Methods:
Enhanced Transformers:
V2 Flow Architecture:
Improved Response Handling:
V2 Architecture Flow:
V2 Payment Request → call_connector_service_prerequisites() → decide_unified_connector_service_call() →
├── UCS Available → V2 Transformers → gRPC Call → V2 Response Handling
└── UCS Unavailable → Traditional Connector Flow (Fallback)
V2 PSync Request → call_unified_connector_service() →
├── UCS Available → V2 PSync Transformer → gRPC Get Call → Status Response
└── UCS Unavailable → Traditional Connector Sync Flow
Key Technical Improvements:
call_connector_service()
intocall_connector_service_prerequisites()
anddecide_unified_connector_service_call()
for better separation of concernsFiles Modified:
crates/router/Cargo.toml
- Updated rust-grpc-client dependency to main branchcrates/router/src/core/payments.rs
- Refactored UCS integration with V2 prerequisite and decision functionscrates/router/src/core/payments/flows/authorize_flow.rs
- Updated to usePaymentServiceAuthorizeRequest
crates/router/src/core/payments/flows/psync_flow.rs
- Added UCS V2 support for payment synchronizationcrates/router/src/core/payments/transformers.rs
- Added V2 PaymentsAuthorizeData transformer implementation and customer_id supportcrates/router/src/core/unified_connector_service/
- Updated transformers and response handlers for V2 schemacrates/router/src/core/unified_connector_service.rs
- Added UPI payment method support and enhanced response handlingcrates/router/src/core/unified_connector_service/transformers.rs
- Major updates for V2 gRPC schema compatibilitycrates/external_services/src/grpc_client/unified_connector_service.rs
- Added payment get operations supportAdditional Changes
Motivation and Context
V2 UCS Integration Evolution:
This change builds upon the existing V1 UCS integration to support the updated V2 gRPC schema and enhanced payment flow architecture. Key motivations:
Schema Evolution:
Feature Additions:
Architectural Improvements:
#[cfg(feature = "v2")]
prevents conflictsBusiness Value:
How did you test it?
Manual Testing (HAPPY CASE)
V2 Payment Intent Creation (Adyen via UCS)
Request:
Response:
V2 Payment Confirmation (Adyen via UCS)
Request:
Response:
V2 Payment Intent Creation (Adyen via Traditional Connector Flow)
Request:
Response:
V2 Payment Confirmation (Adyen via Traditional Connector Flow)
Request:
Response:
Manual Testing (FAILURE CASE)
V2 Payment Intent Creation (Adyen via UCS)
Request:
Response:
V2 Payment Confirmation (Adyen via UCS)
Request:
Response:
V2 Payment Intent Creation (Adyen via Traditional Connector Flow)
Request:
Response:
V2 Payment Confirmation (Adyen via Traditional Connector Flow)
Request:
Response:
###UPI Collect payment through UCS
Request
Response
PSync through UCS
Request
V2 Schema Testing:
PaymentServiceAuthorizeRequest
field mapping validationFallback Testing:
Checklist
cargo +nightly fmt --all
cargo clippy