feat(core): Add MIT Types in payment Intent (#9585)

This commit is contained in:
awasthi21
2025-10-01 14:53:49 +05:30
committed by GitHub
parent 8e62824b03
commit 9312cfa3c8
24 changed files with 170 additions and 3 deletions

View File

@ -1295,6 +1295,10 @@ pub struct PaymentsRequest {
/// Boolean flag indicating whether this payment method is stored and has been previously used for payments
#[schema(value_type = Option<bool>, example = true)]
pub is_stored_credential: Option<bool>,
/// The category of the MIT transaction
#[schema(value_type = Option<MitCategory>, example = "recurring")]
pub mit_category: Option<api_enums::MitCategory>,
}
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
@ -1467,6 +1471,19 @@ impl PaymentsRequest {
Ok(())
}
}
pub fn validate_mit_request(&self) -> common_utils::errors::CustomResult<(), ValidationError> {
if self.mit_category.is_some()
&& (!matches!(self.off_session, Some(true)) || self.recurring_details.is_none())
{
return Err(ValidationError::InvalidValue {
message: "`mit_category` requires both: (1) `off_session = true`, and (2) `recurring_details`.".to_string(),
}
.into());
}
Ok(())
}
}
#[cfg(feature = "v1")]
@ -5726,6 +5743,10 @@ pub struct PaymentsResponse {
/// Boolean flag indicating whether this payment method is stored and has been previously used for payments
#[schema(value_type = Option<bool>, example = true)]
pub is_stored_credential: Option<bool>,
/// The category of the MIT transaction
#[schema(value_type = Option<MitCategory>, example = "recurring")]
pub mit_category: Option<api_enums::MitCategory>,
}
#[cfg(feature = "v2")]