mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
fix(connector): [Paypal] Parse response for Cards with no 3DS check (#3021)
This commit is contained in:
@ -570,23 +570,26 @@ impl
|
|||||||
.parse_struct("paypal PaypalPreProcessingResponse")
|
.parse_struct("paypal PaypalPreProcessingResponse")
|
||||||
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
|
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
|
||||||
|
|
||||||
|
match response {
|
||||||
|
// if card supports 3DS check for liability
|
||||||
|
paypal::PaypalPreProcessingResponse::PaypalLiabilityResponse(liability_response) => {
|
||||||
// permutation for status to continue payment
|
// permutation for status to continue payment
|
||||||
match (
|
match (
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
.three_d_secure
|
.three_d_secure
|
||||||
.enrollment_status
|
.enrollment_status
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
.three_d_secure
|
.three_d_secure
|
||||||
.authentication_status
|
.authentication_status
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
@ -628,19 +631,19 @@ impl
|
|||||||
connector_transaction_id: None,
|
connector_transaction_id: None,
|
||||||
reason: Some(format!("{} Connector Responsded with LiabilityShift: {:?}, EnrollmentStatus: {:?}, and AuthenticationStatus: {:?}",
|
reason: Some(format!("{} Connector Responsded with LiabilityShift: {:?}, EnrollmentStatus: {:?}, and AuthenticationStatus: {:?}",
|
||||||
consts::CANNOT_CONTINUE_AUTH,
|
consts::CANNOT_CONTINUE_AUTH,
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
.liability_shift,
|
.liability_shift,
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
.three_d_secure
|
.three_d_secure
|
||||||
.enrollment_status
|
.enrollment_status
|
||||||
.unwrap_or(paypal::EnrollementStatus::Null),
|
.unwrap_or(paypal::EnrollementStatus::Null),
|
||||||
response
|
liability_response
|
||||||
.payment_source
|
.payment_source
|
||||||
.card
|
.card
|
||||||
.authentication_result
|
.authentication_result
|
||||||
@ -654,6 +657,24 @@ impl
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if card does not supports 3DS check for liability
|
||||||
|
paypal::PaypalPreProcessingResponse::PaypalNonLiablityResponse(_) => {
|
||||||
|
Ok(types::PaymentsPreProcessingRouterData {
|
||||||
|
status: storage_enums::AttemptStatus::AuthenticationSuccessful,
|
||||||
|
response: Ok(types::PaymentsResponseData::TransactionResponse {
|
||||||
|
resource_id: types::ResponseId::NoResponseId,
|
||||||
|
redirection_data: None,
|
||||||
|
mandate_reference: None,
|
||||||
|
connector_metadata: None,
|
||||||
|
network_txn_id: None,
|
||||||
|
connector_response_reference_id: None,
|
||||||
|
incremental_authorization_allowed: None,
|
||||||
|
}),
|
||||||
|
..data.clone()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn get_error_response(
|
fn get_error_response(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@ -926,10 +926,22 @@ pub struct PaypalThreeDsResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct PaypalPreProcessingResponse {
|
#[serde(untagged)]
|
||||||
|
pub enum PaypalPreProcessingResponse {
|
||||||
|
PaypalLiabilityResponse(PaypalLiabilityResponse),
|
||||||
|
PaypalNonLiablityResponse(PaypalNonLiablityResponse),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct PaypalLiabilityResponse {
|
||||||
pub payment_source: CardParams,
|
pub payment_source: CardParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct PaypalNonLiablityResponse {
|
||||||
|
payment_source: CardsData,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct CardParams {
|
pub struct CardParams {
|
||||||
pub card: AuthResult,
|
pub card: AuthResult,
|
||||||
|
|||||||
Reference in New Issue
Block a user