mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
fix(connector): [Worldpay] use 4 digit expiry year (#6543)
This commit is contained in:
@ -25,7 +25,7 @@ use super::{requests::*, response::*};
|
||||
use crate::{
|
||||
types::ResponseRouterData,
|
||||
utils::{
|
||||
self, AddressData, ForeignTryFrom, PaymentsAuthorizeRequestData,
|
||||
self, AddressData, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData,
|
||||
PaymentsSetupMandateRequestData, RouterData as RouterDataTrait,
|
||||
},
|
||||
};
|
||||
@ -77,8 +77,8 @@ fn fetch_payment_instrument(
|
||||
PaymentMethodData::Card(card) => Ok(PaymentInstrument::Card(CardPayment {
|
||||
payment_type: PaymentType::Plain,
|
||||
expiry_date: ExpiryDate {
|
||||
month: utils::CardData::get_expiry_month_as_i8(&card)?,
|
||||
year: utils::CardData::get_expiry_year_as_i32(&card)?,
|
||||
month: card.get_expiry_month_as_i8()?,
|
||||
year: card.get_expiry_year_as_4_digit_i32()?,
|
||||
},
|
||||
card_number: card.card_number,
|
||||
cvc: card.card_cvc,
|
||||
|
||||
@ -844,6 +844,7 @@ pub trait CardData {
|
||||
fn get_expiry_date_as_mmyy(&self) -> Result<Secret<String>, errors::ConnectorError>;
|
||||
fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error>;
|
||||
fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error>;
|
||||
fn get_expiry_year_as_4_digit_i32(&self) -> Result<Secret<i32>, Error>;
|
||||
}
|
||||
|
||||
impl CardData for Card {
|
||||
@ -922,6 +923,14 @@ impl CardData for Card {
|
||||
.change_context(errors::ConnectorError::ResponseDeserializationFailed)
|
||||
.map(Secret::new)
|
||||
}
|
||||
fn get_expiry_year_as_4_digit_i32(&self) -> Result<Secret<i32>, Error> {
|
||||
self.get_expiry_year_4_digit()
|
||||
.peek()
|
||||
.clone()
|
||||
.parse::<i32>()
|
||||
.change_context(errors::ConnectorError::ResponseDeserializationFailed)
|
||||
.map(Secret::new)
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
|
||||
Reference in New Issue
Block a user