mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(payment_methods): fix merchant payment method list to retain a mca based on connector_name and mca_id (#6408)
This commit is contained in:
@ -1217,12 +1217,14 @@ pub struct ResponsePaymentMethodIntermediate {
|
|||||||
pub card_networks: Option<Vec<api_enums::CardNetwork>>,
|
pub card_networks: Option<Vec<api_enums::CardNetwork>>,
|
||||||
pub payment_method: api_enums::PaymentMethod,
|
pub payment_method: api_enums::PaymentMethod,
|
||||||
pub connector: String,
|
pub connector: String,
|
||||||
|
pub merchant_connector_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResponsePaymentMethodIntermediate {
|
impl ResponsePaymentMethodIntermediate {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
pm_type: RequestPaymentMethodTypes,
|
pm_type: RequestPaymentMethodTypes,
|
||||||
connector: String,
|
connector: String,
|
||||||
|
merchant_connector_id: String,
|
||||||
pm: api_enums::PaymentMethod,
|
pm: api_enums::PaymentMethod,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -1231,6 +1233,7 @@ impl ResponsePaymentMethodIntermediate {
|
|||||||
card_networks: pm_type.card_networks,
|
card_networks: pm_type.card_networks,
|
||||||
payment_method: pm,
|
payment_method: pm,
|
||||||
connector,
|
connector,
|
||||||
|
merchant_connector_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2980,6 +2980,7 @@ pub async fn list_payment_methods(
|
|||||||
api_enums::PaymentMethodType::ApplePay,
|
api_enums::PaymentMethodType::ApplePay,
|
||||||
api_enums::PaymentMethodType::Klarna,
|
api_enums::PaymentMethodType::Klarna,
|
||||||
api_enums::PaymentMethodType::Paypal,
|
api_enums::PaymentMethodType::Paypal,
|
||||||
|
api_enums::PaymentMethodType::SamsungPay,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let mut chosen = Vec::<api::SessionConnectorData>::new();
|
let mut chosen = Vec::<api::SessionConnectorData>::new();
|
||||||
@ -3031,6 +3032,15 @@ pub async fn list_payment_methods(
|
|||||||
.connector
|
.connector
|
||||||
.connector_name
|
.connector_name
|
||||||
.to_string()
|
.to_string()
|
||||||
|
&& first_routable_connector
|
||||||
|
.connector
|
||||||
|
.merchant_connector_id
|
||||||
|
.as_ref()
|
||||||
|
.map(|merchant_connector_id| {
|
||||||
|
*merchant_connector_id.get_string_repr()
|
||||||
|
== intermediate.merchant_connector_id
|
||||||
|
})
|
||||||
|
.unwrap_or_default()
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@ -4070,6 +4080,7 @@ pub async fn filter_payment_methods(
|
|||||||
let response_pm_type = ResponsePaymentMethodIntermediate::new(
|
let response_pm_type = ResponsePaymentMethodIntermediate::new(
|
||||||
payment_method_object,
|
payment_method_object,
|
||||||
connector.clone(),
|
connector.clone(),
|
||||||
|
mca_id.get_string_repr().to_string(),
|
||||||
payment_method,
|
payment_method,
|
||||||
);
|
);
|
||||||
resp.push(response_pm_type);
|
resp.push(response_pm_type);
|
||||||
|
|||||||
@ -5520,7 +5520,10 @@ where
|
|||||||
let routing_choice = choice
|
let routing_choice = choice
|
||||||
.first()
|
.first()
|
||||||
.ok_or(errors::ApiErrorResponse::InternalServerError)?;
|
.ok_or(errors::ApiErrorResponse::InternalServerError)?;
|
||||||
if connector_data.connector.connector_name == routing_choice.connector.connector_name {
|
if connector_data.connector.connector_name == routing_choice.connector.connector_name
|
||||||
|
&& connector_data.connector.merchant_connector_id
|
||||||
|
== routing_choice.connector.merchant_connector_id
|
||||||
|
{
|
||||||
final_list.push(connector_data);
|
final_list.push(connector_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user