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

fix(core): Schedule Payment Sync Workflow in Process Tracker after PaymentsCapture (#14330)

Sayak Bhattacharya6fd72e5e6653
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e60174929a..9584615834 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1542,7 +1542,7 @@ pub async fn add_domain_task_to_pt<Op>(
where
Op: std::fmt::Debug,
{
- if check_if_operation_confirm(operation) {
+ if check_if_operation_adds_payment_sync_task(operation) {
match schedule_time {
Some(stime) => {
if !requeue {
@@ -4625,8 +4625,11 @@ pub fn hmac_sha512_sorted_query_params(
Ok(hex::encode(signature))
}
-pub fn check_if_operation_confirm<Op: std::fmt::Debug>(operations: Op) -> bool {
- format!("{operations:?}") == "PaymentConfirm"
+pub fn check_if_operation_adds_payment_sync_task<Op: std::fmt::Debug>(operations: Op) -> bool {
+ matches!(
+ format!("{operations:?}").as_str(),
+ "PaymentConfirm" | "PaymentCapture"
+ )
}
#[allow(clippy::too_many_arguments)]
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 1d28ef6c98..d2768ad855 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -865,6 +865,17 @@ where
helpers::get_connector_default(state, None).await
}
+ #[instrument(skip_all)]
+ async fn add_task_to_process_tracker<'a>(
+ &'a self,
+ state: &'a SessionState,
+ payment_attempt: &storage::PaymentAttempt,
+ requeue: bool,
+ schedule_time: Option<time::PrimitiveDateTime>,
+ ) -> CustomResult<(), errors::ApiErrorResponse> {
+ helpers::add_domain_task_to_pt(self, state, payment_attempt, requeue, schedule_time).await
+ }
+
#[instrument(skip_all)]
async fn guard_payment_against_blocklist<'a>(
&'a self,