mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
pub use common_utils::{collect_missing_value_keys, newtype};
|
|
|
|
#[macro_export]
|
|
macro_rules! get_formatted_date_time {
|
|
($date_format:tt) => {{
|
|
let format = time::macros::format_description!($date_format);
|
|
time::OffsetDateTime::now_utc()
|
|
.format(&format)
|
|
.change_context($crate::core::errors::ConnectorError::InvalidDateFormat)
|
|
}};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! get_payment_link_config_value_based_on_priority {
|
|
($config:expr, $business_config:expr, $field:ident, $default:expr) => {
|
|
$config
|
|
.as_ref()
|
|
.and_then(|pc_config| pc_config.theme_config.$field.clone())
|
|
.or_else(|| {
|
|
$business_config
|
|
.as_ref()
|
|
.and_then(|business_config| business_config.$field.clone())
|
|
})
|
|
.unwrap_or($default)
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! get_payment_link_config_value {
|
|
($config:expr, $business_config:expr, $(($field:ident, $default:expr)),*) => {
|
|
(
|
|
$(get_payment_link_config_value_based_on_priority!($config, $business_config, $field, $default)),*
|
|
)
|
|
};
|
|
}
|