fix(connector): [Bluesnap] Throw proper error message for redirection scenario (#1367)

Signed-off-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com>
Co-authored-by: Prasunna Soppa <prasunna.soppa@juspay.in>
This commit is contained in:
chikke srujan
2023-06-09 19:38:28 +05:30
committed by GitHub
parent 86f679abc1
commit 4a8de7741d
11 changed files with 192 additions and 92 deletions

View File

@ -429,6 +429,7 @@ pub trait CardData {
delimiter: String,
) -> Secret<String>;
fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String>;
fn get_expiry_year_4_digit(&self) -> Secret<String>;
}
impl CardData for api::Card {
@ -453,17 +454,21 @@ impl CardData for api::Card {
))
}
fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
let mut x = self.card_exp_year.peek().clone();
if x.len() == 2 {
x = format!("20{}", x);
}
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
x,
year.peek(),
delimiter,
self.card_exp_month.peek().clone()
))
}
fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.card_exp_year.peek().clone();
if year.len() == 2 {
year = format!("20{}", year);
}
Secret::new(year)
}
}
#[track_caller]