mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
refactor: add surcharge_applicable to payment_intent and remove surcharge_metadata from payment_attempt (#2642)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -345,6 +345,23 @@ pub struct SurchargeMetadata {
|
||||
pub surcharge_results: HashMap<String, SurchargeDetailsResponse>,
|
||||
}
|
||||
|
||||
impl SurchargeMetadata {
|
||||
pub fn get_key_for_surcharge_details_hash_map(
|
||||
payment_method: &common_enums::PaymentMethod,
|
||||
payment_method_type: &common_enums::PaymentMethodType,
|
||||
card_network: Option<&common_enums::CardNetwork>,
|
||||
) -> String {
|
||||
if let Some(card_network) = card_network {
|
||||
format!(
|
||||
"{}_{}_{}",
|
||||
payment_method, payment_method_type, card_network
|
||||
)
|
||||
} else {
|
||||
format!("{}_{}", payment_method, payment_method_type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case", tag = "type", content = "value")]
|
||||
pub enum Surcharge {
|
||||
|
||||
Reference in New Issue
Block a user