fix: cybersource mandates and fiserv exp year (#2920)

Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
This commit is contained in:
SamraatBansal
2023-11-22 00:35:40 +05:30
committed by GitHub
parent a701db70ca
commit 7f74ae98a1
5 changed files with 427 additions and 126 deletions

View File

@ -322,6 +322,7 @@ impl PaymentsCaptureRequestData for types::PaymentsCaptureData {
pub trait PaymentsSetupMandateRequestData {
fn get_browser_info(&self) -> Result<types::BrowserInformation, Error>;
fn get_email(&self) -> Result<Email, Error>;
}
impl PaymentsSetupMandateRequestData for types::SetupMandateRequestData {
@ -330,6 +331,9 @@ impl PaymentsSetupMandateRequestData for types::SetupMandateRequestData {
.clone()
.ok_or_else(missing_field_err("browser_info"))
}
fn get_email(&self) -> Result<Email, Error> {
self.email.clone().ok_or_else(missing_field_err("email"))
}
}
pub trait PaymentsAuthorizeRequestData {
fn is_auto_capture(&self) -> Result<bool, Error>;
@ -869,6 +873,7 @@ impl CryptoData for api::CryptoData {
pub trait PhoneDetailsData {
fn get_number(&self) -> Result<Secret<String>, Error>;
fn get_country_code(&self) -> Result<String, Error>;
fn get_number_with_country_code(&self) -> Result<Secret<String>, Error>;
}
impl PhoneDetailsData for api::PhoneDetails {
@ -882,6 +887,11 @@ impl PhoneDetailsData for api::PhoneDetails {
.clone()
.ok_or_else(missing_field_err("billing.phone.number"))
}
fn get_number_with_country_code(&self) -> Result<Secret<String>, Error> {
let number = self.get_number()?;
let country_code = self.get_country_code()?;
Ok(Secret::new(format!("{}{}", country_code, number.peek())))
}
}
pub trait AddressDetailsData {