feat(connector): [PowerTranz] Add cards support for PowerTranz connector (#1687)

Co-authored-by: Kritik Modi <61862301+kritikmodi@users.noreply.github.com>
This commit is contained in:
Arjun Karthik
2023-07-13 15:14:50 +05:30
committed by GitHub
parent c119bfdd7e
commit 07120bf422
14 changed files with 529 additions and 285 deletions

View File

@ -11,7 +11,7 @@ use common_utils::{
pii::{self, Email, IpAddress},
};
use error_stack::{report, IntoReport, ResultExt};
use masking::Secret;
use masking::{ExposeInterface, Secret};
use once_cell::sync::Lazy;
use regex::Regex;
use serde::Serializer;
@ -514,6 +514,7 @@ pub trait CardData {
) -> Secret<String>;
fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String>;
fn get_expiry_year_4_digit(&self) -> Secret<String>;
fn get_expiry_date_as_yymm(&self) -> Secret<String>;
}
impl CardData for api::Card {
@ -553,6 +554,11 @@ impl CardData for api::Card {
}
Secret::new(year)
}
fn get_expiry_date_as_yymm(&self) -> Secret<String> {
let year = self.get_card_expiry_year_2_digit().expose();
let month = self.card_exp_month.clone().expose();
Secret::new(format!("{year}{month}"))
}
}
#[track_caller]