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(connector): [SQUARE] Throw Error for Partial Capture of Payments (#2133)
DEEPANSHU BANSALcc8847cce002
diff --git a/crates/router/src/connector/square.rs b/crates/router/src/connector/square.rsindex 842c82b7b8..8f8e693bd3 100644--- a/crates/router/src/connector/square.rs+++ b/crates/router/src/connector/square.rs@@ -567,6 +567,12 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymereq: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,) -> CustomResult<Option<services::Request>, errors::ConnectorError> {+ if req.request.amount_to_capture != req.request.payment_amount {+ Err(errors::ConnectorError::NotSupported {+ message: "Partial Capture".to_string(),+ connector: "Square",+ })?+ }Ok(Some(services::RequestBuilder::new().method(services::Method::Post)diff --git a/crates/router/tests/connectors/square.rs b/crates/router/tests/connectors/square.rsindex 2d4797ced9..ba7416c5a1 100644--- a/crates/router/tests/connectors/square.rs+++ b/crates/router/tests/connectors/square.rs@@ -114,6 +114,7 @@ async fn should_capture_authorized_payment() {// Partially captures a payment using the manual capture flow (Non 3DS).#[actix_web::test]+#[ignore = "Connector does not support partial capture"]async fn should_partially_capture_authorized_payment() {let response = CONNECTOR.authorize_and_capture_payment(