Skip to content

Commit

Permalink
make payment instrument optional
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger committed Apr 17, 2024
1 parent 2a13180 commit 62a09cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions crates/router/src/connector/bankofamerica/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ impl<F, T>
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,
}
});
Expand Down Expand Up @@ -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<BankOfAmericaPaymentInstrument>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down Expand Up @@ -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,
});

Expand Down
10 changes: 7 additions & 3 deletions crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CybersoucrePaymentInstrument>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -2397,7 +2399,9 @@ impl<F, T>
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,
}
});
Expand Down

0 comments on commit 62a09cc

Please sign in to comment.