diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index e9aae53c9c..b9496a8cb7 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -125,7 +125,7 @@ impl From for payments::Address { pub struct StripePaymentIntentRequest { pub id: Option, pub amount: Option, //amount in cents, hence passed as integer - pub connector: Option>, + pub connector: Option>, pub currency: Option, #[serde(rename = "amount_to_capture")] pub amount_capturable: Option, @@ -169,10 +169,22 @@ impl TryFrom for payments::PaymentsRequest { } None => (None, None), }; + + let routable_connector: Option = + item.connector.and_then(|v| v.into_iter().next()); + + let routing = routable_connector + .map(crate::types::api::RoutingAlgorithm::Single) + .map(|r| { + serde_json::to_value(r) + .into_report() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("converting to routing failed") + }) + .transpose()?; let request = Ok(Self { payment_id: item.id.map(payments::PaymentIdType::PaymentIntentId), amount: item.amount.map(|amount| amount.into()), - connector: item.connector, currency: item .currency .as_ref() @@ -215,6 +227,7 @@ impl TryFrom for payments::PaymentsRequest { setup_future_usage: item.setup_future_usage, mandate_id: item.mandate_id, off_session: item.off_session, + routing, ..Self::default() }); request