feat(core): Add Session flow support in Hyperswitch<>UCS tunnel#10552
feat(core): Add Session flow support in Hyperswitch<>UCS tunnel#10552likhinbopanna merged 8 commits intomainfrom
Conversation
Changed Files
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #10552 +/- ##
=======================================
Coverage ? 6.43%
=======================================
Files ? 1255
Lines ? 314377
Branches ? 0
=======================================
Hits ? 20216
Misses ? 294161
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
| } | ||
|
|
||
| impl transformers::ForeignTryFrom<common_enums::PaymentMethodType> |
There was a problem hiding this comment.
Don't we already have this conversion logic?
There was a problem hiding this comment.
No we dont have, we only have from HS payment_method_data to UCS payment_method.
And in this flow only payment_method_type information is required
crates/router/src/core/payments.rs
Outdated
| business_profile.get_id().clone(), | ||
| payment_data.get_creds_identifier().map(|id| id.to_string()), | ||
| ); | ||
| let res = match session_connector_data.connector.get_token { |
There was a problem hiding this comment.
why is this match statement needed?
There was a problem hiding this comment.
I used this match because for the other GetToken variants (except GetToken::Connector), we don’t trigger a connector call to create a session token. In those cases we don’t use execute_connector_processing_step, so routing them through the unified connector call path would end up causing unnecessary DB lookups inside the UCS decide flow.
There was a problem hiding this comment.
this logic is already handled in decide_flows of SessionFlow
There was a problem hiding this comment.
removed the match statement
| .and_then(|c| payments_grpc::CountryAlpha2::from_str_name(&c.to_string())) | ||
| .map(|country| country.into()); | ||
|
|
||
| let merchant_account_metadata = serde_json::to_string(&router_data.connector_meta_data) |
There was a problem hiding this comment.
map connector metadata with connector metadata
because then in future when someone will need this variable again we have to change the mapping
which problem is arising now.
There was a problem hiding this comment.
In HS connector_meta_data is the metadata provided in the MCA.
I think its correct only to call it merchant account metadata in UCS.
| }), | ||
| amount: router_data.request.amount, | ||
| currency: currency.into(), | ||
| minor_amount: router_data.request.amount, |
There was a problem hiding this comment.
In minor amount pass minor amount from the PaymentSessionData
873a2fd
9f27f71
Type of Change
Description
This PR adds Session flow (SDK session tokens) support for the Unified Connector Service (UCS) by implementing a new session_gateway and updating the connector service client.
Additional Changes
Motivation and Context
How did you test it?
Rollout key:
ucs_rollout_config_wallet_Session
Shadow Rollout key:
ucs_rollout_config_wallet_Session_shadow
Direct mode testing

Req payload
{"payment_id":"pay_DT2tAU0PaWACqu4kLaUi","client_secret":"pay_DT2tAU0PaWACqu4kLaUi_secret_yKYooiG5MEc2mdBqTxAG","wallets":[],"delayed_session_token":false}Response
{ "payment_id": "pay_DT2tAU0PaWACqu4kLaUi", "client_secret": "pay_DT2tAU0PaWACqu4kLaUi_secret_yKYooiG5MEc2mdBqTxAG", "session_token": [ { "wallet_name": "google_pay", "merchant_info": { "merchant_id": "abc", "merchant_name": "abc" }, "shipping_address_required": false, "email_required": false, "shipping_address_parameters": { "phone_number_required": false }, "allowed_payment_methods": [ { "type": "CARD", "parameters": { "allowed_auth_methods": [ "PAN_ONLY" ], "allowed_card_networks": [ "AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA" ], "billing_address_required": false }, "tokenization_specification": { "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:version": "2018-10-31", "stripe:publishableKey": "pk_test_51M7fTaD5R7gDAGffAofar8mp1iheEOKC3ZFXJcKdTCnWXBFgcxqOMt5zFCswSHP9zy1KzrjctJIQCYK1h7le3dAb00O0zVhQBY" } } } ], "transaction_info": { "country_code": "US", "currency_code": "USD", "total_price_status": "Final", "total_price": "65.00" }, "delayed_session_token": false, "connector": "stripe", "sdk_next_action": { "next_action": "confirm" }, "secrets": null }, { "wallet_name": "apple_pay", "payment_request_data": { "country_code": "US", "currency_code": "USD", "total": { "label": "ApplePay", "type": "final", "amount": "65.00" }, "merchant_capabilities": [ "supports3DS" ], "supported_networks": [ "visa", "masterCard", "amex", "discover" ], "merchant_identifier": "merchant.hyperswitch-ucs" }, "connector": "stripe", "delayed_session_token": false, "sdk_next_action": { "next_action": "confirm" }, "connector_reference_id": null, "connector_sdk_public_key": null, "connector_merchant_id": null } ] }Shadow mode testing.


Testes via HS<>UCS tunnel
Req
Routerdata
Checklist
cargo +nightly fmt --allcargo clippy