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
fix(ucs): preserve construct-time amount_captured on psync when UCS reports none (#18021) (#13206)
10X-GRACEe31ac8fdc3a0
diff --git a/crates/router/src/core/payments/gateway/psync_gateway.rs b/crates/router/src/core/payments/gateway/psync_gateway.rsindex 7b0f127db3..5157c6dbc8 100644--- a/crates/router/src/core/payments/gateway/psync_gateway.rs+++ b/crates/router/src/core/payments/gateway/psync_gateway.rs@@ -105,9 +105,13 @@ where};router_data.response = router_data_response;- router_data.amount_captured = payment_get_response.captured_amount;- router_data.minor_amount_captured =- payment_get_response.captured_amount.map(MinorUnit::new);+ // Only override `amount_captured` when UCS actually reports a captured+ // amount on sync. Connectors that don't return an amount on psync (e.g.+ // cybersource TSS) leave this `None` .+ if let Some(captured_amount) = payment_get_response.captured_amount {+ router_data.amount_captured = Some(captured_amount);+ router_data.minor_amount_captured = Some(MinorUnit::new(captured_amount));+ }if return_raw_connector_response.unwrap_or(false) {router_data.raw_connector_response = payment_get_response.raw_connector_response@@ -260,9 +264,14 @@ where}router_data.response = router_data_response;- router_data.amount_captured = payment_get_response.captured_amount;- router_data.minor_amount_captured =- payment_get_response.captured_amount.map(MinorUnit::new);+ // Only override `amount_captured` when UCS actually reports a+ // captured amount on sync. Connectors that don't return an amount+ // on psync (e.g. cybersource TSS) leave this `None`;+ if let Some(captured_amount) = payment_get_response.captured_amount {+ router_data.amount_captured = Some(captured_amount);+ router_data.minor_amount_captured =+ Some(MinorUnit::new(captured_amount));+ }if return_raw_connector_response.unwrap_or(false) {router_data.raw_connector_response = payment_get_response.raw_connector_response