feat(payment_methods_v2): add payment methods list endpoint (#6938)

Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2025-01-13 15:07:19 +05:30
committed by GitHub
parent 1d993055d2
commit 6a1f5a8875
47 changed files with 1228 additions and 864 deletions

View File

@ -300,10 +300,13 @@ pub struct RoutingAlgorithmHelpers<'h> {
#[derive(Clone, Debug)]
pub struct ConnectNameAndMCAIdForProfile<'a>(
pub FxHashSet<(&'a String, id_type::MerchantConnectorAccountId)>,
pub FxHashSet<(
&'a common_enums::connector_enums::Connector,
id_type::MerchantConnectorAccountId,
)>,
);
#[derive(Clone, Debug)]
pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a String>);
pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a common_enums::connector_enums::Connector>);
#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
@ -368,23 +371,25 @@ impl RoutingAlgorithmHelpers<'_> {
choice: &routing_types::RoutableConnectorChoice,
) -> RouterResult<()> {
if let Some(ref mca_id) = choice.merchant_connector_id {
let connector_choice = common_enums::connector_enums::Connector::from(choice.connector);
error_stack::ensure!(
self.name_mca_id_set.0.contains(&(&choice.connector.to_string(), mca_id.clone())),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
"connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",
choice.connector,
mca_id,
)
}
);
self.name_mca_id_set.0.contains(&(&connector_choice, mca_id.clone())),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
"connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",
connector_choice,
mca_id,
)
}
);
} else {
let connector_choice = common_enums::connector_enums::Connector::from(choice.connector);
error_stack::ensure!(
self.name_set.0.contains(&choice.connector.to_string()),
self.name_set.0.contains(&connector_choice),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
"connector with name '{}' not found for the given profile",
choice.connector,
connector_choice,
)
}
);