Skip to content

Commit

Permalink
refactor: fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
swangi-kumari committed May 10, 2024
1 parent 82313a2 commit 2d06023
Showing 1 changed file with 0 additions and 100 deletions.
100 changes: 0 additions & 100 deletions crates/router/src/connector/stripe/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,106 +1056,6 @@ impl From<&domain::BankDebitData> for StripePaymentMethodType {
}
}

impl TryFrom<(&domain::BankRedirectData, Option<bool>)> for StripeBillingAddress {
type Error = error_stack::Report<errors::ConnectorError>;

fn try_from(
(bank_redirection_data, is_customer_initiated_mandate_payment): (
&domain::BankRedirectData,
Option<bool>,
),
) -> Result<Self, Self::Error> {
match bank_redirection_data {
domain::BankRedirectData::Eps {
billing_details, ..
} => Ok({
let billing_data = billing_details.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "billing_details",
},
)?;
Self {
name: Some(BankRedirectBillingData::get_billing_name(&billing_data)?),
..Self::default()
}
}),
domain::BankRedirectData::Giropay {
billing_details, ..
} => Ok(Self {
name: Some(
billing_details
.clone()
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "giropay.billing_details",
})?
.get_billing_name()?,
),
..Self::default()
}),
domain::BankRedirectData::Ideal {
billing_details, ..
} => Ok(get_stripe_sepa_dd_mandate_billing_details(
billing_details,
is_customer_initiated_mandate_payment,
)?),
domain::BankRedirectData::Przelewy24 {
billing_details, ..
} => Ok(Self {
email: billing_details.email.clone(),
..Self::default()
}),
domain::BankRedirectData::BancontactCard {
billing_details, ..
} => {
let billing_details = billing_details.as_ref().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "billing_details",
},
)?;
Ok(Self {
name: Some(
billing_details
.billing_name
.as_ref()
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "billing_details.billing_name",
})?
.to_owned(),
),
email: Some(
billing_details
.email
.as_ref()
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "billing_details.email",
})?
.to_owned(),
),
..Self::default()
})
}
domain::BankRedirectData::Sofort {
billing_details, ..
} => Ok(get_stripe_sepa_dd_mandate_billing_details(
billing_details,
is_customer_initiated_mandate_payment,
)?),

domain::BankRedirectData::Bizum {}
| domain::BankRedirectData::Blik { .. }
| domain::BankRedirectData::Interac { .. }
| domain::BankRedirectData::OnlineBankingCzechRepublic { .. }
| domain::BankRedirectData::OnlineBankingFinland { .. }
| domain::BankRedirectData::OnlineBankingPoland { .. }
| domain::BankRedirectData::OnlineBankingSlovakia { .. }
| domain::BankRedirectData::Trustly { .. }
| domain::BankRedirectData::OnlineBankingFpx { .. }
| domain::BankRedirectData::OnlineBankingThailand { .. }
| domain::BankRedirectData::OpenBankingUk { .. } => Ok(Self::default()),
}
}
}

fn get_bank_debit_data(
bank_debit_data: &domain::BankDebitData,
) -> (StripePaymentMethodType, BankDebitData) {
Expand Down

0 comments on commit 2d06023

Please sign in to comment.