feat(connector): add authorize, capture, void, psync, refund, rsync for PayPal connector (#747)

Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
Prasunna Soppa
2023-04-06 19:06:43 +05:30
committed by GitHub
parent f26a632cdb
commit 36049c1341
19 changed files with 2190 additions and 38 deletions

View File

@ -247,7 +247,11 @@ 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;
fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,
delimiter: String,
) -> Secret<String>;
fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String>;
}
impl CardData for api::Card {
@ -263,14 +267,29 @@ 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 {
fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,
delimiter: String,
) -> Secret<String> {
let year = self.get_card_expiry_year_2_digit();
format!(
Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek().clone(),
delimiter,
year.peek()
)
))
}
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);
}
Secret::new(format!(
"{}{}{}",
x,
delimiter,
self.card_exp_month.peek().clone()
))
}
}