Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(compatibility): map connector to routing in payments request for backward compatibility (#1339)
Abhishek Marrivagu166688a5906a
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rsindex 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<Shipping> for payments::Address {pub struct StripePaymentIntentRequest {pub id: Option<String>,pub amount: Option<i64>, //amount in cents, hence passed as integer- pub connector: Option<Vec<api_enums::Connector>>,+ pub connector: Option<Vec<api_enums::RoutableConnectors>>,pub currency: Option<String>,#[serde(rename = "amount_to_capture")]pub amount_capturable: Option<i64>,@@ -169,10 +169,22 @@ impl TryFrom<StripePaymentIntentRequest> for payments::PaymentsRequest {}None => (None, None),};++ let routable_connector: Option<api_enums::RoutableConnectors> =+ 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<StripePaymentIntentRequest> for payments::PaymentsRequest {setup_future_usage: item.setup_future_usage,mandate_id: item.mandate_id,off_session: item.off_session,+ routing,..Self::default()});request