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
feat(core): Handle raw connector response from UCS based on `all_keys_required` (#13060)
Shubhodip pal51f93d766ae2
diff --git a/crates/router/src/core/payments/gateway/authorize_gateway.rs b/crates/router/src/core/payments/gateway/authorize_gateway.rsindex 22bea07ba6..b559436ff5 100644--- a/crates/router/src/core/payments/gateway/authorize_gateway.rs+++ b/crates/router/src/core/payments/gateway/authorize_gateway.rs@@ -64,7 +64,7 @@ whererouter_data: &RouterData<Self, types::PaymentsAuthorizeData, types::PaymentsResponseData>,call_connector_action: CallConnectorAction,_connector_request: Option<Request>,- _return_raw_connector_response: Option<bool>,+ return_raw_connector_response: Option<bool>,context: RouterGatewayContext,) -> CustomResult<RouterData<Self, types::PaymentsAuthorizeData, types::PaymentsResponseData>,@@ -218,10 +218,12 @@ whererouter_data.minor_amount_captured = recurring_payment_charge_response.captured_amount.map(MinorUnit::new);- router_data.raw_connector_response = recurring_payment_charge_response- .raw_connector_response- .clone()- .map(|raw_connector_response| raw_connector_response.expose().into());+ if return_raw_connector_response.unwrap_or(false) {+ router_data.raw_connector_response = recurring_payment_charge_response+ .raw_connector_response+ .clone()+ .map(|raw_connector_response| raw_connector_response.expose().into());+ }router_data.connector_http_status_code = Some(ucs_data.status_code);ucs_data.connector_customer_id.map(|connector_customer_id| {@@ -373,10 +375,12 @@ whererouter_data.minor_amount_capturable = payment_authorize_response.capturable_amount.map(MinorUnit::new);- router_data.raw_connector_response = payment_authorize_response- .raw_connector_response- .clone()- .map(|raw_connector_response| raw_connector_response.expose().into());+ if return_raw_connector_response.unwrap_or(false) {+ router_data.raw_connector_response = payment_authorize_response+ .raw_connector_response+ .clone()+ .map(|raw_connector_response| raw_connector_response.expose().into());+ }router_data.connector_http_status_code = Some(ucs_data.status_code);ucs_data.connector_response.map(|connector_response| {diff --git a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rsindex c1e8516af5..6f3132b713 100644--- a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs+++ b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs@@ -57,7 +57,7 @@ whererouter_data: &RouterData<Self, types::CompleteAuthorizeData, types::PaymentsResponseData>,call_connector_action: CallConnectorAction,_connector_request: Option<Request>,- _return_raw_connector_response: Option<bool>,+ return_raw_connector_response: Option<bool>,context: RouterGatewayContext,) -> CustomResult<RouterData<Self, types::CompleteAuthorizeData, types::PaymentsResponseData>,@@ -152,10 +152,12 @@ whererouter_data.minor_amount_captured = payment_authorize_response.captured_amount.map(MinorUnit::new);- router_data.raw_connector_response = payment_authorize_response- .raw_connector_response- .clone()- .map(|raw_connector_response| raw_connector_response.expose().into());+ if return_raw_connector_response.unwrap_or(false) {+ router_data.raw_connector_response = payment_authorize_response+ .raw_connector_response+ .clone()+ .map(|raw_connector_response| raw_connector_response.expose().into());+ }router_data.connector_http_status_code = Some(ucs_data.status_code);ucs_data.connector_response.map(|customer_response| {diff --git a/crates/router/src/core/payments/gateway/psync_gateway.rs b/crates/router/src/core/payments/gateway/psync_gateway.rsindex 4d351da1e9..ad717226ad 100644--- a/crates/router/src/core/payments/gateway/psync_gateway.rs+++ b/crates/router/src/core/payments/gateway/psync_gateway.rs@@ -62,7 +62,7 @@ whererouter_data: &RouterData<Self, types::PaymentsSyncData, types::PaymentsResponseData>,call_connector_action: CallConnectorAction,_connector_request: Option<Request>,- _return_raw_connector_response: Option<bool>,+ return_raw_connector_response: Option<bool>,context: RouterGatewayContext,) -> CustomResult<RouterData<Self, types::PaymentsSyncData, types::PaymentsResponseData>,@@ -108,10 +108,12 @@ whererouter_data.amount_captured = payment_get_response.captured_amount;router_data.minor_amount_captured =payment_get_response.captured_amount.map(MinorUnit::new);- router_data.raw_connector_response = payment_get_response- .raw_connector_response- .clone()- .map(|raw_connector_response| raw_connector_response.expose().into());+ if return_raw_connector_response.unwrap_or(false) {+ router_data.raw_connector_response = payment_get_response+ .raw_connector_response+ .clone()+ .map(|raw_connector_response| raw_connector_response.expose().into());+ }router_data.connector_http_status_code = Some(status_code);router_data.sender_payment_instrument_id =payment_get_response.sender_payment_instrument_id.clone();@@ -277,10 +279,12 @@ whererouter_data.amount_captured = payment_get_response.captured_amount;router_data.minor_amount_captured =payment_get_response.captured_amount.map(MinorUnit::new);- router_data.raw_connector_response = payment_get_response- .raw_connector_response- .clone()- .map(|raw_connector_response| raw_connector_response.expose().into());+ if return_raw_connector_response.unwrap_or(false) {+ router_data.raw_connector_response = payment_get_response+ .raw_connector_response+ .clone()+ .map(|raw_connector_response| raw_connector_response.expose().into());+ }router_data.connector_http_status_code = Some(status_code);router_data.sender_payment_instrument_id =payment_get_response.sender_payment_instrument_id.clone();