Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(core): Make installment_payment_enabled,recurring_enabled Optional (#8201)

awasthi21171ca3b5645d
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index ad0d59ac97..39bf157ffb 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -9482,7 +9482,6 @@
"customer_id",
"payment_method_type",
"payment_method_subtype",
- "recurring_enabled",
"created",
"requires_cvv",
"last_used_at",
@@ -9514,8 +9513,9 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
- "example": true
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": true,
+ "nullable": true
},
"payment_method_data": {
"allOf": [
@@ -16955,7 +16955,7 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
"example": true,
"nullable": true
},
@@ -17033,8 +17033,7 @@
"id",
"merchant_id",
"customer_id",
- "payment_method_type",
- "recurring_enabled"
+ "payment_method_type"
],
"properties": {
"id": {
@@ -17067,8 +17066,9 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
- "example": true
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": true,
+ "nullable": true
},
"created": {
"type": "string",
@@ -20922,6 +20922,7 @@
"is_iframe_redirection_enabled": {
"type": "boolean",
"description": "Indicates if the redirection has to open in the iframe",
+ "example": false,
"nullable": true
},
"is_external_vault_enabled": {
@@ -21190,6 +21191,7 @@
"is_iframe_redirection_enabled": {
"type": "boolean",
"description": "Indicates if the redirection has to open in the iframe",
+ "example": false,
"nullable": true
},
"is_external_vault_enabled": {
@@ -21843,9 +21845,7 @@
"RequestPaymentMethodTypes": {
"type": "object",
"required": [
- "payment_method_type",
- "recurring_enabled",
- "installment_payment_enabled"
+ "payment_method_type"
],
"properties": {
"payment_method_type": {
@@ -21900,15 +21900,15 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Boolean to enable recurring payments / mandates. Default is true.",
- "default": true,
- "example": false
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": false,
+ "nullable": true
},
"installment_payment_enabled": {
"type": "boolean",
- "description": "Boolean to enable installment / EMI / BNPL payments. Default is true.",
- "default": true,
- "example": false
+ "description": "Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.",
+ "example": true,
+ "nullable": true
}
}
},
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 280747884b..6cfd6b8cd3 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -11741,8 +11741,6 @@
"payment_method_id",
"customer_id",
"payment_method",
- "recurring_enabled",
- "installment_payment_enabled",
"requires_cvv",
"default_payment_method_set"
],
@@ -11791,13 +11789,15 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
- "example": true
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": true,
+ "nullable": true
},
"installment_payment_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for installment payments",
- "example": true
+ "description": "Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.",
+ "example": true,
+ "nullable": true
},
"payment_experience": {
"type": "array",
@@ -19458,9 +19458,7 @@
"required": [
"merchant_id",
"payment_method_id",
- "payment_method",
- "recurring_enabled",
- "installment_payment_enabled"
+ "payment_method"
],
"properties": {
"merchant_id": {
@@ -19502,13 +19500,15 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for recurring payments",
- "example": true
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": true,
+ "nullable": true
},
"installment_payment_enabled": {
"type": "boolean",
- "description": "Indicates whether the payment method is eligible for installment payments",
- "example": true
+ "description": "Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.",
+ "example": true,
+ "nullable": true
},
"payment_experience": {
"type": "array",
@@ -25256,6 +25256,7 @@
"is_iframe_redirection_enabled": {
"type": "boolean",
"description": "Indicates if the redirection has to open in the iframe",
+ "example": false,
"nullable": true
},
"is_pre_network_tokenization_enabled": {
@@ -25546,6 +25547,12 @@
"description": "Indicates if pre network tokenization is enabled or not",
"default": false,
"example": false
+ },
+ "is_iframe_redirection_enabled": {
+ "type": "boolean",
+ "description": "Indicates if the redirection has to open in the iframe",
+ "example": false,
+ "nullable": true
}
}
},
@@ -26290,9 +26297,7 @@
"RequestPaymentMethodTypes": {
"type": "object",
"required": [
- "payment_method_type",
- "recurring_enabled",
- "installment_payment_enabled"
+ "payment_method_type"
],
"properties": {
"payment_method_type": {
@@ -26347,15 +26352,15 @@
},
"recurring_enabled": {
"type": "boolean",
- "description": "Boolean to enable recurring payments / mandates. Default is true.",
- "default": true,
- "example": false
+ "description": "Indicates whether the payment method supports recurring payments. Optional.",
+ "example": false,
+ "nullable": true
},
"installment_payment_enabled": {
"type": "boolean",
- "description": "Boolean to enable installment / EMI / BNPL payments. Default is true.",
- "default": true,
- "example": false
+ "description": "Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.",
+ "example": true,
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 25ac34d8fa..f101034f71 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2116,6 +2116,7 @@ pub struct ProfileCreate {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
+ #[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if pre network tokenization is enabled or not
@@ -2254,6 +2255,7 @@ pub struct ProfileCreate {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
+ #[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if external vault is enabled or not.
@@ -2424,6 +2426,10 @@ pub struct ProfileResponse {
/// Indicates if pre network tokenization is enabled or not
#[schema(default = false, example = false)]
pub is_pre_network_tokenization_enabled: bool,
+
+ /// Indicates if the redirection has to open in the iframe
+ #[schema(example = false)]
+ pub is_iframe_redirection_enabled: Option<bool>,
}
#[cfg(feature = "v2")]
@@ -2566,6 +2572,7 @@ pub struct ProfileResponse {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
+ #[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if external vault is enabled or not.
@@ -2723,6 +2730,7 @@ pub struct ProfileUpdate {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
+ #[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if pre network tokenization is enabled or not
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 2153bda732..ea59fde756 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -848,13 +848,13 @@ pub struct PaymentMethodResponse {
#[schema(example = json!({"last4": "1142","exp_month": "03","exp_year": "2030"}))]
pub card: Option<CardDetailFromLocker>,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
- pub recurring_enabled: bool,
+ pub recurring_enabled: Option<bool>,
- /// Indicates whether the payment method is eligible for installment payments
+ /// Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
#[schema(example = true)]
- pub installment_payment_enabled: bool,
+ pub installment_payment_enabled: Option<bool>,
/// Type of payment experience enabled with the connector
#[schema(value_type = Option<Vec<PaymentExperience>>, example = json!(["redirect_to_url"]))]
@@ -941,9 +941,9 @@ pub struct PaymentMethodResponse {
#[schema(value_type = Option<PaymentMethodType>, example = "credit")]
pub payment_method_subtype: Option<api_enums::PaymentMethodType>,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
- pub recurring_enabled: bool,
+ pub recurring_enabled: Option<bool>,
/// A timestamp (ISO 8601 code) that determines when the payment method was created
#[schema(value_type = Option<PrimitiveDateTime>, example = "2023-01-18T11:04:09.922Z")]
@@ -1611,13 +1611,13 @@ pub struct RequestPaymentMethodTypes {
#[schema(example = 1313)]
pub maximum_amount: Option<MinorUnit>,
- /// Boolean to enable recurring payments / mandates. Default is true.
- #[schema(default = true, example = false)]
- pub recurring_enabled: bool,
+ /// Indicates whether the payment method supports recurring payments. Optional.
+ #[schema(example = false)]
+ pub recurring_enabled: Option<bool>,
- /// Boolean to enable installment / EMI / BNPL payments. Default is true.
- #[schema(default = true, example = false)]
- pub installment_payment_enabled: bool,
+ /// Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
+ #[schema(example = true)]
+ pub installment_payment_enabled: Option<bool>,
}
impl RequestPaymentMethodTypes {
/// Get payment_method_type
@@ -1651,11 +1651,11 @@ pub struct PaymentMethodListRequest {
#[schema(example = 60)]
pub amount: Option<MinorUnit>,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
pub recurring_enabled: Option<bool>,
- /// Indicates whether the payment method is eligible for installment payments
+ /// Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
#[schema(example = true)]
pub installment_payment_enabled: Option<bool>,
@@ -1774,7 +1774,7 @@ pub struct PaymentMethodListRequest {
#[schema(value_type = Option<Vec<Currency>>,example = json!(["USD", "EUR"]))]
pub accepted_currencies: Option<Vec<api_enums::Currency>>,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
pub recurring_enabled: Option<bool>,
@@ -2096,9 +2096,9 @@ pub struct PaymentMethodResponseItem {
#[schema(value_type = PaymentMethodType,example = "credit")]
pub payment_method_subtype: api_enums::PaymentMethodType,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
- pub recurring_enabled: bool,
+ pub recurring_enabled: Option<bool>,
/// PaymentMethod Data from locker
pub payment_method_data: Option<PaymentMethodListData>,
@@ -2242,13 +2242,13 @@ pub struct CustomerPaymentMethod {
#[schema(value_type = Option<PaymentMethodIssuerCode>,example = "jp_applepay")]
pub payment_method_issuer_code: Option<api_enums::PaymentMethodIssuerCode>,
- /// Indicates whether the payment method is eligible for recurring payments
+ /// Indicates whether the payment method supports recurring payments. Optional.
#[schema(example = true)]
- pub recurring_enabled: bool,
+ pub recurring_enabled: Option<bool>,
- /// Indicates whether the payment method is eligible for installment payments
+ /// Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
#[schema(example = true)]
- pub installment_payment_enabled: bool,
+ pub installment_payment_enabled: Option<bool>,
/// Type of payment experience enabled with the connector
#[schema(value_type = Option<Vec<PaymentExperience>>,example = json!(["redirect_to_url"]))]
diff --git a/crates/common_types/src/payment_methods.rs b/crates/common_types/src/payment_methods.rs
index fc52b807db..eff2a101eb 100644
--- a/crates/common_types/src/payment_methods.rs
+++ b/crates/common_types/src/payment_methods.rs
@@ -147,13 +147,13 @@ pub struct RequestPaymentMethodTypes {
#[schema(example = 1313)]
pub maximum_amount: Option<common_utils::types::MinorUnit>,
- /// Boolean to enable recurring payments / mandates. Default is true.
- #[schema(default = true, example = false)]
- pub recurring_enabled: bool,
+ /// Indicates whether the payment method supports recurring payments. Optional.
+ #[schema(example = true)]
+ pub recurring_enabled: Option<bool>,
- /// Boolean to enable installment / EMI / BNPL payments. Default is true.
- #[schema(default = true, example = false)]
- pub installment_payment_enabled: bool,
+ /// Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
+ #[schema(example = true)]
+ pub installment_payment_enabled: Option<bool>,
}
impl From<RequestPaymentMethodTypesV1> for RequestPaymentMethodTypes {
@@ -181,8 +181,8 @@ struct RequestPaymentMethodTypesV1 {
pub accepted_countries: Option<AcceptedCountries>,
pub minimum_amount: Option<common_utils::types::MinorUnit>,
pub maximum_amount: Option<common_utils::types::MinorUnit>,
- pub recurring_enabled: bool,
- pub installment_payment_enabled: bool,
+ pub recurring_enabled: Option<bool>,
+ pub installment_payment_enabled: Option<bool>,
}
impl RequestPaymentMethodTypes {
diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs
index 63c7d99ee1..164a0c0cf7 100644
--- a/crates/connector_configs/src/transformer.rs
+++ b/crates/connector_configs/src/transformer.rs
@@ -23,8 +23,8 @@ impl DashboardRequestPayload {
card_networks: Some(card_provider),
minimum_amount: Some(MinorUnit::zero()),
maximum_amount: Some(MinorUnit::new(68607706)),
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
accepted_currencies: None,
accepted_countries: None,
payment_experience: None,
@@ -86,8 +86,8 @@ impl DashboardRequestPayload {
card_networks: None,
minimum_amount: Some(MinorUnit::zero()),
maximum_amount: Some(MinorUnit::new(68607706)),
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
accepted_currencies: method_type.accepted_currencies,
accepted_countries: method_type.accepted_countries,
payment_experience: Self::get_payment_experience(
@@ -125,8 +125,8 @@ impl DashboardRequestPayload {
card_networks: Some(vec![method.payment_method_type]),
minimum_amount: Some(MinorUnit::zero()),
maximum_amount: Some(MinorUnit::new(68607706)),
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
accepted_currencies: method.accepted_currencies,
accepted_countries: method.accepted_countries,
payment_experience: None,
diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rs
index e492ec46eb..094c687b60 100644
--- a/crates/kgraph_utils/benches/evaluation.rs
+++ b/crates/kgraph_utils/benches/evaluation.rs
@@ -42,8 +42,8 @@ fn build_test_data(
accepted_countries: None,
minimum_amount: Some(MinorUnit::new(10)),
maximum_amount: Some(MinorUnit::new(1000)),
- recurring_enabled: true,
- installment_payment_enabled: true,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(true),
});
}
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index 9b06e05b99..c8fb11d125 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -1146,8 +1146,8 @@ mod tests {
accepted_countries: None,
minimum_amount: Some(MinorUnit::new(10)),
maximum_amount: Some(MinorUnit::new(1000)),
- recurring_enabled: true,
- installment_payment_enabled: true,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(true),
},
RequestPaymentMethodTypes {
payment_method_type: api_enums::PaymentMethodType::Debit,
@@ -1162,8 +1162,8 @@ mod tests {
accepted_countries: None,
minimum_amount: Some(MinorUnit::new(10)),
maximum_amount: Some(MinorUnit::new(1000)),
- recurring_enabled: true,
- installment_payment_enabled: true,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(true),
},
]),
}]),
diff --git a/crates/payment_methods/src/helpers.rs b/crates/payment_methods/src/helpers.rs
index 7a885b5f05..3883393279 100644
--- a/crates/payment_methods/src/helpers.rs
+++ b/crates/payment_methods/src/helpers.rs
@@ -263,8 +263,8 @@ impl ForeignFrom<(Option<api::CardDetailFromLocker>, domain::PaymentMethod)>
payment_method: item.get_payment_method_type(),
payment_method_type: item.get_payment_method_subtype(),
card: card_details,
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: None,
metadata: item.metadata,
created: Some(item.created_at),
diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs
index 58bd6de9b3..b258e43b5a 100644
--- a/crates/router/src/core/errors/utils.rs
+++ b/crates/router/src/core/errors/utils.rs
@@ -131,6 +131,12 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
}
.into()
}
+ errors::ConnectorError::CaptureMethodNotSupported => {
+ errors::ApiErrorResponse::NotSupported {
+ message: "Capture Method Not Supported".to_owned(),
+ }
+ .into()
+ }
errors::ConnectorError::FailedToObtainIntegrationUrl
| errors::ConnectorError::RequestEncodingFailed
| errors::ConnectorError::RequestEncodingFailedWithReason(_)
@@ -151,7 +157,6 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
| errors::ConnectorError::NoConnectorWalletDetails
| errors::ConnectorError::FailedToObtainCertificateKey
| errors::ConnectorError::FlowNotSupported { .. }
- | errors::ConnectorError::CaptureMethodNotSupported
| errors::ConnectorError::MissingConnectorMandateID
| errors::ConnectorError::MissingConnectorMandateMetadata
| errors::ConnectorError::MissingConnectorTransactionID
@@ -234,6 +239,11 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
errors::ConnectorError::InvalidDataFormat { field_name } => {
errors::ApiErrorResponse::InvalidDataValue { field_name }
},
+ errors::ConnectorError::CaptureMethodNotSupported => {
+ errors::ApiErrorResponse::NotSupported {
+ message: "Capture Method Not Supported".to_owned(),
+ }
+ }
errors::ConnectorError::InvalidWalletToken {wallet_name} => errors::ApiErrorResponse::InvalidWalletToken {wallet_name: wallet_name.to_string()},
errors::ConnectorError::CurrencyNotSupported { message, connector} => errors::ApiErrorResponse::CurrencyNotSupported { message: format!("Credentials for the currency {message} are not configured with the connector {connector}/hyperswitch") },
errors::ConnectorError::FailedToObtainAuthType => errors::ApiErrorResponse::InvalidConnectorConfiguration {config: "connector_account_details".to_string()},
@@ -252,7 +262,6 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
errors::ConnectorError::FailedToObtainCertificate |
errors::ConnectorError::NoConnectorMetaData | errors::ConnectorError::NoConnectorWalletDetails |
errors::ConnectorError::FailedToObtainCertificateKey |
- errors::ConnectorError::CaptureMethodNotSupported |
errors::ConnectorError::MissingConnectorMandateID |
errors::ConnectorError::MissingConnectorMandateMetadata |
errors::ConnectorError::MissingConnectorTransactionID |
@@ -324,6 +333,11 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
wallet_name: wallet_name.to_string(),
}
}
+ errors::ConnectorError::CaptureMethodNotSupported => {
+ errors::ApiErrorResponse::NotSupported {
+ message: "Capture Method Not Supported".to_owned(),
+ }
+ }
errors::ConnectorError::RequestEncodingFailed
| errors::ConnectorError::RequestEncodingFailedWithReason(_)
| errors::ConnectorError::ParsingFailed
@@ -343,7 +357,6 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
| errors::ConnectorError::NotImplemented(_)
| errors::ConnectorError::NotSupported { .. }
| errors::ConnectorError::FlowNotSupported { .. }
- | errors::ConnectorError::CaptureMethodNotSupported
| errors::ConnectorError::MissingConnectorMandateID
| errors::ConnectorError::MissingConnectorMandateMetadata
| errors::ConnectorError::MissingConnectorTransactionID
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 7706eda095..567f167d1f 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -254,8 +254,8 @@ impl PaymentMethodsController for PmCards<'_> {
card: None,
metadata: req.metadata.clone(),
created: Some(common_utils::date_time::now()),
- recurring_enabled: false, //[#219]
- installment_payment_enabled: false, //[#219]
+ recurring_enabled: Some(false), //[#219]
+ installment_payment_enabled: Some(false), //[#219]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
last_used_at: Some(common_utils::date_time::now()),
client_secret: None,
@@ -990,8 +990,8 @@ impl PaymentMethodsController for PmCards<'_> {
card,
metadata: pm.metadata,
created: Some(pm.created_at),
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
last_used_at: Some(pm.last_used_at),
client_secret: pm.client_secret,
@@ -1889,8 +1889,8 @@ pub async fn update_customer_payment_method(
card: Some(existing_card_data),
metadata: pm.metadata,
created: Some(pm.created_at),
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
last_used_at: Some(common_utils::date_time::now()),
client_secret: pm.client_secret.clone(),
@@ -4084,7 +4084,7 @@ fn filter_installment_based(
installment_payment_enabled: Option<bool>,
) -> bool {
installment_payment_enabled.map_or(true, |enabled| {
- payment_method.installment_payment_enabled == enabled
+ payment_method.installment_payment_enabled == Some(enabled)
})
}
@@ -4118,7 +4118,9 @@ fn filter_recurring_based(
payment_method: &RequestPaymentMethodTypes,
recurring_enabled: Option<bool>,
) -> bool {
- recurring_enabled.map_or(true, |enabled| payment_method.recurring_enabled == enabled)
+ recurring_enabled.map_or(true, |enabled| {
+ payment_method.recurring_enabled == Some(enabled)
+ })
}
#[cfg(all(
@@ -4359,7 +4361,7 @@ pub async fn list_customer_payment_method(
metadata: pm.metadata,
payment_method_issuer_code: pm.payment_method_issuer_code,
recurring_enabled: mca_enabled,
- installment_payment_enabled: false,
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
created: Some(pm.created_at),
#[cfg(feature = "payouts")]
@@ -4372,7 +4374,7 @@ pub async fn list_customer_payment_method(
&& customer.default_payment_method_id == Some(pm.payment_method_id),
billing: payment_method_billing,
};
- if requires_cvv || mca_enabled {
+ if requires_cvv || mca_enabled.unwrap_or(false) {
customer_pms.push(pma.to_owned());
}
@@ -4603,9 +4605,9 @@ pub async fn get_mca_status(
is_connector_agnostic_mit_enabled: bool,
connector_mandate_details: Option<CommonMandateReference>,
network_transaction_id: Option<&String>,
-) -> errors::RouterResult<bool> {
+) -> errors::RouterResult<Option<bool>> {
if is_connector_agnostic_mit_enabled && network_transaction_id.is_some() {
- return Ok(true);
+ return Ok(Some(true));
}
if let Some(connector_mandate_details) = connector_mandate_details {
let mcas = state
@@ -4621,14 +4623,14 @@ pub async fn get_mca_status(
id: merchant_id.get_string_repr().to_owned(),
})?;
- return Ok(
+ return Ok(Some(
mcas.is_merchant_connector_account_id_in_connector_mandate_details(
profile_id.as_ref(),
&connector_mandate_details,
),
- );
+ ));
}
- Ok(false)
+ Ok(Some(false))
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
diff --git a/crates/router/src/core/payment_methods/tokenize/card_executor.rs b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
index 2537a244a5..61684ddfa7 100644
--- a/crates/router/src/core/payment_methods/tokenize/card_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
@@ -268,8 +268,8 @@ impl<'a> NetworkTokenizationBuilder<'a, CardTokenStored> {
payment_method: payment_method.payment_method,
payment_method_type: payment_method.payment_method_type,
card: card_detail_from_locker,
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
metadata: payment_method.metadata.clone(),
created: Some(payment_method.created_at),
last_used_at: Some(payment_method.last_used_at),
diff --git a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
index a55896b36c..9f9cfe714b 100644
--- a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
@@ -73,8 +73,8 @@ impl<'a> NetworkTokenizationBuilder<'a, TokenizeWithPmId> {
payment_method_id: payment_method.payment_method_id.clone(),
payment_method: payment_method.payment_method,
payment_method_type: payment_method.payment_method_type,
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
metadata: payment_method.metadata.clone(),
created: Some(payment_method.created_at),
last_used_at: Some(payment_method.last_used_at),
@@ -227,8 +227,8 @@ impl<'a> NetworkTokenizationBuilder<'a, PmTokenStored> {
payment_method_id: payment_method.payment_method_id.clone(),
payment_method: payment_method.payment_method,
payment_method_type: payment_method.payment_method_type,
- recurring_enabled: true,
- installment_payment_enabled: false,
+ recurring_enabled: Some(true),
+ installment_payment_enabled: Some(false),
metadata: payment_method.metadata.clone(),
created: Some(payment_method.created_at),
last_used_at: Some(payment_method.last_used_at),
diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs
index 3e64e84615..9f61796f2e 100644
--- a/crates/router/src/core/payment_methods/transformers.rs
+++ b/crates/router/src/core/payment_methods/transformers.rs
@@ -430,8 +430,8 @@ pub fn mk_add_bank_response_hs(
card: None,
metadata: req.metadata,
created: Some(common_utils::date_time::now()),
- recurring_enabled: false, // [#256]
- installment_payment_enabled: false, // #[#256]
+ recurring_enabled: Some(false), // [#256]
+ installment_payment_enabled: Some(false), // #[#256]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
last_used_at: Some(common_utils::date_time::now()),
client_secret: None,
@@ -493,8 +493,8 @@ pub fn mk_add_card_response_hs(
card: Some(card),
metadata: req.metadata,
created: Some(common_utils::date_time::now()),
- recurring_enabled: false, // [#256]
- installment_payment_enabled: false, // #[#256]
+ recurring_enabled: Some(false), // [#256]
+ installment_payment_enabled: Some(false), // #[#256]
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
last_used_at: Some(common_utils::date_time::now()), // [#256]
client_secret: req.client_secret,
@@ -598,7 +598,7 @@ pub fn generate_payment_method_response(
payment_method_type: payment_method.get_payment_method_type(),
payment_method_subtype: payment_method.get_payment_method_subtype(),
created: Some(payment_method.created_at),
- recurring_enabled: false,
+ recurring_enabled: Some(false),
last_used_at: Some(payment_method.last_used_at),
payment_method_data: pmd,
connector_tokens,
@@ -1054,7 +1054,7 @@ impl transformers::ForeignTryFrom<domain::PaymentMethod> for PaymentMethodRespon
});
// TODO: check how we can get this field
- let recurring_enabled = true;
+ let recurring_enabled = Some(true);
let psp_tokenization_enabled = item.connector_mandate_details.and_then(|details| {
details.payments.map(|payments| {
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index c0338b5b60..76bdfca1c5 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -962,8 +962,8 @@ async fn skip_saving_card_in_locker(
payment_method: payment_method_request.payment_method,
payment_method_type: payment_method_request.payment_method_type,
card: Some(card_detail),
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
metadata: None,
created: Some(common_utils::date_time::now()),
@@ -986,8 +986,8 @@ async fn skip_saving_card_in_locker(
card: None,
metadata: None,
created: Some(common_utils::date_time::now()),
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
#[cfg(feature = "payouts")]
bank_transfer: None,
@@ -1053,8 +1053,8 @@ pub async fn save_in_locker(
card: None,
metadata: None,
created: Some(common_utils::date_time::now()),
- recurring_enabled: false, //[#219]
- installment_payment_enabled: false, //[#219]
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), //[#219]
last_used_at: Some(common_utils::date_time::now()),
client_secret: None,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index f0f3e1f7af..cbca021f1c 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -197,6 +197,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_debit_routing_enabled: Some(item.is_debit_routing_enabled),
merchant_business_country: item.merchant_business_country,
is_pre_network_tokenization_enabled: item.is_pre_network_tokenization_enabled,
+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,
})
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index e8c136c4ed..63e7eee426 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -103,8 +103,8 @@ impl
payment_method: item.get_payment_method_type(),
payment_method_type: item.get_payment_method_subtype(),
card: card_details,
- recurring_enabled: false,
- installment_payment_enabled: false,
+ recurring_enabled: Some(false),
+ installment_payment_enabled: Some(false),
payment_experience: None,
metadata: item.metadata,
created: Some(item.created_at),