mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor: pass customer object to make_pm_data (#3246)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -52,6 +52,7 @@ use crate::{
|
||||
storage,
|
||||
transformers::ForeignTryFrom,
|
||||
},
|
||||
utils::ext_traits::OptionExt,
|
||||
};
|
||||
|
||||
pub async fn create_link_token(
|
||||
@ -618,6 +619,7 @@ pub async fn retrieve_payment_method_from_auth_service(
|
||||
key_store: &domain::MerchantKeyStore,
|
||||
auth_token: &payment_methods::BankAccountConnectorDetails,
|
||||
payment_intent: &PaymentIntent,
|
||||
customer: &Option<domain::Customer>,
|
||||
) -> RouterResult<Option<(PaymentMethodData, enums::PaymentMethod)>> {
|
||||
let db = state.store.as_ref();
|
||||
|
||||
@ -710,10 +712,17 @@ pub async fn retrieve_payment_method_from_auth_service(
|
||||
last_name,
|
||||
}
|
||||
});
|
||||
|
||||
let email = customer
|
||||
.as_ref()
|
||||
.and_then(|customer| customer.email.clone())
|
||||
.map(common_utils::pii::Email::from)
|
||||
.get_required_value("email")?;
|
||||
|
||||
let payment_method_data = PaymentMethodData::BankDebit(BankDebitData::AchBankDebit {
|
||||
billing_details: BankDebitBilling {
|
||||
name: name.unwrap_or_default(),
|
||||
email: common_utils::pii::Email::from(masking::Secret::new("".to_string())),
|
||||
email,
|
||||
address: address_details,
|
||||
},
|
||||
account_number: masking::Secret::new(bank_account.account_number.clone()),
|
||||
|
||||
Reference in New Issue
Block a user