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): add amount captured in payment attempt (#10498)

chikke srujandecbe3333442
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 56582c20cd..7ab32b13a1 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -20124,6 +20124,7 @@
"partially_captured",
"partially_captured_and_capturable",
"partially_authorized_and_requires_capture",
+ "partially_captured_and_processing",
"conflicted",
"expired"
]
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index cafff274a1..bbb9438a9f 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -4659,6 +4659,14 @@
}
],
"nullable": true
+ },
+ "amount_captured": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MinorUnit"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -13803,6 +13811,7 @@
"partially_captured",
"partially_captured_and_capturable",
"partially_authorized_and_requires_capture",
+ "partially_captured_and_processing",
"conflicted",
"expired"
]
@@ -17408,6 +17417,14 @@
}
],
"nullable": true
+ },
+ "amount_captured": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MinorUnit"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f49417c584..3ae0226365 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -954,6 +954,9 @@ pub struct AmountDetailsResponse {
pub surcharge_amount: Option<MinorUnit>,
/// tax on surcharge amount
pub tax_on_surcharge: Option<MinorUnit>,
+ /// The total amount captured for the order. This is the sum of all the captured amounts for the order.
+ /// For automatic captures, this will be the same as net amount for the order
+ pub amount_captured: Option<MinorUnit>,
}
#[cfg(feature = "v2")]
@@ -1013,6 +1016,8 @@ pub struct PaymentAttemptAmountDetails {
/// Tax amount for the order.
/// This is either derived by calling an external tax processor, or sent by the merchant
pub order_tax_amount: Option<MinorUnit>,
+ /// The total amount that is captured for this payment attempt.
+ pub amount_captured: Option<MinorUnit>,
}
#[cfg(feature = "v2")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index f9073d9773..78eeec3f4e 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1789,6 +1789,10 @@ pub enum IntentStatus {
PartiallyCapturedAndCapturable,
/// The payment has been authorized for a partial amount and requires capture
PartiallyAuthorizedAndRequiresCapture,
+ /// The payment has been captured partially and the remaining amount can be authorized/capturable.
+ /// The other amount is still being processed by the payment processor.
+ /// The status update might happen through webhooks or polling with the connector.
+ PartiallyCapturedAndProcessing,
/// There has been a discrepancy between the amount/currency sent in the request and the amount/currency received by the processor
Conflicted,
/// The payment expired before it could be captured.
@@ -1813,7 +1817,8 @@ impl IntentStatus {
| Self::RequiresCapture
| Self::PartiallyCapturedAndCapturable
| Self::PartiallyAuthorizedAndRequiresCapture
- | Self::Conflicted => false,
+ | Self::Conflicted
+ | Self::PartiallyCapturedAndProcessing => false,
}
}
@@ -1834,7 +1839,8 @@ impl IntentStatus {
| Self::RequiresCustomerAction
| Self::RequiresMerchantAction
| Self::PartiallyCapturedAndCapturable
- | Self::PartiallyAuthorizedAndRequiresCapture => true,
+ | Self::PartiallyAuthorizedAndRequiresCapture
+ | Self::PartiallyCapturedAndProcessing => true,
}
}
}
@@ -10026,6 +10032,7 @@ impl From<IntentStatus> for InvoiceStatus {
| IntentStatus::PartiallyCapturedAndCapturable
| IntentStatus::PartiallyAuthorizedAndRequiresCapture
| IntentStatus::Processing
+ | IntentStatus::PartiallyCapturedAndProcessing
| IntentStatus::RequiresCustomerAction
| IntentStatus::RequiresConfirmation
| IntentStatus::RequiresPaymentMethod => Self::PaymentPending,
diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs
index 024050f858..872eb46518 100644
--- a/crates/common_enums/src/transformers.rs
+++ b/crates/common_enums/src/transformers.rs
@@ -2139,7 +2139,9 @@ impl From<IntentStatus> for Option<EventType> {
match value {
IntentStatus::Succeeded => Some(EventType::PaymentSucceeded),
IntentStatus::Failed => Some(EventType::PaymentFailed),
- IntentStatus::Processing => Some(EventType::PaymentProcessing),
+ IntentStatus::Processing | IntentStatus::PartiallyCapturedAndProcessing => {
+ Some(EventType::PaymentProcessing)
+ }
IntentStatus::RequiresMerchantAction
| IntentStatus::RequiresCustomerAction
| IntentStatus::Conflicted => Some(EventType::ActionRequired),
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 30e8df2f79..52562d23e4 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -142,6 +142,8 @@ pub struct PaymentAttempt {
pub network_error_message: Option<String>,
/// A string indicating the group of the payment attempt. Used in split payments flow
pub attempts_group_id: Option<id_type::GlobalAttemptGroupId>,
+ /// Amount captured for this payment attempt
+ pub amount_captured: Option<MinorUnit>,
}
#[cfg(feature = "v1")]
@@ -391,6 +393,8 @@ pub struct PaymentAttemptNew {
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub extended_authorization_last_applied_at: Option<PrimitiveDateTime>,
pub tokenization: Option<common_enums::Tokenization>,
+ /// Amount captured for this payment attempt
+ pub amount_captured: Option<MinorUnit>,
pub encrypted_payment_method_data: Option<common_utils::encryption::Encryption>,
}
@@ -819,6 +823,7 @@ pub enum PaymentAttemptUpdate {
updated_by: String,
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
+ amount_captured: Option<MinorUnit>,
},
UnresolvedResponseUpdate {
status: storage_enums::AttemptStatus,
@@ -847,6 +852,7 @@ pub enum PaymentAttemptUpdate {
unified_message: Option<Option<String>>,
connector_payment_id: Option<String>,
authentication_type: Option<storage_enums::AuthenticationType>,
+ amount_captured: Option<MinorUnit>,
},
// CaptureUpdate {
// amount_to_capture: Option<MinorUnit>,
@@ -945,6 +951,7 @@ pub struct PaymentAttemptUpdateInternal {
pub network_advice_code: Option<String>,
pub network_error_message: Option<String>,
pub connector_request_reference_id: Option<String>,
+ pub amount_captured: Option<MinorUnit>,
}
#[cfg(feature = "v2")]
@@ -978,6 +985,7 @@ impl PaymentAttemptUpdateInternal {
payment_method_id,
connector_request_reference_id,
connector_response_reference_id,
+ amount_captured,
} = self;
PaymentAttempt {
@@ -1062,6 +1070,7 @@ impl PaymentAttemptUpdateInternal {
attempts_group_id: source.attempts_group_id,
is_stored_credential: source.is_stored_credential,
authorized_amount: source.authorized_amount,
+ amount_captured: amount_captured.or(source.amount_captured),
encrypted_payment_method_data: source.encrypted_payment_method_data,
}
}
@@ -1444,6 +1453,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
updated_by,
unified_code,
unified_message,
+ amount_captured,
} => {
let (connector_payment_id, connector_payment_data) = connector_payment_id
.map(ConnectorTransactionId::form_id_and_data)
@@ -1478,6 +1488,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
network_error_message: None,
connector_request_reference_id: None,
cancellation_reason: None,
+ amount_captured,
}
}
PaymentAttemptUpdate::ErrorUpdate {
@@ -1492,6 +1503,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_message,
connector_payment_id,
authentication_type,
+ amount_captured,
} => {
let (connector_payment_id, connector_payment_data) = connector_payment_id
.map(ConnectorTransactionId::form_id_and_data)
@@ -1526,6 +1538,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured,
}
}
PaymentAttemptUpdate::UnresolvedResponseUpdate {
@@ -1572,6 +1585,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
network_error_message: None,
connector_request_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
}
}
PaymentAttemptUpdate::PreprocessingUpdate {
@@ -1616,6 +1630,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
network_error_message: None,
connector_request_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
}
}
PaymentAttemptUpdate::ConnectorResponse {
@@ -1656,6 +1671,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
}
}
PaymentAttemptUpdate::ManualUpdate {
@@ -1702,6 +1718,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
}
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 68638555b8..1ead8e4093 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1063,6 +1063,7 @@ diesel::table! {
network_error_message -> Nullable<Text>,
#[max_length = 64]
attempts_group_id -> Nullable<Varchar>,
+ amount_captured -> Nullable<Int8>,
}
}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index a7ac93805e..4cd151c85e 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -732,6 +732,7 @@ impl From<&api_models::payments::PaymentAttemptAmountDetails>
amount_capturable: amount.amount_capturable,
shipping_cost: amount.shipping_cost,
order_tax_amount: amount.order_tax_amount,
+ amount_captured: amount.amount_captured,
}
}
}
@@ -748,6 +749,7 @@ impl From<&payments::payment_attempt::AttemptAmountDetailsSetter>
amount_capturable: amount.amount_capturable,
shipping_cost: amount.shipping_cost,
order_tax_amount: amount.order_tax_amount,
+ amount_captured: amount.amount_captured,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 787d73e087..f22c5fd373 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -413,6 +413,7 @@ impl AmountDetails {
amount_capturable: MinorUnit::zero(),
shipping_cost: self.shipping_cost,
order_tax_amount,
+ amount_captured: None,
})
}
@@ -451,6 +452,7 @@ impl AmountDetails {
amount_capturable: MinorUnit::zero(),
shipping_cost: self.shipping_cost,
order_tax_amount,
+ amount_captured: None,
})
}
@@ -487,6 +489,7 @@ impl AmountDetails {
amount_capturable: MinorUnit::zero(),
shipping_cost: self.shipping_cost,
order_tax_amount,
+ amount_captured: None,
})
}
@@ -635,7 +638,7 @@ pub struct PaymentIntent {
/// or generated internally by Hyperswitch (false)
pub is_payment_id_from_merchant: Option<bool>,
/// Denotes whether merchant requested for partial authorization to be enabled for this payment.
- pub enable_partial_authorization: Option<primitive_wrappers::EnablePartialAuthorizationBool>,
+ pub enable_partial_authorization: primitive_wrappers::EnablePartialAuthorizationBool,
}
#[cfg(feature = "v2")]
@@ -824,7 +827,9 @@ impl PaymentIntent {
created_by: None,
is_iframe_redirection_enabled: None,
is_payment_id_from_merchant: None,
- enable_partial_authorization: request.enable_partial_authorization,
+ enable_partial_authorization: request
+ .enable_partial_authorization
+ .unwrap_or(false.into()),
})
}
@@ -933,6 +938,7 @@ impl PaymentIntent {
| common_enums::IntentStatus::PartiallyCaptured
| common_enums::IntentStatus::Expired
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresPaymentMethod
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 3d27367ca5..736e5621e1 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -263,6 +263,8 @@ pub struct AttemptAmountDetails {
/// Tax amount for the order.
/// This is either derived by calling an external tax processor, or sent by the merchant
order_tax_amount: Option<MinorUnit>,
+ /// Amount captured for this payment attempt
+ amount_captured: Option<MinorUnit>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
@@ -284,6 +286,8 @@ pub struct AttemptAmountDetailsSetter {
/// Tax amount for the order.
/// This is either derived by calling an external tax processor, or sent by the merchant
pub order_tax_amount: Option<MinorUnit>,
+ /// Amount captured for this payment attempt
+ pub amount_captured: Option<MinorUnit>,
}
/// Set the fields of amount details, since the fields are not public
@@ -297,6 +301,7 @@ impl From<AttemptAmountDetailsSetter> for AttemptAmountDetails {
amount_capturable: setter.amount_capturable,
shipping_cost: setter.shipping_cost,
order_tax_amount: setter.order_tax_amount,
+ amount_captured: setter.amount_captured,
}
}
}
@@ -322,6 +327,10 @@ impl AttemptAmountDetails {
self.amount_capturable
}
+ pub fn get_amount_captured(&self) -> Option<MinorUnit> {
+ self.amount_captured
+ }
+
pub fn get_shipping_cost(&self) -> Option<MinorUnit> {
self.shipping_cost
}
@@ -742,6 +751,7 @@ impl PaymentAttempt {
amount_capturable: intent_amount_details.order_amount,
shipping_cost: None,
order_tax_amount: None,
+ amount_captured: None,
};
let now = common_utils::date_time::now();
@@ -2128,6 +2138,7 @@ pub struct ConfirmIntentResponseUpdate {
pub amount_capturable: Option<MinorUnit>,
pub connector_token_details: Option<diesel_models::ConnectorTokenDetails>,
pub connector_response_reference_id: Option<String>,
+ pub amount_captured: Option<MinorUnit>,
}
#[cfg(feature = "v2")]
@@ -2160,6 +2171,7 @@ pub enum PaymentAttemptUpdate {
status: storage_enums::AttemptStatus,
amount_capturable: Option<MinorUnit>,
updated_by: String,
+ amount_captured: Option<MinorUnit>,
},
PreCaptureUpdate {
amount_to_capture: Option<MinorUnit>,
@@ -2617,6 +2629,7 @@ impl behaviour::Conversion for PaymentAttempt {
shipping_cost,
amount_capturable,
amount_to_capture,
+ amount_captured,
} = amount_details;
let (connector_payment_id, connector_payment_data) = connector_payment_id
@@ -2710,6 +2723,7 @@ impl behaviour::Conversion for PaymentAttempt {
is_stored_credential: None,
authorized_amount,
tokenization: None,
+ amount_captured,
encrypted_payment_method_data: None,
})
}
@@ -2764,6 +2778,7 @@ impl behaviour::Conversion for PaymentAttempt {
shipping_cost: storage_model.shipping_cost,
amount_capturable: storage_model.amount_capturable,
amount_to_capture: storage_model.amount_to_capture,
+ amount_captured: storage_model.amount_captured,
};
let error = storage_model
@@ -2998,6 +3013,7 @@ impl behaviour::Conversion for PaymentAttempt {
attempts_group_id,
is_stored_credential: None,
authorized_amount,
+ amount_captured: amount_details.amount_captured,
encrypted_payment_method_data: None,
})
}
@@ -3043,6 +3059,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id,
connector_response_reference_id,
cancellation_reason: None,
+ amount_captured: None,
},
PaymentAttemptUpdate::ErrorUpdate {
status,
@@ -3085,6 +3102,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
}
}
PaymentAttemptUpdate::ConfirmIntentResponse(confirm_intent_response_update) => {
@@ -3097,6 +3115,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
amount_capturable,
connector_token_details,
connector_response_reference_id,
+ amount_captured,
} = *confirm_intent_response_update;
// Apply automatic hashing for long connector payment IDs
@@ -3133,12 +3152,14 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id,
cancellation_reason: None,
+ amount_captured: None,
}
}
PaymentAttemptUpdate::SyncUpdate {
status,
amount_capturable,
updated_by,
+ amount_captured,
} => Self {
status: Some(status),
payment_method_id: None,
@@ -3167,6 +3188,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured,
},
PaymentAttemptUpdate::CaptureUpdate {
status,
@@ -3200,6 +3222,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
},
PaymentAttemptUpdate::PreCaptureUpdate {
amount_to_capture,
@@ -3232,6 +3255,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
},
PaymentAttemptUpdate::ConfirmIntentTokenized {
status,
@@ -3269,6 +3293,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id,
connector_response_reference_id: None,
cancellation_reason: None,
+ amount_captured: None,
},
PaymentAttemptUpdate::VoidUpdate {
status,
@@ -3302,6 +3327,7 @@ impl From<PaymentAttemptUpdate> for diesel_models::PaymentAttemptUpdateInternal
connector_request_reference_id: None,
connector_response_reference_id: None,
payment_method_id: None,
+ amount_captured: None,
},
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index ce62ce481f..3c55801d1e 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -1970,7 +1970,7 @@ impl behaviour::Conversion for PaymentIntent {
shipping_amount_tax: None,
duty_amount: None,
order_date: None,
- enable_partial_authorization,
+ enable_partial_authorization: Some(enable_partial_authorization),
enable_overcapture: None,
mit_category: None,
billing_descriptor: None,
@@ -2126,7 +2126,9 @@ impl behaviour::Conversion for PaymentIntent {
.and_then(|created_by| created_by.parse::<CreatedBy>().ok()),
is_iframe_redirection_enabled: storage_model.is_iframe_redirection_enabled,
is_payment_id_from_merchant: storage_model.is_payment_id_from_merchant,
- enable_partial_authorization: storage_model.enable_partial_authorization,
+ enable_partial_authorization: storage_model
+ .enable_partial_authorization
+ .unwrap_or(false.into()),
})
}
.await
@@ -2232,7 +2234,7 @@ impl behaviour::Conversion for PaymentIntent {
shipping_amount_tax: None,
duty_amount: None,
order_date: None,
- enable_partial_authorization: self.enable_partial_authorization,
+ enable_partial_authorization: Some(self.enable_partial_authorization),
tokenization: None,
})
}
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index 9f517c1a6b..d0bc50b20e 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -250,6 +250,7 @@ impl From<&RevenueRecoveryAttemptData> for api_payments::PaymentAttemptAmountDet
amount_capturable: data.amount,
shipping_cost: None,
order_tax_amount: None,
+ amount_captured: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index fdcaa8a008..70468c3681 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -860,6 +860,7 @@ impl
storage_scheme: common_enums::MerchantStorageScheme,
) -> PaymentAttemptUpdate {
let amount_capturable = self.get_amount_capturable(payment_data);
+ let amount_captured = self.get_captured_amount(payment_data);
match self.response {
Ok(ref response_router_data) => match response_router_data {
@@ -898,6 +899,7 @@ impl
),
connector_response_reference_id: connector_response_reference_id
.clone(),
+ amount_captured,
},
))
}
@@ -1017,7 +1019,8 @@ impl
// For these statuses, update the capturable amount when it reaches terminal / capturable state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation
@@ -1059,7 +1062,8 @@ impl
// For these statuses, update the amount captured when it reaches terminal state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -1241,7 +1245,8 @@ impl
// For these statuses, update the capturable amount when it reaches terminal / capturable state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -1288,7 +1293,8 @@ impl
// For these statuses, update the amount captured when it reaches terminal state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -1352,6 +1358,7 @@ impl
storage_scheme: common_enums::MerchantStorageScheme,
) -> PaymentAttemptUpdate {
let amount_capturable = self.get_amount_capturable(payment_data);
+ let amount_captured = self.get_captured_amount(payment_data);
match self.response {
Ok(ref response_router_data) => match response_router_data {
@@ -1362,6 +1369,7 @@ impl
status: attempt_status,
amount_capturable,
updated_by: storage_scheme.to_string(),
+ amount_captured,
}
}
router_response_types::PaymentsResponseData::MultipleCaptureResponse { .. } => {
@@ -1483,7 +1491,8 @@ impl
// For these statuses, update the capturable amount when it reaches terminal / capturable state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -1526,7 +1535,8 @@ impl
// For these statuses, update the amount captured when it reaches terminal state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -1598,6 +1608,7 @@ impl
storage_scheme: common_enums::MerchantStorageScheme,
) -> PaymentAttemptUpdate {
let amount_capturable = self.get_amount_capturable(payment_data);
+ let amount_captured = self.get_captured_amount(payment_data);
match self.response {
Ok(ref response_router_data) => match response_router_data {
@@ -1636,6 +1647,7 @@ impl
),
connector_response_reference_id: connector_response_reference_id
.clone(),
+ amount_captured,
},
))
}
@@ -1740,7 +1752,8 @@ impl
| common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
common_enums::IntentStatus::RequiresCapture
@@ -1770,7 +1783,8 @@ impl
| common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
common_enums::IntentStatus::RequiresCapture
@@ -1827,6 +1841,7 @@ impl
storage_scheme: common_enums::MerchantStorageScheme,
) -> PaymentAttemptUpdate {
let amount_capturable = self.get_amount_capturable(payment_data);
+ let amount_captured = self.get_captured_amount(payment_data);
match self.response {
Ok(ref response_router_data) => match response_router_data {
@@ -1863,6 +1878,7 @@ impl
}),
),
connector_response_reference_id: None,
+ amount_captured,
},
))
}
@@ -1963,7 +1979,8 @@ impl
// For these statuses, update the capturable amount when it reaches terminal / capturable state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
@@ -2002,7 +2019,8 @@ impl
// For these statuses, update the amount captured when it reaches terminal state
common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
// Invalid states for this flow
common_enums::IntentStatus::RequiresPaymentMethod
| common_enums::IntentStatus::RequiresConfirmation => None,
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index f0685dfd5b..3510389ccc 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -424,7 +424,8 @@ impl From<api_enums::IntentStatus> for StripePaymentStatus {
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::PartiallyCapturedAndProcessing => Self::Processing,
api_enums::IntentStatus::RequiresCustomerAction
| api_enums::IntentStatus::RequiresMerchantAction
| api_enums::IntentStatus::Conflicted => Self::RequiresAction,
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 201a5aac81..7a86aeeff0 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -314,6 +314,7 @@ impl From<api_enums::IntentStatus> for StripeSetupStatus {
}
api_enums::IntentStatus::Failed | api_enums::IntentStatus::Expired => Self::Canceled,
api_enums::IntentStatus::Processing
+ | api_enums::IntentStatus::PartiallyCapturedAndProcessing
| api_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => Self::Processing,
api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,
api_enums::IntentStatus::RequiresMerchantAction
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index b5f6d63ecb..9f59a365ce 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3553,6 +3553,7 @@ impl ValidateStatusForOperation for &PaymentRedirectSync {
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
| common_enums::IntentStatus::PartiallyCaptured
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresConfirmation
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::Expired => {
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 13f5e38d45..5c9af1db48 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4672,6 +4672,7 @@ pub fn get_attempt_type(
| enums::IntentStatus::PartiallyCaptured
| enums::IntentStatus::PartiallyCapturedAndCapturable
| enums::IntentStatus::Processing
+ | enums::IntentStatus::PartiallyCapturedAndProcessing
| enums::IntentStatus::Succeeded
| enums::IntentStatus::Conflicted
| enums::IntentStatus::Expired
@@ -4980,6 +4981,7 @@ pub fn is_manual_retry_allowed(
| enums::IntentStatus::PartiallyCaptured
| enums::IntentStatus::PartiallyCapturedAndCapturable
| enums::IntentStatus::Processing
+ | enums::IntentStatus::PartiallyCapturedAndProcessing
| enums::IntentStatus::Succeeded
| enums::IntentStatus::Conflicted
| enums::IntentStatus::Expired
diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
index ce4937b5f3..121a0732af 100644
--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
@@ -59,6 +59,7 @@ impl ValidateStatusForOperation for ExternalVaultProxyPaymentIntent {
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Expired => {
Err(errors::ApiErrorResponse::PaymentUnexpectedState {
current_flow: format!("{self:?}"),
diff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rs
index 033b81ded6..971cd6f1d9 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs
@@ -82,6 +82,7 @@ impl ValidateStatusForOperation for PaymentAttemptRecord {
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Conflicted
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
index e1287d6b30..b95de2c0ee 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
@@ -321,6 +321,7 @@ impl ValidateStatusForOperation for PaymentsCancel {
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresPaymentMethod
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index c1b97e38dd..276dabd2a7 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -41,6 +41,7 @@ impl ValidateStatusForOperation for PaymentsCapture {
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresPaymentMethod
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 6012248f71..65ede51957 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -49,6 +49,7 @@ impl ValidateStatusForOperation for PaymentIntentConfirm {
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresCapture
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index 077a9cb88e..f57c8d8e94 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -38,6 +38,7 @@ impl ValidateStatusForOperation for PaymentGet {
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Succeeded
| common_enums::IntentStatus::Failed
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index 4c807915f0..54275774af 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -35,6 +35,7 @@ impl ValidateStatusForOperation for PaymentSessionIntent {
common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresCapture
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index bda8e1dfb5..bbfc923efb 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -55,6 +55,7 @@ impl ValidateStatusForOperation for PaymentUpdateIntent {
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresCustomerAction
| common_enums::IntentStatus::RequiresMerchantAction
| common_enums::IntentStatus::RequiresCapture
@@ -298,7 +299,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
.or(payment_intent.allowed_payment_method_types),
active_attempt_id,
enable_partial_authorization: enable_partial_authorization
- .or(payment_intent.enable_partial_authorization),
+ .unwrap_or(payment_intent.enable_partial_authorization),
setup_future_usage: setup_future_usage.unwrap_or(payment_intent.setup_future_usage),
..payment_intent
};
@@ -390,7 +391,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
active_attempt_id: Some(intent.active_attempt_id),
force_3ds_challenge: intent.force_3ds_challenge,
is_iframe_redirection_enabled: intent.is_iframe_redirection_enabled,
- enable_partial_authorization: intent.enable_partial_authorization,
+ enable_partial_authorization: Some(intent.enable_partial_authorization),
}));
let new_payment_intent = db
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index a88efcbc12..e1c2849bc0 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -57,6 +57,7 @@ impl ValidateStatusForOperation for PaymentProxyIntent {
| common_enums::IntentStatus::PartiallyCaptured
| common_enums::IntentStatus::RequiresConfirmation
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Expired => {
Err(errors::ApiErrorResponse::PaymentUnexpectedState {
current_flow: format!("{self:?}"),
diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs
index 7ae4c31111..62d70cf5f9 100644
--- a/crates/router/src/core/payments/payment_methods.rs
+++ b/crates/router/src/core/payments/payment_methods.rs
@@ -783,6 +783,7 @@ fn validate_payment_status_for_payment_method_list(
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
| common_enums::IntentStatus::PartiallyCaptured
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::RequiresConfirmation
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::Expired => {
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index f8303e8e63..f084c53a2b 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -460,7 +460,9 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
mit_category: None,
tokenization: None,
payment_channel: None,
- enable_partial_authorization: payment_data.payment_intent.enable_partial_authorization,
+ enable_partial_authorization: Some(
+ payment_data.payment_intent.enable_partial_authorization,
+ ),
enable_overcapture: None,
is_stored_credential: None,
billing_descriptor: None,
@@ -2238,7 +2240,7 @@ where
frm_metadata: payment_intent.frm_metadata.clone(),
request_external_three_ds_authentication: payment_intent
.request_external_three_ds_authentication,
- enable_partial_authorization: payment_intent.enable_partial_authorization,
+ enable_partial_authorization: Some(payment_intent.enable_partial_authorization),
card_attached,
}
}
@@ -2639,7 +2641,7 @@ where
request_external_three_ds_authentication: payment_intent
.request_external_three_ds_authentication,
payment_type,
- enable_partial_authorization: payment_intent.enable_partial_authorization,
+ enable_partial_authorization: Some(payment_intent.enable_partial_authorization),
},
vec![],
)))
@@ -6394,6 +6396,7 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::AttemptA
amount_capturable: amount.get_amount_capturable(),
shipping_cost: amount.get_shipping_cost(),
order_tax_amount: amount.get_order_tax_amount(),
+ amount_captured: amount.get_amount_captured(),
}
}
}
@@ -6541,6 +6544,7 @@ impl ForeignFrom<hyperswitch_domain_models::payments::AmountDetails>
surcharge_calculation: amount_details.skip_surcharge_calculation,
surcharge_amount: amount_details.surcharge_amount,
tax_on_surcharge: amount_details.tax_on_surcharge,
+ amount_captured: amount_details.amount_captured,
}
}
}
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index a73e106b9b..dbdbcf1b84 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -1177,6 +1177,7 @@ pub async fn resume_revenue_recovery_process_tracker(
| IntentStatus::PartiallyCaptured
| IntentStatus::PartiallyCapturedAndCapturable
| IntentStatus::PartiallyAuthorizedAndRequiresCapture
+ | IntentStatus::PartiallyCapturedAndProcessing
| IntentStatus::Conflicted
| IntentStatus::Expired => Err(report!(errors::ApiErrorResponse::NotSupported {
message: "Invalid Payment Status ".to_owned(),
@@ -1423,7 +1424,9 @@ pub fn map_recovery_status(
// For all other intent statuses, return the mapped recovery status
IntentStatus::Succeeded => RecoveryStatus::Recovered,
- IntentStatus::Processing => RecoveryStatus::Processing,
+ IntentStatus::Processing | IntentStatus::PartiallyCapturedAndProcessing => {
+ RecoveryStatus::Processing
+ }
IntentStatus::Cancelled
| IntentStatus::CancelledPostCapture
| IntentStatus::Conflicted
diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs
index 726bc5470a..50f39a4d26 100644
--- a/crates/router/src/services/kafka/payment_intent.rs
+++ b/crates/router/src/services/kafka/payment_intent.rs
@@ -317,7 +317,7 @@ impl<'a> KafkaPaymentIntent<'a> {
routing_algorithm_id: routing_algorithm_id.as_ref(),
payment_link_config: payment_link_config.as_ref(),
infra_values,
- enable_partial_authorization: *enable_partial_authorization,
+ enable_partial_authorization: Some(*enable_partial_authorization),
}
}
}
diff --git a/crates/router/src/services/kafka/payment_intent_event.rs b/crates/router/src/services/kafka/payment_intent_event.rs
index 0e550504d5..15a5fdee70 100644
--- a/crates/router/src/services/kafka/payment_intent_event.rs
+++ b/crates/router/src/services/kafka/payment_intent_event.rs
@@ -331,7 +331,7 @@ impl<'a> KafkaPaymentIntentEvent<'a> {
routing_algorithm_id: routing_algorithm_id.as_ref(),
payment_link_config: payment_link_config.as_ref(),
infra_values,
- enable_partial_authorization: *enable_partial_authorization,
+ enable_partial_authorization: Some(*enable_partial_authorization),
}
}
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 458185ef40..a59f995c33 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -347,6 +347,7 @@ impl Capturable for PaymentsAuthorizeData {
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Processing => None,
}
},
@@ -395,6 +396,7 @@ impl Capturable for PaymentsCaptureData {
| common_enums::IntentStatus::Conflicted
| common_enums::IntentStatus::Expired => Some(0),
common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::Cancelled
| common_enums::IntentStatus::CancelledPostCapture
| common_enums::IntentStatus::Failed
@@ -455,7 +457,8 @@ impl Capturable for CompleteAuthorizeData {
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
- | common_enums::IntentStatus::Processing => None,
+ | common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
}
},
common_enums::CaptureMethod::Manual => Some(payment_data.payment_attempt.get_total_amount().get_amount_as_i64()),
@@ -520,7 +523,8 @@ impl Capturable for PaymentsCancelData {
| common_enums::IntentStatus::RequiresConfirmation
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => None,
+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing => None,
}
}
}
@@ -564,6 +568,7 @@ impl Capturable for PaymentsCancelPostCaptureData {
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => None,
}
}
@@ -697,6 +702,7 @@ impl Capturable for PaymentsExtendAuthorizationData {
| common_enums::IntentStatus::RequiresCapture
| common_enums::IntentStatus::PartiallyCapturedAndCapturable
| common_enums::IntentStatus::Processing
+ | common_enums::IntentStatus::PartiallyCapturedAndProcessing
| common_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture => None,
}
}
diff --git a/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/down.sql b/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/down.sql
new file mode 100644
index 0000000000..027b7d63fd
--- /dev/null
+++ b/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/down.sql
@@ -0,0 +1 @@
+SELECT 1;
\ No newline at end of file
diff --git a/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/up.sql b/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/up.sql
new file mode 100644
index 0000000000..df65def94d
--- /dev/null
+++ b/migrations/2025-12-01-162256_add_partially_captured_and_processing_to_intent_status/up.sql
@@ -0,0 +1 @@
+ALTER TYPE "IntentStatus" ADD VALUE IF NOT EXISTS 'partially_captured_and_processing';
\ No newline at end of file
diff --git a/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/down.sql b/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/down.sql
new file mode 100644
index 0000000000..b93a9eff59
--- /dev/null
+++ b/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS amount_captured;
\ No newline at end of file
diff --git a/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/up.sql b/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/up.sql
new file mode 100644
index 0000000000..4651699ddc
--- /dev/null
+++ b/v2_compatible_migrations/2025-12-01-150306_add_amount_captured_in_payment_attempt/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_attempt ADD COLUMN amount_captured BIGINT;
\ No newline at end of file