mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-04 05:59:48 +08:00
refactor(session_token): add support for business filtering in payments session (#1128)
This commit is contained in:
@ -43,6 +43,25 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
pub fn filter_mca_based_on_business_details(
|
||||
merchant_connector_accounts: Vec<
|
||||
storage_models::merchant_connector_account::MerchantConnectorAccount,
|
||||
>,
|
||||
payment_intent: Option<&storage_models::payment_intent::PaymentIntent>,
|
||||
) -> Vec<storage_models::merchant_connector_account::MerchantConnectorAccount> {
|
||||
if let Some(payment_intent) = payment_intent {
|
||||
merchant_connector_accounts
|
||||
.into_iter()
|
||||
.filter(|mca| {
|
||||
mca.business_country == payment_intent.business_country
|
||||
&& mca.business_label == payment_intent.business_label
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
merchant_connector_accounts
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_address_for_payment_request(
|
||||
db: &dyn StorageInterface,
|
||||
req_address: Option<&api::Address>,
|
||||
|
||||
Reference in New Issue
Block a user