From 62a09ccbfb73431fd36650e78957beb5fe2514fa Mon Sep 17 00:00:00 2001 From: AkshayaFoiger Date: Wed, 17 Apr 2024 20:07:06 +0530 Subject: [PATCH] make payment instrument optional --- .../router/src/connector/bankofamerica/transformers.rs | 10 +++++++--- .../router/src/connector/cybersource/transformers.rs | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs index d8a5f8af73a7..5eca31278a8b 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/router/src/connector/bankofamerica/transformers.rs @@ -363,7 +363,9 @@ impl BankOfAmericaSetupMandatesResponse::ClientReferenceInformation(info_response) => { let mandate_reference = info_response.token_information.clone().map(|token_info| { types::MandateReference { - connector_mandate_id: Some(token_info.payment_instrument.id.expose()), + connector_mandate_id: token_info + .payment_instrument + .map(|payment_instrument| payment_instrument.id.expose()), payment_method_id: None, } }); @@ -1274,7 +1276,7 @@ pub struct BankOfAmericaClientReferenceResponse { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct BankOfAmericaTokenInformation { - payment_instrument: BankOfAmericaPaymentInstrument, + payment_instrument: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1374,7 +1376,9 @@ fn get_payment_response( .token_information .clone() .map(|token_info| types::MandateReference { - connector_mandate_id: Some(token_info.payment_instrument.id.expose()), + connector_mandate_id: token_info + .payment_instrument + .map(|payment_instrument| payment_instrument.id.expose()), payment_method_id: None, }); diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 14e2ba76c096..338048b87835 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -1653,7 +1653,7 @@ pub struct ClientRiskInformationRules { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CybersourceTokenInformation { - payment_instrument: CybersoucrePaymentInstrument, + payment_instrument: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] @@ -1748,7 +1748,9 @@ fn get_payment_response( .token_information .clone() .map(|token_info| types::MandateReference { - connector_mandate_id: Some(token_info.payment_instrument.id.expose()), + connector_mandate_id: token_info + .payment_instrument + .map(|payment_instrument| payment_instrument.id.expose()), payment_method_id: None, }); Ok(types::PaymentsResponseData::TransactionResponse { @@ -2397,7 +2399,9 @@ impl CybersourceSetupMandatesResponse::ClientReferenceInformation(info_response) => { let mandate_reference = info_response.token_information.clone().map(|token_info| { types::MandateReference { - connector_mandate_id: Some(token_info.payment_instrument.id.expose()), + connector_mandate_id: token_info + .payment_instrument + .map(|payment_instrument| payment_instrument.id.expose()), payment_method_id: None, } });