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
fix(connector): [Rapyd] Fix payment response structure (#1258)
Shankar Singh C3af3a3cb3964
diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rsindex f112456ae5..e5e6df747c 100644--- a/crates/router/src/connector/rapyd/transformers.rs+++ b/crates/router/src/connector/rapyd/transformers.rs@@ -180,10 +180,14 @@ impl ForeignFrom<(RapydPaymentStatus, NextAction)> for enums::AttemptStatus {let (status, next_action) = item;match (status, next_action) {(RapydPaymentStatus::Closed, _) => Self::Charged,- (RapydPaymentStatus::Active, NextAction::ThreedsVerification) => {- Self::AuthenticationPending- }- (RapydPaymentStatus::Active, NextAction::PendingCapture) => Self::Authorized,+ (+ RapydPaymentStatus::Active,+ NextAction::ThreedsVerification | NextAction::PendingConfirmation,+ ) => Self::AuthenticationPending,+ (+ RapydPaymentStatus::Active,+ NextAction::PendingCapture | NextAction::NotApplicable,+ ) => Self::Authorized,(RapydPaymentStatus::CanceledByClientOrBank| RapydPaymentStatus::Expired@@ -217,6 +221,10 @@ pub enum NextAction {ThreedsVerification,#[serde(rename = "pending_capture")]PendingCapture,+ #[serde(rename = "not_applicable")]+ NotApplicable,+ #[serde(rename = "pending_confirmation")]+ PendingConfirmation,}#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]@@ -225,7 +233,7 @@ pub struct ResponseData {pub amount: i64,pub status: RapydPaymentStatus,pub next_action: NextAction,- pub redirect_url: Option<Url>,+ pub redirect_url: Option<String>,pub original_amount: Option<i64>,pub is_partial: Option<bool>,pub currency_code: Option<enums::Currency>,@@ -387,12 +395,20 @@ impl<F, T>}),),_ => {- let redirection_data = data.redirect_url.as_ref().map(|redirect_url| {- services::RedirectForm::from((- redirect_url.to_owned(),- services::Method::Get,- ))- });+ let redirction_url = data+ .redirect_url+ .as_ref()+ .filter(|redirect_str| !redirect_str.is_empty())+ .map(|url| {+ Url::parse(url).into_report().change_context(+ errors::ConnectorError::FailedToObtainIntegrationUrl,+ )+ })+ .transpose()?;++ let redirection_data = redirction_url+ .map(|url| services::RedirectForm::from((url, services::Method::Get)));+(attempt_status,Ok(types::PaymentsResponseData::TransactionResponse {