feat(connector): Add support for complete authorize payment after 3DS redirection (#741)

This commit is contained in:
Jagan
2023-03-15 14:18:17 +05:30
committed by GitHub
parent 4859b6e4f3
commit ec2b1b18fd
71 changed files with 1870 additions and 631 deletions

View File

@ -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