feat(connector): [Trustpay] add authorize (cards 3ds, no3ds and bank redirects), refund, psync, rsync (#717)

Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in>
Co-authored-by: sai harsha <sai.harsha@sai.harsha-MacBookPro>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
saiharsha-juspay
2023-03-13 17:23:39 +05:30
committed by GitHub
parent 230fcdd4e1
commit e102cae76c
18 changed files with 2002 additions and 11 deletions

View File

@ -222,6 +222,7 @@ pub enum CardIssuer {
pub trait CardData {
fn get_card_expiry_year_2_digit(&self) -> Secret<String>;
fn get_card_issuer(&self) -> Result<CardIssuer, Error>;
fn get_card_expiry_month_year_2_digit_with_delimiter(&self, delimiter: String) -> String;
}
impl CardData for api::Card {
@ -237,6 +238,15 @@ impl CardData for api::Card {
.map(|card| card.split_whitespace().collect());
get_card_issuer(card.peek().clone().as_str())
}
fn get_card_expiry_month_year_2_digit_with_delimiter(&self, delimiter: String) -> String {
let year = self.get_card_expiry_year_2_digit();
format!(
"{}{}{}",
self.card_exp_month.peek().clone(),
delimiter,
year.peek()
)
}
}
fn get_card_issuer(card_number: &str) -> Result<CardIssuer, Error> {