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] Fix payments cancel issue (#2162)
DEEPANSHU BANSAL081545e91218
diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rsindex 69e5c52f9b..ff33914c4f 100644--- a/crates/router/src/connector/square/transformers.rs+++ b/crates/router/src/connector/square/transformers.rs@@ -341,8 +341,14 @@ impl<F, T>fn try_from(item: types::ResponseRouterData<F, SquarePaymentsResponse, T, types::PaymentsResponseData>,) -> Result<Self, Self::Error> {+ //Since this try_from is being used in Authorize, Sync, Capture & Void flow. Field amount_captured should only be updated in case of Charged status.+ let status = enums::AttemptStatus::from(item.response.payment.status);+ let mut amount_captured = None;+ if status == enums::AttemptStatus::Charged {+ amount_captured = Some(item.response.payment.amount_money.amount)+ };Ok(Self {- status: enums::AttemptStatus::from(item.response.payment.status),+ status,response: Ok(types::PaymentsResponseData::TransactionResponse {resource_id: types::ResponseId::ConnectorTransactionId(item.response.payment.id),redirection_data: None,@@ -351,7 +357,7 @@ impl<F, T>network_txn_id: None,connector_response_reference_id: None,}),- amount_captured: Some(item.response.payment.amount_money.amount),+ amount_captured,..item.data})}