mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
feat(connector): Add support for complete authorize payment after 3DS redirection (#741)
This commit is contained in:
@ -49,26 +49,10 @@ pub mod date_time {
|
||||
(result, start.elapsed().as_seconds_f64() * 1000f64)
|
||||
}
|
||||
|
||||
/// Prefix the date field with zero if it has single digit Eg: 1 -> 01
|
||||
fn prefix_zero(input: u8) -> String {
|
||||
if input < 10 {
|
||||
return "0".to_owned() + input.to_string().as_str();
|
||||
}
|
||||
input.to_string()
|
||||
}
|
||||
|
||||
/// Return the current date and time in UTC with the format YYYYMMDDHHmmss Eg: 20191105081132
|
||||
pub fn date_as_yyyymmddhhmmss() -> String {
|
||||
let now = OffsetDateTime::now_utc();
|
||||
format!(
|
||||
"{}{}{}{}{}{}",
|
||||
now.year(),
|
||||
prefix_zero(u8::from(now.month())),
|
||||
prefix_zero(now.day()),
|
||||
prefix_zero(now.hour()),
|
||||
prefix_zero(now.minute()),
|
||||
prefix_zero(now.second())
|
||||
)
|
||||
pub fn date_as_yyyymmddhhmmss() -> Result<String, time::error::Format> {
|
||||
let format = time::macros::format_description!("[year repr:full][month padding:zero repr:numerical][day padding:zero][hour padding:zero repr:24][minute padding:zero][second padding:zero]");
|
||||
now().format(&format)
|
||||
}
|
||||
|
||||
/// Return the current date and time in UTC with the format [year]-[month]-[day]T[hour]:[minute]:[second].mmmZ Eg: 2023-02-15T13:33:18.898Z
|
||||
|
||||
Reference in New Issue
Block a user