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(connector): [Paypal] Add manual capture for paypal wallet (#2072)
Prasunna Soppa99ff82ef6d42
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rsindex e8b4269d38..adf6e51dee 100644--- a/crates/router/src/connector/paypal.rs+++ b/crates/router/src/connector/paypal.rs@@ -437,8 +437,13 @@ implreq: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,) -> CustomResult<String, errors::ConnectorError> {+ let paypal_meta: PaypalMeta = to_connector_meta(req.request.connector_meta.clone())?;+ let complete_authorize_url = match paypal_meta.psync_flow {+ transformers::PaypalPaymentIntent::Authorize => "authorize".to_string(),+ transformers::PaypalPaymentIntent::Capture => "capture".to_string(),+ };Ok(format!(- "{}v2/checkout/orders/{}/capture",+ "{}v2/checkout/orders/{}/{complete_authorize_url}",self.base_url(connectors),req.request.connector_transaction_iddiff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rsindex 0de25af53e..3e4cb2a7d5 100644--- a/crates/router/src/connector/paypal/transformers.rs+++ b/crates/router/src/connector/paypal/transformers.rs@@ -207,9 +207,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaypalPaymentsRequest {let intent = if item.request.is_auto_capture()? {PaypalPaymentIntent::Capture} else {- Err(errors::ConnectorError::NotImplemented(- "Manual capture method for Paypal wallet".to_string(),- ))?+ PaypalPaymentIntent::Authorize};let amount = OrderAmount {currency_code: item.request.currency,@@ -476,7 +474,7 @@ impl<F, T>.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;let id = get_id_based_on_intent(&item.response.intent, purchase_units)?;- let (connector_meta, capture_id) = match item.response.intent.clone() {+ let (connector_meta, order_id) = match item.response.intent.clone() {PaypalPaymentIntent::Capture => (serde_json::json!(PaypalMeta {authorize_id: None,@@ -509,6 +507,7 @@ impl<F, T>) {(Some(authorizations), None) => authorizations.first(),(None, Some(captures)) => captures.first(),+ (Some(_), Some(captures)) => captures.first(),_ => None,}.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;@@ -517,7 +516,7 @@ impl<F, T>Ok(Self {status,response: Ok(types::PaymentsResponseData::TransactionResponse {- resource_id: capture_id,+ resource_id: order_id,redirection_data: None,mandate_reference: None,connector_metadata: Some(connector_meta),