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): [Cryptopay]fix redirection for cryptopay (#4272)
Prasunna Soppa1023f46c885d
diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rsindex aaf21af058..e6db0cf320 100644--- a/crates/router/src/connector/cryptopay/transformers.rs+++ b/crates/router/src/connector/cryptopay/transformers.rs@@ -4,7 +4,7 @@ use reqwest::Url;use serde::{Deserialize, Serialize};use crate::{- connector::utils::{self, is_payment_failure, CryptoData},+ connector::utils::{self, is_payment_failure, CryptoData, PaymentsAuthorizeRequestData},consts,core::errors,services,@@ -70,7 +70,8 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>>pay_currency,success_redirect_url: item.router_data.request.router_return_url.clone(),unsuccess_redirect_url: item.router_data.request.router_return_url.clone(),- metadata: item.router_data.request.metadata.clone(),+ //Cryptopay only accepts metadata as Object. If any other type, payment will fail with error.+ metadata: item.router_data.request.get_metadata_as_object(),custom_id: item.router_data.connector_request_reference_id.clone(),})}diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rsindex 5bdf8b501a..3edaa319fb 100644--- a/crates/router/src/connector/utils.rs+++ b/crates/router/src/connector/utils.rs@@ -498,6 +498,7 @@ pub trait PaymentsAuthorizeRequestData {fn get_surcharge_amount(&self) -> Option<i64>;fn get_tax_on_surcharge_amount(&self) -> Option<i64>;fn get_total_surcharge_amount(&self) -> Option<i64>;+ fn get_metadata_as_object(&self) -> Option<pii::SecretSerdeValue>;}pub trait PaymentMethodTokenizationRequestData {@@ -632,6 +633,19 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {fn is_customer_initiated_mandate_payment(&self) -> bool {self.setup_mandate_details.is_some()}++ fn get_metadata_as_object(&self) -> Option<pii::SecretSerdeValue> {+ self.metadata+ .clone()+ .and_then(|meta_data| match meta_data.peek() {+ serde_json::Value::Null+ | serde_json::Value::Bool(_)+ | serde_json::Value::Number(_)+ | serde_json::Value::String(_)+ | serde_json::Value::Array(_) => None,+ serde_json::Value::Object(_) => Some(meta_data),+ })+ }}pub trait ConnectorCustomerData {