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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(router): add support for partial authorization (#8833)
Sai Harsha Vardhanc354e62f9da7
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 9aa9e190d6..4590eca58c 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -7972,6 +7972,7 @@"void_failed","auto_refunded","partial_charged",+ "partially_authorized","partial_charged_and_chargeable","unresolved","pending",@@ -14810,6 +14811,7 @@"payment_cancelled","payment_cancelled_post_capture","payment_authorized",+ "payment_partially_authorized","payment_captured","payment_expired","action_required",@@ -16665,6 +16667,7 @@"requires_capture","partially_captured","partially_captured_and_capturable",+ "partially_authorized_and_requires_capture","conflicted","expired"]@@ -22697,6 +22700,11 @@"format": "date-time","description": "Date the payer placed the order.","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}}},@@ -23165,6 +23173,11 @@"format": "date-time","description": "Date the payer placed the order.","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}}},@@ -23766,6 +23779,11 @@"type": "string","description": "Contains whole connector response","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}}},@@ -24524,6 +24542,11 @@"format": "date-time","description": "Date the payer placed the order.","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}},"additionalProperties": false@@ -25151,6 +25174,11 @@"type": "string","description": "Contains whole connector response","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}}},@@ -25752,6 +25780,11 @@"format": "date-time","description": "Date the payer placed the order.","nullable": true+ },+ "enable_partial_authorization": {+ "type": "boolean",+ "description": "Allow partial authorization for this payment",+ "nullable": true}}},diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 4487baf27d..50ddd9c66d 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -4909,6 +4909,7 @@"void_failed","auto_refunded","partial_charged",+ "partially_authorized","partial_charged_and_chargeable","unresolved","pending",@@ -10786,6 +10787,7 @@"payment_cancelled","payment_cancelled_post_capture","payment_authorized",+ "payment_partially_authorized","payment_captured","payment_expired","action_required",@@ -12753,6 +12755,7 @@"requires_capture","partially_captured","partially_captured_and_capturable",+ "partially_authorized_and_requires_capture","conflicted","expired"]diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 4b42a85816..98a812bc5a 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -1214,6 +1214,9 @@ pub struct PaymentsRequest {/// Date the payer placed the order.#[serde(default, with = "common_utils::custom_serde::iso8601::option")]pub order_date: Option<PrimitiveDateTime>,++ /// Allow partial authorization for this payment+ pub enable_partial_authorization: Option<bool>,}#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]@@ -5272,6 +5275,9 @@ pub struct PaymentsResponse {/// Contains whole connector response#[schema(value_type = Option<String>)]pub whole_connector_response: Option<Secret<String>>,++ /// Allow partial authorization for this payment+ pub enable_partial_authorization: Option<bool>,}#[cfg(feature = "v2")]diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 1536d5665b..6e31e0bba0 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -148,6 +148,7 @@ pub enum AttemptStatus {VoidFailed,AutoRefunded,PartialCharged,+ PartiallyAuthorized,PartialChargedAndChargeable,Unresolved,#[default]@@ -178,6 +179,7 @@ impl AttemptStatus {| Self::AuthenticationPending| Self::AuthenticationSuccessful| Self::Authorized+ | Self::PartiallyAuthorized| Self::AuthorizationFailed| Self::Authorizing| Self::CodInitiated@@ -1560,6 +1562,7 @@ pub enum EventType {PaymentCancelled,PaymentCancelledPostCapture,PaymentAuthorized,+ PaymentPartiallyAuthorized,PaymentCaptured,PaymentExpired,ActionRequired,@@ -1683,6 +1686,8 @@ pub enum IntentStatus {PartiallyCaptured,/// The payment has been captured partially and the remaining amount is capturablePartiallyCapturedAndCapturable,+ /// The payment has been authorized for a partial amount and requires capture+ PartiallyAuthorizedAndRequiresCapture,/// There has been a discrepancy between the amount/currency sent in the request and the amount/currency received by the processorConflicted,/// The payment expired before it could be captured.@@ -1706,6 +1711,7 @@ impl IntentStatus {| Self::RequiresConfirmation| Self::RequiresCapture| Self::PartiallyCapturedAndCapturable+ | Self::PartiallyAuthorizedAndRequiresCapture| Self::Conflicted => false,}}@@ -1727,7 +1733,7 @@ impl IntentStatus {| Self::RequiresCustomerAction| Self::RequiresMerchantAction| Self::PartiallyCapturedAndCapturable- => true,+ | Self::PartiallyAuthorizedAndRequiresCapture => true,}}}@@ -1853,6 +1859,7 @@ impl From<AttemptStatus> for PaymentMethodStatus {| AttemptStatus::AutoRefunded| AttemptStatus::PartialCharged| AttemptStatus::PartialChargedAndChargeable+ | AttemptStatus::PartiallyAuthorized| AttemptStatus::ConfirmationAwaited| AttemptStatus::DeviceDataCollectionPending| AttemptStatus::IntegrityFailurediff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rsindex 15c0f95837..f897c8c24b 100644--- a/crates/common_enums/src/transformers.rs+++ b/crates/common_enums/src/transformers.rs@@ -2125,6 +2125,7 @@ impl From<AttemptStatus> for IntentStatus {AttemptStatus::Voided => Self::Cancelled,AttemptStatus::VoidedPostCharge => Self::CancelledPostCapture,AttemptStatus::Expired => Self::Expired,+ AttemptStatus::PartiallyAuthorized => Self::PartiallyAuthorizedAndRequiresCapture,}}}@@ -2146,6 +2147,9 @@ impl From<IntentStatus> for Option<EventType> {}IntentStatus::RequiresCapture => Some(EventType::PaymentAuthorized),IntentStatus::RequiresPaymentMethod | IntentStatus::RequiresConfirmation => None,+ IntentStatus::PartiallyAuthorizedAndRequiresCapture => {+ Some(EventType::PaymentPartiallyAuthorized)+ }}}}diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex 41f4debb16..6c80160cc6 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -487,7 +487,6 @@ pub enum PaymentAttemptUpdate {straight_through_algorithm: Option<serde_json::Value>,error_code: Option<Option<String>>,error_message: Option<Option<String>>,- amount_capturable: Option<MinorUnit>,surcharge_amount: Option<MinorUnit>,tax_amount: Option<MinorUnit>,fingerprint_id: Option<String>,@@ -2461,7 +2460,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {straight_through_algorithm,error_code,error_message,- amount_capturable,updated_by,merchant_connector_id,surcharge_amount,@@ -2498,7 +2496,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {straight_through_algorithm,error_code,error_message,- amount_capturable,+ amount_capturable: None,updated_by,merchant_connector_id: merchant_connector_id.map(Some),surcharge_amount,diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rsindex e04cf497a8..0f56be3130 100644--- a/crates/diesel_models/src/payment_intent.rs+++ b/crates/diesel_models/src/payment_intent.rs@@ -75,6 +75,7 @@ pub struct PaymentIntent {pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,pub order_date: Option<PrimitiveDateTime>,+ pub enable_partial_authorization: Option<bool>,pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,pub billing_address: Option<Encryption>,pub shipping_address: Option<Encryption>,@@ -174,6 +175,7 @@ pub struct PaymentIntent {pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,pub order_date: Option<PrimitiveDateTime>,+ pub enable_partial_authorization: Option<bool>,}#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]@@ -351,6 +353,7 @@ pub struct PaymentIntentNew {pub organization_id: common_utils::id_type::OrganizationId,pub tax_details: Option<TaxDetails>,pub skip_external_tax_calculation: Option<bool>,+ pub enable_partial_authorization: Option<bool>,pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,pub billing_address: Option<Encryption>,pub shipping_address: Option<Encryption>,@@ -460,6 +463,7 @@ pub struct PaymentIntentNew {pub order_date: Option<PrimitiveDateTime>,pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,+ pub enable_partial_authorization: Option<bool>,}#[cfg(feature = "v2")]@@ -626,6 +630,7 @@ pub struct PaymentIntentUpdateFields {pub order_date: Option<PrimitiveDateTime>,pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,+ pub enable_partial_authorization: Option<bool>,}// TODO: uncomment fields as necessary@@ -790,6 +795,7 @@ impl PaymentIntentUpdateInternal {shipping_amount_tax: source.shipping_amount_tax,duty_amount: source.duty_amount,order_date: source.order_date,+ enable_partial_authorization: None,}}}@@ -844,6 +850,7 @@ pub struct PaymentIntentUpdateInternal {pub order_date: Option<PrimitiveDateTime>,pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,+ pub enable_partial_authorization: Option<bool>,}#[cfg(feature = "v1")]@@ -895,6 +902,7 @@ impl PaymentIntentUpdate {order_date,shipping_amount_tax,duty_amount,+ enable_partial_authorization,} = self.into();PaymentIntent {amount: amount.unwrap_or(source.amount),@@ -950,6 +958,8 @@ impl PaymentIntentUpdate {order_date: order_date.or(source.order_date),shipping_amount_tax: shipping_amount_tax.or(source.shipping_amount_tax),duty_amount: duty_amount.or(source.duty_amount),+ enable_partial_authorization: enable_partial_authorization+ .or(source.enable_partial_authorization),..source}}@@ -1008,6 +1018,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::Update(value) => Self {amount: Some(value.amount),@@ -1056,6 +1067,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: value.order_date,shipping_amount_tax: value.shipping_amount_tax,duty_amount: value.duty_amount,+ enable_partial_authorization: value.enable_partial_authorization,},PaymentIntentUpdate::PaymentCreateUpdate {return_url,@@ -1111,6 +1123,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::PGStatusUpdate {status,@@ -1162,6 +1175,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::MerchantStatusUpdate {status,@@ -1214,6 +1228,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::ResponseUpdate {// amount,@@ -1273,6 +1288,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {active_attempt_id,@@ -1324,6 +1340,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::StatusAndAttemptUpdate {status,@@ -1376,6 +1393,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::ApproveUpdate {status,@@ -1427,6 +1445,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::RejectUpdate {status,@@ -1478,6 +1497,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::SurchargeApplicableUpdate {surcharge_applicable,@@ -1528,6 +1548,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount } => Self {amount: Some(amount),@@ -1575,6 +1596,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::AuthorizationCountUpdate {authorization_count,@@ -1624,6 +1646,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::CompleteAuthorizeUpdate {shipping_address_id,@@ -1673,6 +1696,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::ManualUpdate { status, updated_by } => Self {status,@@ -1720,6 +1744,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},PaymentIntentUpdate::SessionResponseUpdate {tax_details,@@ -1772,6 +1797,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,},}}diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 2347239f2f..319503e65c 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -1083,6 +1083,7 @@ diesel::table! {shipping_amount_tax -> Nullable<Int8>,duty_amount -> Nullable<Int8>,order_date -> Nullable<Timestamp>,+ enable_partial_authorization -> Nullable<Bool>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex 49f22ab3dd..192d6e72e6 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -1015,6 +1015,7 @@ diesel::table! {shipping_amount_tax -> Nullable<Int8>,duty_amount -> Nullable<Int8>,order_date -> Nullable<Timestamp>,+ enable_partial_authorization -> Nullable<Bool>,#[max_length = 64]merchant_reference_id -> Nullable<Varchar>,billing_address -> Nullable<Bytea>,diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rsindex c14cae2f40..b8bf2db6c3 100644--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs@@ -694,6 +694,7 @@ impl TryFrom<enums::AttemptStatus> for ChargebeeRecordStatus {| enums::AttemptStatus::AuthenticationPending| enums::AttemptStatus::AuthenticationSuccessful| enums::AttemptStatus::Authorized+ | enums::AttemptStatus::PartiallyAuthorized| enums::AttemptStatus::AuthorizationFailed| enums::AttemptStatus::Authorizing| enums::AttemptStatus::CodInitiateddiff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rsindex ca17c9f984..d5e66fa435 100644--- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs@@ -2707,7 +2707,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<PaypalCaptureResponse>>| storage_enums::AttemptStatus::DeviceDataCollectionPending| storage_enums::AttemptStatus::Voided| storage_enums::AttemptStatus::VoidedPostCharge- | storage_enums::AttemptStatus::Expired => 0,+ | storage_enums::AttemptStatus::Expired+ | storage_enums::AttemptStatus::PartiallyAuthorized => 0,storage_enums::AttemptStatus::Charged| storage_enums::AttemptStatus::PartialCharged| storage_enums::AttemptStatus::PartialChargedAndChargeablediff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rsindex 89ce0c97c2..42dfc3f86d 100644--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs@@ -265,6 +265,7 @@ impl TryFrom<enums::AttemptStatus> for RecurlyRecordStatus {| enums::AttemptStatus::AuthenticationPending| enums::AttemptStatus::AuthenticationSuccessful| enums::AttemptStatus::Authorized+ | enums::AttemptStatus::PartiallyAuthorized| enums::AttemptStatus::AuthorizationFailed| enums::AttemptStatus::Authorizing| enums::AttemptStatus::CodInitiateddiff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rsindex 09c9522091..6b880a5eda 100644--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs@@ -248,6 +248,8 @@ pub struct Authorization {#[serde(skip_serializing_if = "Option::is_none")]pub original_network_transaction_id: Option<Secret<String>>,#[serde(skip_serializing_if = "Option::is_none")]+ pub allow_partial_auth: Option<bool>,+ #[serde(skip_serializing_if = "Option::is_none")]pub cardholder_authentication: Option<CardholderAuthentication>,}@@ -283,6 +285,8 @@ pub struct Sale {pub processing_type: Option<VantivProcessingType>,#[serde(skip_serializing_if = "Option::is_none")]pub original_network_transaction_id: Option<Secret<String>>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub allow_partial_auth: Option<bool>,}#[derive(Debug, Serialize, Deserialize)]@@ -670,7 +674,6 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnllet processing_info = get_processing_info(&item.router_data.request)?;let enhanced_data = get_enhanced_data(item.router_data)?;let order_source = OrderSource::from(item);-let (authorization, sale) =if item.router_data.request.is_auto_capture()? && item.amount != MinorUnit::zero() {(@@ -693,6 +696,13 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnlprocessing_type: processing_info.processing_type,original_network_transaction_id: processing_info.network_transaction_id,enhanced_data,+ allow_partial_auth: item+ .router_data+ .request+ .enable_partial_authorization+ .and_then(|enable_partial_authorization| {+ enable_partial_authorization.then_some(true)+ }),}),)} else {@@ -720,6 +730,13 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnloriginal_network_transaction_id: processing_info.network_transaction_id,cardholder_authentication,enhanced_data,+ allow_partial_auth: item+ .router_data+ .request+ .enable_partial_authorization+ .and_then(|enable_partial_authorization| {+ enable_partial_authorization.then_some(true)+ }),}),None,)@@ -845,7 +862,7 @@ fn get_processing_info(.ok_or(errors::ConnectorError::MissingConnectorMandateID)?.into(),exp_date: format!(- "{}_{}",+ "{}{}",card_mandate_data.card_exp_month.peek(),card_mandate_data.card_exp_year.peek())@@ -1092,6 +1109,7 @@ pub struct PaymentResponse {pub fraud_result: Option<FraudResult>,pub token_response: Option<TokenResponse>,pub network_transaction_id: Option<Secret<String>>,+ pub approved_amount: Option<MinorUnit>,}#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]@@ -1550,6 +1568,7 @@ impl<F>charges: None,}),connector_response,+ amount_captured: sale_response.approved_amount.map(MinorUnit::get_amount_as_i64),..item.data})}@@ -1600,6 +1619,16 @@ impl<F>charges: None,}),connector_response,+ amount_captured: if payment_flow_type == WorldpayvantivPaymentFlow::Sale {+ auth_response.approved_amount.map(MinorUnit::get_amount_as_i64)+ } else {+ None+ },+ minor_amount_capturable: if payment_flow_type == WorldpayvantivPaymentFlow::Auth {+ auth_response.approved_amount+ } else {+ None+ },..item.data})}diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rsindex f2ea237af2..5561de1332 100644--- a/crates/hyperswitch_connectors/src/utils.rs+++ b/crates/hyperswitch_connectors/src/utils.rs@@ -447,7 +447,8 @@ pub(crate) fn is_payment_failure(status: AttemptStatus) -> bool {| AttemptStatus::PaymentMethodAwaited| AttemptStatus::ConfirmationAwaited| AttemptStatus::DeviceDataCollectionPending- | AttemptStatus::IntegrityFailure => false,+ | AttemptStatus::IntegrityFailure+ | AttemptStatus::PartiallyAuthorized => false,}}@@ -6212,6 +6213,7 @@ pub(crate) fn convert_setup_mandate_router_data_to_authorize_router_data(order_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: data.request.enable_partial_authorization,}}@@ -6272,6 +6274,7 @@ pub(crate) fn convert_payment_authorize_router_response<F1, F2, T1, T2>(raw_connector_response: data.raw_connector_response.clone(),is_payment_id_from_merchant: data.is_payment_id_from_merchant,l2_l3_data: data.l2_l3_data.clone(),+ minor_amount_capturable: data.minor_amount_capturable,}}@@ -6313,7 +6316,8 @@ impl FrmTransactionRouterDataRequest for FrmTransactionRouterData {| AttemptStatus::PartialChargedAndChargeable| AttemptStatus::Authorized| AttemptStatus::Charged- | AttemptStatus::IntegrityFailure => Some(true),+ | AttemptStatus::IntegrityFailure+ | AttemptStatus::PartiallyAuthorized => Some(true),AttemptStatus::Started| AttemptStatus::AuthenticationPendingdiff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rsindex 2a6f33ed7a..46e70079bc 100644--- a/crates/hyperswitch_domain_models/src/payments.rs+++ b/crates/hyperswitch_domain_models/src/payments.rs@@ -122,6 +122,7 @@ pub struct PaymentIntent {pub order_date: Option<PrimitiveDateTime>,pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,+ pub enable_partial_authorization: Option<bool>,}impl PaymentIntent {diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rsindex d9a7063054..ceff3d161d 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs@@ -1251,7 +1251,6 @@ pub enum PaymentAttemptUpdate {straight_through_algorithm: Option<serde_json::Value>,error_code: Option<Option<String>>,error_message: Option<Option<String>>,- amount_capturable: Option<MinorUnit>,updated_by: String,merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,external_three_ds_authentication_attempted: Option<bool>,@@ -1521,7 +1520,6 @@ impl PaymentAttemptUpdate {straight_through_algorithm,error_code,error_message,- amount_capturable,fingerprint_id,updated_by,merchant_connector_id: connector_id,@@ -1554,7 +1552,6 @@ impl PaymentAttemptUpdate {straight_through_algorithm,error_code,error_message,- amount_capturable,surcharge_amount: net_amount.get_surcharge_amount(),tax_amount: net_amount.get_tax_on_surcharge(),fingerprint_id,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex 7d7e08f803..55f8252ac2 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -249,6 +249,7 @@ pub struct PaymentIntentUpdateFields {pub duty_amount: Option<MinorUnit>,pub is_confirm_operation: bool,pub payment_channel: Option<common_enums::PaymentChannel>,+ pub enable_partial_authorization: Option<bool>,}#[cfg(feature = "v1")]@@ -441,6 +442,7 @@ pub struct PaymentIntentUpdateInternal {pub order_date: Option<PrimitiveDateTime>,pub shipping_amount_tax: Option<MinorUnit>,pub duty_amount: Option<MinorUnit>,+ pub enable_partial_authorization: Option<bool>,}// This conversion is used in the `update_payment_intent` function@@ -1084,6 +1086,7 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {order_date: value.order_date,shipping_amount_tax: value.shipping_amount_tax,duty_amount: value.duty_amount,+ enable_partial_authorization: value.enable_partial_authorization,}))}PaymentIntentUpdate::PaymentCreateUpdate {@@ -1248,6 +1251,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateIntorder_date,shipping_amount_tax,duty_amount,+ enable_partial_authorization,} = value;Self {amount,@@ -1295,6 +1299,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateIntorder_date,shipping_amount_tax,duty_amount,+ enable_partial_authorization,}}}@@ -1770,6 +1775,7 @@ impl behaviour::Conversion for PaymentIntent {shipping_amount_tax: None,duty_amount: None,order_date: None,+ enable_partial_authorization: None,})}async fn convert_back(@@ -2006,6 +2012,7 @@ impl behaviour::Conversion for PaymentIntent {shipping_amount_tax: None,duty_amount: None,order_date: None,+ enable_partial_authorization: None,})}}@@ -2087,6 +2094,7 @@ impl behaviour::Conversion for PaymentIntent {order_date: self.order_date,shipping_amount_tax: self.shipping_amount_tax,duty_amount: self.duty_amount,+ enable_partial_authorization: self.enable_partial_authorization,})}@@ -2194,6 +2202,7 @@ impl behaviour::Conversion for PaymentIntent {shipping_amount_tax: storage_model.shipping_amount_tax,duty_amount: storage_model.duty_amount,order_date: storage_model.order_date,+ enable_partial_authorization: storage_model.enable_partial_authorization,})}.await@@ -2273,6 +2282,7 @@ impl behaviour::Conversion for PaymentIntent {order_date: self.order_date,shipping_amount_tax: self.shipping_amount_tax,duty_amount: self.duty_amount,+ enable_partial_authorization: self.enable_partial_authorization,})}}diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rsindex 6d3caea1e3..126c7c8bbc 100644--- a/crates/hyperswitch_domain_models/src/router_data.rs+++ b/crates/hyperswitch_domain_models/src/router_data.rs@@ -90,6 +90,7 @@ pub struct RouterData<Flow, Request, Response> {// minor amount for amount frameworkpub minor_amount_captured: Option<MinorUnit>,+ pub minor_amount_capturable: Option<MinorUnit>,pub integrity_check: Result<(), IntegrityCheckError>,@@ -784,7 +785,8 @@ impl| common_enums::IntentStatus::Processing => None,// Invalid states for this flowcommon_enums::IntentStatus::RequiresPaymentMethod- | common_enums::IntentStatus::RequiresConfirmation => None,+ | common_enums::IntentStatus::RequiresConfirmation+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => None,// If status is requires capture, get the total amount that can be captured// This is in cases where the capture method will be `manual` or `manual_multiple`// We do not need to handle the case where amount_to_capture is provided here as it cannot be passed in authroize flow@@ -824,7 +826,10 @@ implcommon_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation => None,// No amount has been captured yet- common_enums::IntentStatus::RequiresCapture => Some(MinorUnit::zero()),+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {+ Some(MinorUnit::zero())+ }// Invalid statues for this flowcommon_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,@@ -999,7 +1004,8 @@ impl// Invalid states for this flowcommon_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation => None,- common_enums::IntentStatus::RequiresCapture => {+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {let total_amount = payment_data.payment_attempt.amount_details.get_net_amount();Some(total_amount)}@@ -1033,7 +1039,8 @@ impl| common_enums::IntentStatus::CancelledPostCapture| common_enums::IntentStatus::Failed| common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),- common_enums::IntentStatus::RequiresCapture => {+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {let total_amount = payment_data.payment_attempt.amount_details.get_net_amount();Some(total_amount)}@@ -1238,7 +1245,8 @@ impl// Invalid states for this flowcommon_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation => None,- common_enums::IntentStatus::RequiresCapture => {+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {let total_amount = payment_attempt.amount_details.get_net_amount();Some(total_amount)}@@ -1278,7 +1286,8 @@ impl// Invalid states for this flowcommon_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation => None,- common_enums::IntentStatus::RequiresCapture => {+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {let total_amount = payment_attempt.amount_details.get_net_amount();Some(total_amount)}@@ -1477,7 +1486,8 @@ impl// If status is requires capture, get the total amount that can be captured// This is in cases where the capture method will be `manual` or `manual_multiple`// We do not need to handle the case where amount_to_capture is provided here as it cannot be passed in authroize flow- common_enums::IntentStatus::RequiresCapture => {+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {let total_amount = payment_data.payment_attempt.amount_details.get_net_amount();Some(total_amount)}@@ -1513,7 +1523,10 @@ implcommon_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation => None,// No amount has been captured yet- common_enums::IntentStatus::RequiresCapture => Some(MinorUnit::zero()),+ common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {+ Some(MinorUnit::zero())+ }// Invalid statues for this flowcommon_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex 59269fb68b..8d1bf9ffaa 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -82,6 +82,7 @@ pub struct PaymentsAuthorizeData {pub order_id: Option<String>,pub locale: Option<String>,pub payment_channel: Option<common_enums::PaymentChannel>,+ pub enable_partial_authorization: Option<bool>,}#[derive(Debug, Clone)]pub struct PaymentsPostSessionTokensData {@@ -1055,6 +1056,7 @@ pub struct SetupMandateRequestData {pub shipping_cost: Option<MinorUnit>,pub connector_testing_data: Option<pii::SecretSerdeValue>,pub customer_id: Option<id_type::CustomerId>,+ pub enable_partial_authorization: Option<bool>,}#[derive(Debug, Clone)]diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rsindex 93c7d5c2cf..633a7172be 100644--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs@@ -87,6 +87,7 @@ fn get_default_router_data<F, Req, Resp>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,}}diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rsindex 435c432c77..7440a569d1 100644--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs@@ -431,7 +431,10 @@ impl From<api_enums::IntentStatus> for StripePaymentStatus {api_enums::IntentStatus::RequiresPaymentMethod => Self::RequiresPaymentMethod,api_enums::IntentStatus::RequiresConfirmation => Self::RequiresConfirmation,api_enums::IntentStatus::RequiresCapture- | api_enums::IntentStatus::PartiallyCapturedAndCapturable => Self::RequiresCapture,+ | api_enums::IntentStatus::PartiallyCapturedAndCapturable+ | api_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {+ Self::RequiresCapture+ }api_enums::IntentStatus::Cancelled | api_enums::IntentStatus::CancelledPostCapture => {Self::Canceled}diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rsindex 531977842e..872c58a6f7 100644--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs@@ -313,7 +313,8 @@ impl From<api_enums::IntentStatus> for StripeSetupStatus {Self::Succeeded}api_enums::IntentStatus::Failed | api_enums::IntentStatus::Expired => Self::Canceled,- api_enums::IntentStatus::Processing => Self::Processing,+ api_enums::IntentStatus::Processing+ | api_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => Self::Processing,api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,api_enums::IntentStatus::RequiresMerchantAction| api_enums::IntentStatus::Conflicted => Self::RequiresAction,diff --git a/crates/router/src/compatibility/stripe/webhooks.rs b/crates/router/src/compatibility/stripe/webhooks.rsindex 196ab4cc43..14a254f397 100644--- a/crates/router/src/compatibility/stripe/webhooks.rs+++ b/crates/router/src/compatibility/stripe/webhooks.rs@@ -269,7 +269,8 @@ fn get_stripe_event_type(event_type: api_models::enums::EventType) -> &'static smatch event_type {api_models::enums::EventType::PaymentSucceeded => "payment_intent.succeeded",api_models::enums::EventType::PaymentFailed => "payment_intent.payment_failed",- api_models::enums::EventType::PaymentProcessing => "payment_intent.processing",+ api_models::enums::EventType::PaymentProcessing+ | api_models::enums::EventType::PaymentPartiallyAuthorized => "payment_intent.processing",api_models::enums::EventType::PaymentCancelled| api_models::enums::EventType::PaymentCancelledPostCapture| api_models::enums::EventType::PaymentExpired => "payment_intent.canceled",diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rsindex 9fea07540f..58841c7758 100644--- a/crates/router/src/connector/utils.rs+++ b/crates/router/src/connector/utils.rs@@ -141,11 +141,14 @@ pub trait PaymentResponseRouterData {fn get_attempt_status_for_db_update<F>(&self,payment_data: &PaymentData<F>,- ) -> enums::AttemptStatus+ amount_captured: Option<i64>,+ amount_capturable: Option<i64>,+ ) -> CustomResult<enums::AttemptStatus, ApiErrorResponse>whereF: Clone;}+#[cfg(feature = "v1")]impl<Flow, Request, Response> PaymentResponseRouterDatafor types::RouterData<Flow, Request, Response>where@@ -154,31 +157,133 @@ wherefn get_attempt_status_for_db_update<F>(&self,payment_data: &PaymentData<F>,- ) -> enums::AttemptStatus+ amount_captured: Option<i64>,+ amount_capturable: Option<i64>,+ ) -> CustomResult<enums::AttemptStatus, ApiErrorResponse>whereF: Clone,{match self.status {enums::AttemptStatus::Voided => {if payment_data.payment_intent.amount_captured > Some(MinorUnit::new(0)) {- enums::AttemptStatus::PartialCharged+ Ok(enums::AttemptStatus::PartialCharged)} else {- self.status+ Ok(self.status)}}enums::AttemptStatus::Charged => {- let captured_amount =- types::Capturable::get_captured_amount(&self.request, payment_data);+ let captured_amount = types::Capturable::get_captured_amount(+ &self.request,+ amount_captured,+ payment_data,+ );let total_capturable_amount = payment_data.payment_attempt.get_total_amount();if Some(total_capturable_amount) == captured_amount.map(MinorUnit::new) {- enums::AttemptStatus::Charged+ Ok(enums::AttemptStatus::Charged)} else if captured_amount.is_some() {- enums::AttemptStatus::PartialCharged+ Ok(enums::AttemptStatus::PartialCharged)+ } else {+ Ok(self.status)+ }+ }+ enums::AttemptStatus::Authorized => {+ let capturable_amount = types::Capturable::get_amount_capturable(+ &self.request,+ payment_data,+ amount_capturable,+ payment_data.payment_attempt.status,+ );+ if Some(payment_data.payment_attempt.get_total_amount())+ == capturable_amount.map(MinorUnit::new)+ {+ Ok(enums::AttemptStatus::Authorized)+ } else if capturable_amount.is_some()+ && payment_data+ .payment_intent+ .enable_partial_authorization+ .is_some_and(|val| val)+ {+ Ok(enums::AttemptStatus::PartiallyAuthorized)+ } else if capturable_amount.is_some()+ && !payment_data+ .payment_intent+ .enable_partial_authorization+ .is_some_and(|val| val)+ {+ Err(ApiErrorResponse::IntegrityCheckFailed {+ reason: "capturable_amount is less than the total attempt amount"+ .to_string(),+ field_names: "amount_capturable".to_string(),+ connector_transaction_id: payment_data+ .payment_attempt+ .connector_transaction_id+ .clone(),+ })?+ } else {+ Ok(self.status)+ }+ }+ _ => Ok(self.status),+ }+ }+}++#[cfg(feature = "v2")]+impl<Flow, Request, Response> PaymentResponseRouterData+ for types::RouterData<Flow, Request, Response>+where+ Request: types::Capturable,+{+ fn get_attempt_status_for_db_update<F>(+ &self,+ payment_data: &PaymentData<F>,+ amount_captured: Option<i64>,+ amount_capturable: Option<i64>,+ ) -> CustomResult<enums::AttemptStatus, ApiErrorResponse>+ where+ F: Clone,+ {+ match self.status {+ enums::AttemptStatus::Voided => {+ if payment_data.payment_intent.amount_captured > Some(MinorUnit::new(0)) {+ Ok(enums::AttemptStatus::PartialCharged)+ } else {+ Ok(self.status)+ }+ }+ enums::AttemptStatus::Charged => {+ let captured_amount = types::Capturable::get_captured_amount(+ &self.request,+ amount_captured,+ payment_data,+ );+ let total_capturable_amount = payment_data.payment_attempt.get_total_amount();+ if Some(total_capturable_amount) == captured_amount.map(MinorUnit::new) {+ Ok(enums::AttemptStatus::Charged)+ } else if captured_amount.is_some() {+ Ok(enums::AttemptStatus::PartialCharged)+ } else {+ Ok(self.status)+ }+ }+ enums::AttemptStatus::Authorized => {+ let capturable_amount = types::Capturable::get_amount_capturable(+ &self.request,+ payment_data,+ amount_capturable,+ payment_data.payment_attempt.status,+ );+ if Some(payment_data.payment_attempt.get_total_amount())+ == capturable_amount.map(MinorUnit::new)+ {+ Ok(enums::AttemptStatus::Authorized)+ } else if capturable_amount.is_some() {+ Ok(enums::AttemptStatus::PartiallyAuthorized)} else {- self.status+ Ok(self.status)}}- _ => self.status,+ _ => Ok(self.status),}}}@@ -2183,7 +2288,8 @@ impl FrmTransactionRouterDataRequest for fraud_check::FrmTransactionRouterData {storage_enums::AttemptStatus::AuthenticationSuccessful| storage_enums::AttemptStatus::PartialChargedAndChargeable| storage_enums::AttemptStatus::Authorized- | storage_enums::AttemptStatus::Charged => Some(true),+ | storage_enums::AttemptStatus::Charged+ | storage_enums::AttemptStatus::PartiallyAuthorized => Some(true),storage_enums::AttemptStatus::Started| storage_enums::AttemptStatus::AuthenticationPending@@ -2231,7 +2337,8 @@ pub fn is_payment_failure(status: enums::AttemptStatus) -> bool {| common_enums::AttemptStatus::PaymentMethodAwaited| common_enums::AttemptStatus::ConfirmationAwaited| common_enums::AttemptStatus::DeviceDataCollectionPending- | common_enums::AttemptStatus::IntegrityFailure => false,+ | common_enums::AttemptStatus::IntegrityFailure+ | common_enums::AttemptStatus::PartiallyAuthorized => false,}}diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rsindex 7df31b8553..273da3e00c 100644--- a/crates/router/src/core/authentication/transformers.rs+++ b/crates/router/src/core/authentication/transformers.rs@@ -209,6 +209,7 @@ pub fn construct_router_data<F: Clone, Req, Res>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,})}diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rsindex 560cc97d63..8d744b7623 100644--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs@@ -161,6 +161,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudCraw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rsindex 3147b8306e..18f080a2fd 100644--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs@@ -135,6 +135,7 @@ pub async fn construct_fulfillment_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rsindex d1fd0410f7..a86b829b86 100644--- a/crates/router/src/core/fraud_check/flows/record_return.rs+++ b/crates/router/src/core/fraud_check/flows/record_return.rs@@ -132,6 +132,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudChraw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rsindex 60e50996a1..4c48c8d393 100644--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs@@ -140,6 +140,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckRespraw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rsindex 5a1799c383..ad01801a48 100644--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs@@ -149,6 +149,7 @@ implraw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rsindex 53948384c3..ead8cf2780 100644--- a/crates/router/src/core/mandate/utils.rs+++ b/crates/router/src/core/mandate/utils.rs@@ -88,6 +88,7 @@ pub async fn construct_mandate_revoke_router_data(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 9cc9c51a44..8dd79f95d9 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -3320,6 +3320,7 @@ async fn create_single_use_tokenization_flow(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};let payment_method_token_response = Box::pin(tokenization::add_token_for_payment_method(diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 3da45e7ad2..d70dc7933b 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3158,6 +3158,7 @@ impl ValidateStatusForOperation for &PaymentRedirectSync {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturable@@ -6959,6 +6960,7 @@ wherematches!(payment_data.get_payment_intent().status,storage_enums::IntentStatus::RequiresCapture+ | storage_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| storage_enums::IntentStatus::PartiallyCapturedAndCapturable) || (matches!(payment_data.get_payment_intent().status,diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 65221703c5..bcf23d90e6 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -2927,6 +2927,7 @@ pub(crate) fn validate_status_with_capture_method(utils::when(status != storage_enums::IntentStatus::RequiresCapture&& status != storage_enums::IntentStatus::PartiallyCapturedAndCapturable+ && status != storage_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture&& status != storage_enums::IntentStatus::Processing,|| {Err(report!(errors::ApiErrorResponse::PaymentUnexpectedState {@@ -3897,6 +3898,7 @@ mod tests {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());@@ -3980,6 +3982,7 @@ mod tests {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())@@ -4061,6 +4064,7 @@ mod tests {order_date: None,shipping_amount_tax: None,duty_amount: None,+ enable_partial_authorization: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())@@ -4397,6 +4401,7 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(raw_connector_response: router_data.raw_connector_response,is_payment_id_from_merchant: router_data.is_payment_id_from_merchant,l2_l3_data: router_data.l2_l3_data,+ minor_amount_capturable: router_data.minor_amount_capturable,}}@@ -4442,7 +4447,8 @@ pub fn get_attempt_type(| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::DeviceDataCollectionPending| enums::AttemptStatus::IntegrityFailure- | enums::AttemptStatus::Expired => {+ | enums::AttemptStatus::Expired+ | enums::AttemptStatus::PartiallyAuthorized => {metrics::MANUAL_RETRY_VALIDATION_FAILED.add(1,router_env::metric_attributes!((@@ -4500,7 +4506,8 @@ pub fn get_attempt_type(| enums::IntentStatus::Processing| enums::IntentStatus::Succeeded| enums::IntentStatus::Conflicted- | enums::IntentStatus::Expired => {+ | enums::IntentStatus::Expired+ | enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => {Err(report!(errors::ApiErrorResponse::PreconditionFailed {message: format!("You cannot {action} this payment because it has status {}",@@ -4749,7 +4756,8 @@ pub fn is_manual_retry_allowed(| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::DeviceDataCollectionPending| enums::AttemptStatus::IntegrityFailure- | enums::AttemptStatus::Expired => {+ | enums::AttemptStatus::Expired+ | enums::AttemptStatus::PartiallyAuthorized => {logger::error!("Payment Attempt should not be in this state because Attempt to Intent status mapping doesn't allow it");None}@@ -4770,7 +4778,8 @@ pub fn is_manual_retry_allowed(| enums::IntentStatus::Processing| enums::IntentStatus::Succeeded| enums::IntentStatus::Conflicted- | enums::IntentStatus::Expired => Some(false),+ | enums::IntentStatus::Expired+ | enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => Some(false),enums::IntentStatus::RequiresCustomerAction| enums::IntentStatus::RequiresMerchantActiondiff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rsindex f0b548891d..9f630c8424 100644--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs@@ -86,6 +86,7 @@ impl ValidateStatusForOperation for PaymentAttemptRecord {| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rsindex 9c2e766e55..53c1487afd 100644--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs@@ -33,6 +33,7 @@ impl ValidateStatusForOperation for PaymentsCapture {) -> Result<(), errors::ApiErrorResponse> {match intent_status {common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCapturedAndCapturable => Ok(()),common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Conflicteddiff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 55d95cc6df..9b2f2d85e8 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -467,6 +467,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>)}).unwrap_or(Ok(payment_intent.request_incremental_authorization))?;+ payment_intent.enable_partial_authorization = request+ .enable_partial_authorization+ .or(payment_intent.enable_partial_authorization);payment_attempt.business_sub_label = request.business_sub_label.clone()@@ -1846,7 +1849,6 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> forlet order_details = payment_data.payment_intent.order_details.clone();let metadata = payment_data.payment_intent.metadata.clone();let frm_metadata = payment_data.payment_intent.frm_metadata.clone();- let authorized_amount = payment_data.payment_attempt.get_total_amount();let client_source = header_payload.client_source@@ -1936,7 +1938,6 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> forstraight_through_algorithm: m_straight_through_algorithm,error_code: m_error_code,error_message: m_error_message,- amount_capturable: Some(authorized_amount),updated_by: storage_scheme.to_string(),merchant_connector_id,external_three_ds_authentication_attempted,@@ -2060,6 +2061,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> fororder_date: payment_data.payment_intent.order_date,shipping_amount_tax: payment_data.payment_intent.shipping_amount_tax,duty_amount: payment_data.payment_intent.duty_amount,+ enable_partial_authorization: payment_data+ .payment_intent+ .enable_partial_authorization,})),&m_key_store,storage_scheme,diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rsindex 73aa834613..edffe30c14 100644--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs@@ -52,6 +52,7 @@ impl ValidateStatusForOperation for PaymentIntentConfirm {| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 01eb94cdad..d9b71791df 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -1628,6 +1628,7 @@ impl PaymentCreate {duty_amount: request.duty_amount,tax_status: request.tax_status,shipping_amount_tax: request.shipping_amount_tax,+ enable_partial_authorization: request.enable_partial_authorization,})}diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rsindex 3f4fb5ee6a..d305869130 100644--- a/crates/router/src/core/payments/operations/payment_get.rs+++ b/crates/router/src/core/payments/operations/payment_get.rs@@ -34,6 +34,7 @@ impl ValidateStatusForOperation for PaymentGet {) -> Result<(), errors::ApiErrorResponse> {match intent_status {common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::Processing@@ -54,6 +55,7 @@ impl ValidateStatusForOperation for PaymentGet {current_value: intent_status.to_string(),states: [common_enums::IntentStatus::RequiresCapture,+ common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture,common_enums::IntentStatus::RequiresCustomerAction,common_enums::IntentStatus::RequiresMerchantAction,common_enums::IntentStatus::Processing,diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rsindex 84deb90605..450ca96630 100644--- a/crates/router/src/core/payments/operations/payment_response.rs+++ b/crates/router/src/core/payments/operations/payment_response.rs@@ -1576,7 +1576,13 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(error_reason: Some(err.reason),amount_capturable: router_data.request- .get_amount_capturable(&payment_data, status)+ .get_amount_capturable(+ &payment_data,+ router_data+ .minor_amount_capturable+ .map(MinorUnit::get_amount_as_i64),+ status,+ ).map(MinorUnit::new),updated_by: storage_scheme.to_string(),unified_code: Some(Some(unified_code)),@@ -1645,9 +1651,21 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>() => match frm_message.frm_status {enums::FraudCheckStatus::Fraud| enums::FraudCheckStatus::ManualReview => attempt_status,- _ => router_data.get_attempt_status_for_db_update(&payment_data),+ _ => router_data.get_attempt_status_for_db_update(+ &payment_data,+ router_data.amount_captured,+ router_data+ .minor_amount_capturable+ .map(MinorUnit::get_amount_as_i64),+ )?,},- _ => router_data.get_attempt_status_for_db_update(&payment_data),+ _ => router_data.get_attempt_status_for_db_update(+ &payment_data,+ router_data.amount_captured,+ router_data+ .minor_amount_capturable+ .map(MinorUnit::get_amount_as_i64),+ )?,};match payments_response {types::PaymentsResponseData::PreProcessingResponse {@@ -1736,7 +1754,9 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(// update connector_mandate_details in case of Authorized/Charged Payment Statusif matches!(router_data.status,- enums::AttemptStatus::Charged | enums::AttemptStatus::Authorized+ enums::AttemptStatus::Charged+ | enums::AttemptStatus::Authorized+ | enums::AttemptStatus::PartiallyAuthorized) {payment_data.payment_intent@@ -1881,6 +1901,9 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(.request.get_amount_capturable(&payment_data,+ router_data+ .minor_amount_capturable+ .map(MinorUnit::get_amount_as_i64),updated_attempt_status,).map(MinorUnit::new),@@ -2616,6 +2639,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor| common_enums::AttemptStatus::AuthenticationPending| common_enums::AttemptStatus::AuthenticationSuccessful| common_enums::AttemptStatus::Authorized+ | common_enums::AttemptStatus::PartiallyAuthorized| common_enums::AttemptStatus::Charged| common_enums::AttemptStatus::Authorizing| common_enums::AttemptStatus::CodInitiated@@ -3033,7 +3057,10 @@ fn get_total_amount_captured<F: Clone, T: types::Capturable>(None => {//Non multiple capturelet amount = request- .get_captured_amount(payment_data)+ .get_captured_amount(+ amount_captured.map(MinorUnit::get_amount_as_i64),+ payment_data,+ ).map(MinorUnit::new);amount_captured.or_else(|| {if router_data_status == enums::AttemptStatus::Charged {diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rsindex da6a8b9e04..d50c5da81c 100644--- a/crates/router/src/core/payments/operations/payment_session_intent.rs+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs@@ -38,6 +38,7 @@ impl ValidateStatusForOperation for PaymentSessionIntent {| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex 0d3f2844bf..e2e4fb824b 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -456,6 +456,10 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>.clone().or(payment_intent.payment_channel);+ payment_intent.enable_partial_authorization = request+ .enable_partial_authorization+ .or(payment_intent.enable_partial_authorization);+let payment_data = PaymentData {flow: PhantomData,payment_intent,@@ -954,6 +958,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> fororder_date: payment_data.payment_intent.order_date,shipping_amount_tax: payment_data.payment_intent.shipping_amount_tax,duty_amount: payment_data.payment_intent.duty_amount,+ enable_partial_authorization: payment_data+ .payment_intent+ .enable_partial_authorization,})),key_store,storage_scheme,diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rsindex b8f19580f1..2100ec3762 100644--- a/crates/router/src/core/payments/operations/payment_update_intent.rs+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs@@ -58,6 +58,7 @@ impl ValidateStatusForOperation for PaymentUpdateIntent {| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rsindex c9721186ab..45c7cb18c3 100644--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs@@ -53,6 +53,7 @@ impl ValidateStatusForOperation for PaymentProxyIntent {| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rsindex 93a7456d85..61a8f71a1f 100644--- a/crates/router/src/core/payments/payment_methods.rs+++ b/crates/router/src/core/payments/payment_methods.rs@@ -745,6 +745,7 @@ fn validate_payment_status_for_payment_method_list(| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturablediff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex 0ce5bd5467..b49103b961 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -797,7 +797,8 @@ impl<F: Send + Clone + Sync, FData: Send + Sync>| storage_enums::AttemptStatus::Unresolved| storage_enums::AttemptStatus::DeviceDataCollectionPending| storage_enums::AttemptStatus::IntegrityFailure- | storage_enums::AttemptStatus::Expired => false,+ | storage_enums::AttemptStatus::Expired+ | storage_enums::AttemptStatus::PartiallyAuthorized => false,storage_enums::AttemptStatus::AuthenticationFailed| storage_enums::AttemptStatus::AuthorizationFaileddiff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 278a2fb666..2cdbc13f99 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -176,6 +176,7 @@ whereraw_connector_response: None,is_payment_id_from_merchant: payment_data.payment_intent.is_payment_id_from_merchant,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -329,6 +330,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(order_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: None,};let connector_mandate_request_reference_id = payment_data.payment_attempt@@ -409,6 +411,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(raw_connector_response: None,is_payment_id_from_merchant: payment_data.payment_intent.is_payment_id_from_merchant,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -575,6 +578,7 @@ pub async fn construct_payment_router_data_for_capture<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -704,6 +708,7 @@ pub async fn construct_router_data_for_psync<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -888,6 +893,7 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -1028,6 +1034,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(complete_authorize_url,connector_testing_data: None,customer_id: None,+ enable_partial_authorization: None,};let connector_mandate_request_reference_id = payment_data.payment_attempt@@ -1108,6 +1115,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -1375,6 +1383,7 @@ whereraw_connector_response: None,is_payment_id_from_merchant: payment_data.payment_intent.is_payment_id_from_merchant,l2_l3_data,+ minor_amount_capturable: None,};Ok(router_data)@@ -1569,6 +1578,7 @@ pub async fn construct_payment_router_data_for_update_metadata<'a>(raw_connector_response: None,is_payment_id_from_merchant: payment_data.payment_intent.is_payment_id_from_merchant,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -3084,6 +3094,7 @@ whereis_iframe_redirection_enabled: payment_intent.is_iframe_redirection_enabled,whole_connector_response: payment_data.get_whole_connector_response(),payment_channel: payment_intent.payment_channel,+ enable_partial_authorization: payment_intent.enable_partial_authorization,};services::ApplicationResponse::JsonWithHeaders((payments_response, headers))@@ -3380,6 +3391,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Payis_iframe_redirection_enabled:pi.is_iframe_redirection_enabled,payment_channel: pi.payment_channel,network_transaction_id: None,+ enable_partial_authorization: pi.enable_partial_authorization,}}}@@ -3710,6 +3722,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthorizorder_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: None,})}}@@ -3943,6 +3956,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthorizorder_id: None,locale: Some(additional_data.state.locale.clone()),payment_channel: payment_data.payment_intent.payment_channel,+ enable_partial_authorization: payment_data.payment_intent.enable_partial_authorization,})}}@@ -4839,6 +4853,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequcapture_method: payment_data.payment_attempt.capture_method,connector_testing_data,customer_id: payment_data.payment_intent.customer_id,+ enable_partial_authorization: payment_data.payment_intent.enable_partial_authorization,})}}diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rsindex f958bf578d..4515ac1ff2 100644--- a/crates/router/src/core/relay/utils.rs+++ b/crates/router/src/core/relay/utils.rs@@ -146,6 +146,7 @@ pub async fn construct_relay_refund_router_data<F>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)diff --git a/crates/router/src/core/revenue_recovery/transformers.rs b/crates/router/src/core/revenue_recovery/transformers.rsindex 7faccbd0d7..e60eac6934 100644--- a/crates/router/src/core/revenue_recovery/transformers.rs+++ b/crates/router/src/core/revenue_recovery/transformers.rs@@ -8,9 +8,10 @@ use crate::{impl ForeignFrom<AttemptStatus> for RevenueRecoveryPaymentsAttemptStatus {fn foreign_from(s: AttemptStatus) -> Self {match s {- AttemptStatus::Authorized | AttemptStatus::Charged | AttemptStatus::AutoRefunded => {- Self::Succeeded- }+ AttemptStatus::Authorized+ | AttemptStatus::Charged+ | AttemptStatus::AutoRefunded+ | AttemptStatus::PartiallyAuthorized => Self::Succeeded,AttemptStatus::Started| AttemptStatus::AuthenticationSuccessfuldiff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rsindex b43f0138f3..b04df14922 100644--- a/crates/router/src/core/routing/helpers.rs+++ b/crates/router/src/core/routing/helpers.rs@@ -1691,9 +1691,8 @@ fn get_desired_payment_status_for_dynamic_routing_metrics(common_enums::AttemptStatus::Charged| common_enums::AttemptStatus::Authorized| common_enums::AttemptStatus::PartialCharged- | common_enums::AttemptStatus::PartialChargedAndChargeable => {- common_enums::AttemptStatus::Charged- }+ | common_enums::AttemptStatus::PartialChargedAndChargeable+ | common_enums::AttemptStatus::PartiallyAuthorized => common_enums::AttemptStatus::Charged,common_enums::AttemptStatus::Failure| common_enums::AttemptStatus::AuthorizationFailed| common_enums::AttemptStatus::AuthenticationFailed@@ -1729,7 +1728,8 @@ impl ForeignFrom<common_enums::AttemptStatus> for open_router::TxnStatus {common_enums::AttemptStatus::RouterDeclined => Self::JuspayDeclined,common_enums::AttemptStatus::AuthenticationPending => Self::PendingVbv,common_enums::AttemptStatus::AuthenticationSuccessful => Self::VBVSuccessful,- common_enums::AttemptStatus::Authorized => Self::Authorized,+ common_enums::AttemptStatus::Authorized+ | common_enums::AttemptStatus::PartiallyAuthorized => Self::Authorized,common_enums::AttemptStatus::AuthorizationFailed => Self::AuthorizationFailed,common_enums::AttemptStatus::Charged => Self::Charged,common_enums::AttemptStatus::Authorizing => Self::Authorizing,diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rsindex b262b39da9..8d6e27e065 100644--- a/crates/router/src/core/unified_authentication_service/utils.rs+++ b/crates/router/src/core/unified_authentication_service/utils.rs@@ -129,6 +129,7 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,})}diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex de5f3d4997..987ae7f602 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -240,6 +240,7 @@ pub async fn construct_payout_router_data<'a, F>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -409,6 +410,7 @@ pub async fn construct_refund_router_data<'a, F>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -614,6 +616,7 @@ pub async fn construct_refund_router_data<'a, F>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)@@ -1053,6 +1056,7 @@ pub async fn construct_accept_dispute_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1155,6 +1159,7 @@ pub async fn construct_submit_evidence_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1266,6 +1271,7 @@ pub async fn construct_upload_file_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1338,6 +1344,7 @@ pub async fn construct_dispute_list_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,})}@@ -1442,6 +1449,7 @@ pub async fn construct_dispute_sync_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1569,6 +1577,7 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<F: Clone>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1674,6 +1683,7 @@ pub async fn construct_defend_dispute_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}@@ -1773,6 +1783,7 @@ pub async fn construct_retrieve_file_router_data<'a>(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rsindex dfca569ba2..45b6c24a2e 100644--- a/crates/router/src/core/webhooks/utils.rs+++ b/crates/router/src/core/webhooks/utils.rs@@ -136,6 +136,7 @@ pub async fn construct_webhook_router_data(raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,};Ok(router_data)}diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rsindex 1a3fdb3cab..e821c08cad 100644--- a/crates/router/src/db/events.rs+++ b/crates/router/src/db/events.rs@@ -1403,6 +1403,7 @@ mod tests {whole_connector_response: None,payment_channel: None,network_transaction_id: None,+ enable_partial_authorization: None,};let content =api_webhooks::OutgoingWebhookContent::PaymentDetails(Box::new(expected_response));diff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex f7ab32badc..12f5bbe41e 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -267,7 +267,11 @@ pub trait PayoutIndividualDetailsExt {}pub trait Capturable {- fn get_captured_amount<F>(&self, _payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ _payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{@@ -276,6 +280,7 @@ pub trait Capturable {fn get_amount_capturable<F>(&self,_payment_data: &PaymentData<F>,+ _get_amount_capturable: Option<i64>,_attempt_status: common_enums::AttemptStatus,) -> Option<i64>where@@ -287,27 +292,32 @@ pub trait Capturable {#[cfg(feature = "v1")]impl Capturable for PaymentsAuthorizeData {- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{- Some(+ amount_captured.or(Some(payment_data.payment_attempt.get_total_amount().get_amount_as_i64(),- )+ ))}fn get_amount_capturable<F>(&self,payment_data: &PaymentData<F>,+ amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>whereF: Clone,{- match payment_data.get_capture_method().unwrap_or_default()+ let amount_capturable_from_intent_status = match payment_data.get_capture_method().unwrap_or_default(){common_enums::CaptureMethod::Automatic| common_enums::CaptureMethod::SequentialAutomatic => {@@ -315,7 +325,6 @@ impl Capturable for PaymentsAuthorizeData {match intent_status {common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed- | common_enums::IntentStatus::Processing| common_enums::IntentStatus::Conflicted| common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Cancelled@@ -326,7 +335,9 @@ impl Capturable for PaymentsAuthorizeData {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresCapture- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture+ | common_enums::IntentStatus::Processing => None,}},common_enums::CaptureMethod::Manual => Some(payment_data.payment_attempt.get_total_amount().get_amount_as_i64()),@@ -334,13 +345,25 @@ impl Capturable for PaymentsAuthorizeData {common_enums::CaptureMethod::ManualMultiple |// Scheduled capture is not supported as of nowcommon_enums::CaptureMethod::Scheduled => None,- }+ };+ amount_capturable+ .or(amount_capturable_from_intent_status)+ .or(Some(+ payment_data+ .payment_attempt+ .get_total_amount()+ .get_amount_as_i64(),+ ))}}#[cfg(feature = "v1")]impl Capturable for PaymentsCaptureData {- fn get_captured_amount<F>(&self, _payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ _payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{@@ -349,6 +372,7 @@ impl Capturable for PaymentsCaptureData {fn get_amount_capturable<F>(&self,_payment_data: &PaymentData<F>,+ _amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>where@@ -369,33 +393,39 @@ impl Capturable for PaymentsCaptureData {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresCapture- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => None,}}}#[cfg(feature = "v1")]impl Capturable for CompleteAuthorizeData {- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{- Some(+ amount_captured.or(Some(payment_data.payment_attempt.get_total_amount().get_amount_as_i64(),- )+ ))}fn get_amount_capturable<F>(&self,payment_data: &PaymentData<F>,+ amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>whereF: Clone,{- match payment_data+ let amount_capturable_from_intent_status = match payment_data.get_capture_method().unwrap_or_default(){@@ -404,7 +434,6 @@ impl Capturable for CompleteAuthorizeData {match intent_status {common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed- | common_enums::IntentStatus::Processing| common_enums::IntentStatus::Conflicted| common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::PartiallyCaptured@@ -414,7 +443,9 @@ impl Capturable for CompleteAuthorizeData {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresCapture- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture+ | common_enums::IntentStatus::Processing => None,}},common_enums::CaptureMethod::Manual => Some(payment_data.payment_attempt.get_total_amount().get_amount_as_i64()),@@ -422,7 +453,15 @@ impl Capturable for CompleteAuthorizeData {common_enums::CaptureMethod::ManualMultiple |// Scheduled capture is not supported as of nowcommon_enums::CaptureMethod::Scheduled => None,- }+ };+ amount_capturable+ .or(amount_capturable_from_intent_status)+ .or(Some(+ payment_data+ .payment_attempt+ .get_total_amount()+ .get_amount_as_i64(),+ ))}}@@ -432,7 +471,11 @@ impl Capturable for SdkPaymentsSessionUpdateData {}impl Capturable for PaymentsPostSessionTokensData {}impl Capturable for PaymentsUpdateMetadataData {}impl Capturable for PaymentsCancelData {- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{@@ -445,6 +488,7 @@ impl Capturable for PaymentsCancelData {fn get_amount_capturable<F>(&self,_payment_data: &PaymentData<F>,+ _amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>where@@ -465,12 +509,17 @@ impl Capturable for PaymentsCancelData {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresCapture+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture| common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,}}}impl Capturable for PaymentsCancelPostCaptureData {- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{@@ -483,6 +532,7 @@ impl Capturable for PaymentsCancelPostCaptureData {fn get_amount_capturable<F>(&self,_payment_data: &PaymentData<F>,+ _amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>where@@ -492,7 +542,6 @@ impl Capturable for PaymentsCancelPostCaptureData {match intent_status {common_enums::IntentStatus::Cancelled| common_enums::IntentStatus::CancelledPostCapture- | common_enums::IntentStatus::Processing| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::Conflicted| common_enums::IntentStatus::Expired => Some(0),@@ -503,7 +552,9 @@ impl Capturable for PaymentsCancelPostCaptureData {| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresCapture- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Processing+ | common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => None,}}}@@ -514,29 +565,39 @@ impl Capturable for PaymentsIncrementalAuthorizationData {fn get_amount_capturable<F>(&self,_payment_data: &PaymentData<F>,+ amount_capturable: Option<i64>,_attempt_status: common_enums::AttemptStatus,) -> Option<i64>whereF: Clone,{- Some(self.total_amount)+ amount_capturable.or(Some(self.total_amount))}}impl Capturable for PaymentsSyncData {#[cfg(feature = "v1")]- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{payment_data.payment_attempt.amount_to_capture+ .or(payment_data.payment_intent.amount_captured).or_else(|| Some(payment_data.payment_attempt.get_total_amount())).map(|amt| amt.get_amount_as_i64())}#[cfg(feature = "v2")]- fn get_captured_amount<F>(&self, payment_data: &PaymentData<F>) -> Option<i64>+ fn get_captured_amount<F>(+ &self,+ _amount_captured: Option<i64>,+ payment_data: &PaymentData<F>,+ ) -> Option<i64>whereF: Clone,{@@ -549,9 +610,30 @@ impl Capturable for PaymentsSyncData {.map(|amt| amt.get_amount_as_i64())}+ #[cfg(feature = "v1")]fn get_amount_capturable<F>(&self,- _payment_data: &PaymentData<F>,+ payment_data: &PaymentData<F>,+ amount_capturable: Option<i64>,+ attempt_status: common_enums::AttemptStatus,+ ) -> Option<i64>+ where+ F: Clone,+ {+ if attempt_status.is_terminal_status() {+ Some(0)+ } else {+ amount_capturable.or(Some(MinorUnit::get_amount_as_i64(+ payment_data.payment_attempt.amount_capturable,+ )))+ }+ }++ #[cfg(feature = "v2")]+ fn get_amount_capturable<F>(+ &self,+ payment_data: &PaymentData<F>,+ amount_capturable: Option<i64>,attempt_status: common_enums::AttemptStatus,) -> Option<i64>where@@ -1155,6 +1237,7 @@ impl ForeignFrom<&SetupMandateRouterData> for PaymentsAuthorizeData {order_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: data.request.enable_partial_authorization,}}}@@ -1219,6 +1302,7 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)raw_connector_response: data.raw_connector_response.clone(),is_payment_id_from_merchant: data.is_payment_id_from_merchant,l2_l3_data: data.l2_l3_data.clone(),+ minor_amount_capturable: data.minor_amount_capturable,}}}@@ -1289,6 +1373,7 @@ impl<F1, F2>raw_connector_response: None,is_payment_id_from_merchant: data.is_payment_id_from_merchant,l2_l3_data: None,+ minor_amount_capturable: None,}}}diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rsindex 6c43f14c4e..b73c496201 100644--- a/crates/router/src/types/api/verify_connector.rs+++ b/crates/router/src/types/api/verify_connector.rs@@ -67,6 +67,7 @@ impl VerifyConnectorData {order_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: None,}}@@ -132,6 +133,7 @@ impl VerifyConnectorData {raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,}}}diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 0b834ff962..b1c1bf0a05 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -169,6 +169,7 @@ impl ForeignTryFrom<storage_enums::AttemptStatus> for storage_enums::CaptureStat| storage_enums::AttemptStatus::PaymentMethodAwaited| storage_enums::AttemptStatus::ConfirmationAwaited| storage_enums::AttemptStatus::DeviceDataCollectionPending+ | storage_enums::AttemptStatus::PartiallyAuthorized| storage_enums::AttemptStatus::PartialChargedAndChargeable | storage_enums::AttemptStatus::Expired => {Err(errors::ApiErrorResponse::PreconditionFailed {message: "AttemptStatus must be one of these for multiple partial captures [Charged, PartialCharged, Pending, CaptureInitiated, Failure, CaptureFailed]".into(),diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rsindex 7bdecec4ab..f7253fc057 100644--- a/crates/router/src/utils/user/sample_data.rs+++ b/crates/router/src/utils/user/sample_data.rs@@ -296,6 +296,7 @@ pub async fn generate_sample_data(duty_amount: None,tax_status: None,shipping_amount_tax: None,+ enable_partial_authorization: None,};let (connector_transaction_id, processor_transaction_data) =ConnectorTransactionId::form_id_and_data(attempt_id.clone());diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rsindex cb3581e1c8..9d3544d5ce 100644--- a/crates/router/tests/connectors/aci.rs+++ b/crates/router/tests/connectors/aci.rs@@ -82,6 +82,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {authentication_data: None,customer_acceptance: None,locale: None,+ enable_partial_authorization: None,..utils::PaymentAuthorizeType::default().0},response: Err(types::ErrorResponse::default()),@@ -137,6 +138,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,}}@@ -212,6 +214,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,}}diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rsindex 94c5beee93..288932bb40 100644--- a/crates/router/tests/connectors/utils.rs+++ b/crates/router/tests/connectors/utils.rs@@ -557,6 +557,7 @@ pub trait ConnectorActions: Connector {raw_connector_response: None,is_payment_id_from_merchant: None,l2_l3_data: None,+ minor_amount_capturable: None,}}@@ -1001,6 +1002,7 @@ impl Default for PaymentAuthorizeType {order_id: None,locale: None,payment_channel: None,+ enable_partial_authorization: None,};Self(data)}diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rsindex d2ab33ce85..c75372c8ee 100644--- a/crates/router/tests/payments.rs+++ b/crates/router/tests/payments.rs@@ -467,6 +467,7 @@ async fn payments_create_core() {whole_connector_response: None,payment_channel: None,network_transaction_id: None,+ enable_partial_authorization: None,};let expected_response =services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));@@ -747,6 +748,7 @@ async fn payments_create_core_adyen_no_redirect() {whole_connector_response: None,payment_channel: None,network_transaction_id: None,+ enable_partial_authorization: None,},vec![],));diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rsindex ab8c8f426a..f16b3e8631 100644--- a/crates/router/tests/payments2.rs+++ b/crates/router/tests/payments2.rs@@ -229,6 +229,7 @@ async fn payments_create_core() {whole_connector_response: None,payment_channel: None,network_transaction_id: None,+ enable_partial_authorization: None,};let expected_response =@@ -517,6 +518,7 @@ async fn payments_create_core_adyen_no_redirect() {whole_connector_response: None,payment_channel: None,network_transaction_id: None,+ enable_partial_authorization: None,},vec![],));diff --git a/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/down.sql b/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/down.sqlnew file mode 100644index 0000000000..ff54ec15df--- /dev/null+++ b/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/down.sql@@ -0,0 +1 @@+ALTER TABLE payment_intent DROP COLUMN enable_partial_authorization;diff --git a/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/up.sql b/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/up.sqlnew file mode 100644index 0000000000..dc595cbcb1--- /dev/null+++ b/migrations/2025-08-02-080018_add_partial_authorization_to_payment_intent/up.sql@@ -0,0 +1 @@+ALTER TABLE payment_intent ADD COLUMN enable_partial_authorization BOOLEAN;diff --git a/migrations/2025-08-02-084127_add_partial_auth_enum_variants/down.sql b/migrations/2025-08-02-084127_add_partial_auth_enum_variants/down.sqlnew file mode 100644index 0000000000..c7c9cbeb40--- /dev/null+++ b/migrations/2025-08-02-084127_add_partial_auth_enum_variants/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+SELECT 1;\ No newline at end of filediff --git a/migrations/2025-08-02-084127_add_partial_auth_enum_variants/up.sql b/migrations/2025-08-02-084127_add_partial_auth_enum_variants/up.sqlnew file mode 100644index 0000000000..5c6e736604--- /dev/null+++ b/migrations/2025-08-02-084127_add_partial_auth_enum_variants/up.sql@@ -0,0 +1,6 @@+-- Your SQL goes here+ALTER TYPE "IntentStatus" ADD VALUE IF NOT EXISTS 'partially_authorized_and_requires_capture';++ALTER TYPE "AttemptStatus" ADD VALUE IF NOT EXISTS 'partially_authorized';++ALTER TYPE "EventType" ADD VALUE 'payment_partially_authorized';\ No newline at end of file