mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
fix(samsung_pay): add payment_method_type duplication check (#7337)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1651,6 +1651,12 @@ pub enum PaymentMethodType {
|
|||||||
DirectCarrierBilling,
|
DirectCarrierBilling,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PaymentMethodType {
|
||||||
|
pub fn should_check_for_customer_saved_payment_method_type(self) -> bool {
|
||||||
|
matches!(self, Self::ApplePay | Self::GooglePay | Self::SamsungPay)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl masking::SerializableSecret for PaymentMethodType {}
|
impl masking::SerializableSecret for PaymentMethodType {}
|
||||||
|
|
||||||
/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.
|
/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.
|
||||||
|
|||||||
@ -591,10 +591,13 @@ pub async fn get_token_pm_type_mandate_details(
|
|||||||
mandate_generic_data.mandate_connector,
|
mandate_generic_data.mandate_connector,
|
||||||
mandate_generic_data.payment_method_info,
|
mandate_generic_data.payment_method_info,
|
||||||
)
|
)
|
||||||
} else if request.payment_method_type
|
} else if request
|
||||||
== Some(api_models::enums::PaymentMethodType::ApplePay)
|
.payment_method_type
|
||||||
|| request.payment_method_type
|
.map(|payment_method_type_value| {
|
||||||
== Some(api_models::enums::PaymentMethodType::GooglePay)
|
payment_method_type_value
|
||||||
|
.should_check_for_customer_saved_payment_method_type()
|
||||||
|
})
|
||||||
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
let payment_request_customer_id = request.get_customer_id();
|
let payment_request_customer_id = request.get_customer_id();
|
||||||
if let Some(customer_id) =
|
if let Some(customer_id) =
|
||||||
|
|||||||
@ -655,9 +655,11 @@ where
|
|||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
let customer_saved_pm_option = if payment_method_type
|
let customer_saved_pm_option = if payment_method_type
|
||||||
== Some(api_models::enums::PaymentMethodType::ApplePay)
|
.map(|payment_method_type_value| {
|
||||||
|| payment_method_type
|
payment_method_type_value
|
||||||
== Some(api_models::enums::PaymentMethodType::GooglePay)
|
.should_check_for_customer_saved_payment_method_type()
|
||||||
|
})
|
||||||
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
match state
|
match state
|
||||||
.store
|
.store
|
||||||
|
|||||||
Reference in New Issue
Block a user