feat(connector): add authorize, capture, void, refund, psync, rsync support for Dlocal connector (#650)

Co-authored-by: Venkatesh <inventvenkat@gmail.com>
This commit is contained in:
Arjun Karthik
2023-02-25 19:43:40 +05:30
committed by GitHub
parent 6a487b195b
commit 7792de55ef
17 changed files with 1635 additions and 8 deletions

View File

@ -14,7 +14,12 @@ pub mod validation;
/// Date-time utilities.
pub mod date_time {
use time::{Instant, OffsetDateTime, PrimitiveDateTime};
use std::num::NonZeroU8;
use time::{
format_description::well_known::iso8601::{Config, EncodedConfig, Iso8601, TimePrecision},
Instant, OffsetDateTime, PrimitiveDateTime,
};
/// Struct to represent milliseconds in time sensitive data fields
#[derive(Debug)]
pub struct Milliseconds(i32);
@ -43,6 +48,16 @@ pub mod date_time {
let result = block().await;
(result, start.elapsed().as_seconds_f64() * 1000f64)
}
/// 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
pub fn date_as_yyyymmddthhmmssmmmz() -> Result<String, time::error::Format> {
const ISO_CONFIG: EncodedConfig = Config::DEFAULT
.set_time_precision(TimePrecision::Second {
decimal_digits: NonZeroU8::new(3),
})
.encode();
now().assume_utc().format(&Iso8601::<ISO_CONFIG>)
}
}
/// Generate a nanoid with the given prefix and length