Skip to content

Commit 698a0aa

Browse files
fix(connector): [Authorizedotnet] fix deserialization error for Paypal while canceling payment (#7141)
1 parent 1900959 commit 698a0aa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/router/src/connector/authorizedotnet/transformers.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,13 +1872,13 @@ pub struct PaypalPaymentConfirm {
18721872
#[derive(Debug, Serialize, Deserialize)]
18731873
pub struct Paypal {
18741874
#[serde(rename = "payerID")]
1875-
payer_id: Secret<String>,
1875+
payer_id: Option<Secret<String>>,
18761876
}
18771877

18781878
#[derive(Debug, Serialize, Deserialize)]
18791879
pub struct PaypalQueryParams {
18801880
#[serde(rename = "PayerID")]
1881-
payer_id: Secret<String>,
1881+
payer_id: Option<Secret<String>>,
18821882
}
18831883

18841884
impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
@@ -1895,10 +1895,13 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsCompleteAuthorizeRouterD
18951895
.as_ref()
18961896
.and_then(|redirect_response| redirect_response.params.as_ref())
18971897
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
1898-
let payer_id: Secret<String> =
1899-
serde_urlencoded::from_str::<PaypalQueryParams>(params.peek())
1900-
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?
1901-
.payer_id;
1898+
1899+
let query_params: PaypalQueryParams = serde_urlencoded::from_str(params.peek())
1900+
.change_context(errors::ConnectorError::ResponseDeserializationFailed)
1901+
.attach_printable("Failed to parse connector response")?;
1902+
1903+
let payer_id = query_params.payer_id;
1904+
19021905
let transaction_type = match item.router_data.request.capture_method {
19031906
Some(enums::CaptureMethod::Manual) => Ok(TransactionType::ContinueAuthorization),
19041907
Some(enums::CaptureMethod::SequentialAutomatic)

0 commit comments

Comments
 (0)