mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
feat(connector): [BANKOFAMERICA] Implement Apple Pay (#3061)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -28,7 +28,7 @@ use crate::{
|
||||
pii::PeekInterface,
|
||||
types::{
|
||||
self, api, storage::payment_attempt::PaymentAttemptExt, transformers::ForeignTryFrom,
|
||||
PaymentsCancelData, ResponseId,
|
||||
ApplePayPredecryptData, PaymentsCancelData, ResponseId,
|
||||
},
|
||||
utils::{OptionExt, ValueExt},
|
||||
};
|
||||
@ -855,6 +855,33 @@ impl ApplePay for payments::ApplePayWalletData {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ApplePayDecrypt {
|
||||
fn get_expiry_month(&self) -> Result<Secret<String>, Error>;
|
||||
fn get_four_digit_expiry_year(&self) -> Result<Secret<String>, Error>;
|
||||
}
|
||||
|
||||
impl ApplePayDecrypt for Box<ApplePayPredecryptData> {
|
||||
fn get_four_digit_expiry_year(&self) -> Result<Secret<String>, Error> {
|
||||
Ok(Secret::new(format!(
|
||||
"20{}",
|
||||
self.application_expiration_date
|
||||
.peek()
|
||||
.get(0..2)
|
||||
.ok_or(errors::ConnectorError::RequestEncodingFailed)?
|
||||
)))
|
||||
}
|
||||
|
||||
fn get_expiry_month(&self) -> Result<Secret<String>, Error> {
|
||||
Ok(Secret::new(
|
||||
self.application_expiration_date
|
||||
.peek()
|
||||
.get(2..4)
|
||||
.ok_or(errors::ConnectorError::RequestEncodingFailed)?
|
||||
.to_owned(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CryptoData {
|
||||
fn get_pay_currency(&self) -> Result<String, Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user