fix(connector): [Authorizedotnet] fix deserialization error for Paypal while canceling payment (#7141)

This commit is contained in:
Swangi Kumari
2025-02-05 19:08:18 +05:30
committed by GitHub
parent 1900959778
commit 698a0aa75a

View File

@ -1872,13 +1872,13 @@ pub struct PaypalPaymentConfirm {
#[derive(Debug, Serialize, Deserialize)]
pub struct Paypal {
#[serde(rename = "payerID")]
payer_id: Secret<String>,
payer_id: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PaypalQueryParams {
#[serde(rename = "PayerID")]
payer_id: Secret<String>,
payer_id: Option<Secret<String>>,
}
impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
@ -1895,10 +1895,13 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterD
.as_ref()
.and_then(|redirect_response| redirect_response.params.as_ref())
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
let payer_id: Secret<String> =
serde_urlencoded::from_str::<PaypalQueryParams>(params.peek())
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?
.payer_id;
let query_params: PaypalQueryParams = serde_urlencoded::from_str(params.peek())
.change_context(errors::ConnectorError::ResponseDeserializationFailed)
.attach_printable("Failed to parse connector response")?;
let payer_id = query_params.payer_id;
let transaction_type = match item.router_data.request.capture_method {
Some(enums::CaptureMethod::Manual) => Ok(TransactionType::ContinueAuthorization),
Some(enums::CaptureMethod::SequentialAutomatic)