mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	fix(connector): [Rapyd] Fix payment response structure (#1258)
This commit is contained in:
		| @ -180,10 +180,14 @@ impl ForeignFrom<(RapydPaymentStatus, NextAction)> for enums::AttemptStatus { | |||||||
|         let (status, next_action) = item; |         let (status, next_action) = item; | ||||||
|         match (status, next_action) { |         match (status, next_action) { | ||||||
|             (RapydPaymentStatus::Closed, _) => Self::Charged, |             (RapydPaymentStatus::Closed, _) => Self::Charged, | ||||||
|             (RapydPaymentStatus::Active, NextAction::ThreedsVerification) => { |             ( | ||||||
|                 Self::AuthenticationPending |                 RapydPaymentStatus::Active, | ||||||
|             } |                 NextAction::ThreedsVerification | NextAction::PendingConfirmation, | ||||||
|             (RapydPaymentStatus::Active, NextAction::PendingCapture) => Self::Authorized, |             ) => Self::AuthenticationPending, | ||||||
|  |             ( | ||||||
|  |                 RapydPaymentStatus::Active, | ||||||
|  |                 NextAction::PendingCapture | NextAction::NotApplicable, | ||||||
|  |             ) => Self::Authorized, | ||||||
|             ( |             ( | ||||||
|                 RapydPaymentStatus::CanceledByClientOrBank |                 RapydPaymentStatus::CanceledByClientOrBank | ||||||
|                 | RapydPaymentStatus::Expired |                 | RapydPaymentStatus::Expired | ||||||
| @ -217,6 +221,10 @@ pub enum NextAction { | |||||||
|     ThreedsVerification, |     ThreedsVerification, | ||||||
|     #[serde(rename = "pending_capture")] |     #[serde(rename = "pending_capture")] | ||||||
|     PendingCapture, |     PendingCapture, | ||||||
|  |     #[serde(rename = "not_applicable")] | ||||||
|  |     NotApplicable, | ||||||
|  |     #[serde(rename = "pending_confirmation")] | ||||||
|  |     PendingConfirmation, | ||||||
| } | } | ||||||
|  |  | ||||||
| #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||||||
| @ -225,7 +233,7 @@ pub struct ResponseData { | |||||||
|     pub amount: i64, |     pub amount: i64, | ||||||
|     pub status: RapydPaymentStatus, |     pub status: RapydPaymentStatus, | ||||||
|     pub next_action: NextAction, |     pub next_action: NextAction, | ||||||
|     pub redirect_url: Option<Url>, |     pub redirect_url: Option<String>, | ||||||
|     pub original_amount: Option<i64>, |     pub original_amount: Option<i64>, | ||||||
|     pub is_partial: Option<bool>, |     pub is_partial: Option<bool>, | ||||||
|     pub currency_code: Option<enums::Currency>, |     pub currency_code: Option<enums::Currency>, | ||||||
| @ -387,12 +395,20 @@ impl<F, T> | |||||||
|                         }), |                         }), | ||||||
|                     ), |                     ), | ||||||
|                     _ => { |                     _ => { | ||||||
|                         let redirection_data = data.redirect_url.as_ref().map(|redirect_url| { |                         let redirction_url = data | ||||||
|                             services::RedirectForm::from(( |                             .redirect_url | ||||||
|                                 redirect_url.to_owned(), |                             .as_ref() | ||||||
|                                 services::Method::Get, |                             .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, |                             attempt_status, | ||||||
|                             Ok(types::PaymentsResponseData::TransactionResponse { |                             Ok(types::PaymentsResponseData::TransactionResponse { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shankar Singh C
					Shankar Singh C