diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rs index 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, + pub redirect_url: Option, pub original_amount: Option, pub is_partial: Option, pub currency_code: Option, @@ -387,12 +395,20 @@ impl }), ), _ => { - 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 {