Skip to content

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

fix(router): get apple pay certificates only from metadata during the session call (#6514)

Shankar Singh C51b6cdfad760
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index ba8054696a..545d05e776 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -189,20 +189,11 @@ async fn create_applepay_session_token(
)
} else {
// Get the apple pay metadata
- let connector_apple_pay_wallet_details =
- helpers::get_applepay_metadata(router_data.connector_wallets_details.clone())
- .map_err(|error| {
- logger::debug!(
- "Apple pay connector wallets details parsing failed in create_applepay_session_token {:?}",
- error
- )
- })
- .ok();
-
- let apple_pay_metadata = match connector_apple_pay_wallet_details {
- Some(apple_pay_wallet_details) => apple_pay_wallet_details,
- None => helpers::get_applepay_metadata(router_data.connector_meta_data.clone())?,
- };
+ let apple_pay_metadata =
+ helpers::get_applepay_metadata(router_data.connector_meta_data.clone())
+ .attach_printable(
+ "Failed to to fetch apple pay certificates during session call",
+ )?;
// Get payment request data , apple pay session request and merchant keys
let (
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5a8bc5cd12..acaccccbb1 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4788,32 +4788,17 @@ pub fn validate_customer_access(
pub fn is_apple_pay_simplified_flow(
connector_metadata: Option<pii::SecretSerdeValue>,
- connector_wallets_details: Option<pii::SecretSerdeValue>,
connector_name: Option<&String>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
- let connector_apple_pay_wallet_details =
- get_applepay_metadata(connector_wallets_details)
- .map_err(|error| {
- logger::debug!(
- "Apple pay connector wallets details parsing failed for {:?} in is_apple_pay_simplified_flow {:?}",
- connector_name,
- error
- )
- })
- .ok();
-
- let option_apple_pay_metadata = match connector_apple_pay_wallet_details {
- Some(apple_pay_wallet_details) => Some(apple_pay_wallet_details),
- None => get_applepay_metadata(connector_metadata)
- .map_err(|error| {
- logger::debug!(
- "Apple pay metadata parsing failed for {:?} in is_apple_pay_simplified_flow {:?}",
+ let option_apple_pay_metadata = get_applepay_metadata(connector_metadata)
+ .map_err(|error| {
+ logger::info!(
+ "Apple pay metadata parsing for {:?} in is_apple_pay_simplified_flow {:?}",
connector_name,
error
)
- })
- .ok(),
- };
+ })
+ .ok();
// return true only if the apple flow type is simplified
Ok(matches!(
@@ -4999,7 +4984,6 @@ where
let connector_data_list = if is_apple_pay_simplified_flow(
merchant_connector_account_type.get_metadata(),
- merchant_connector_account_type.get_connector_wallets_details(),
merchant_connector_account_type
.get_connector_name()
.as_ref(),
@@ -5027,10 +5011,6 @@ where
for merchant_connector_account in profile_specific_merchant_connector_account_list {
if is_apple_pay_simplified_flow(
merchant_connector_account.metadata.clone(),
- merchant_connector_account
- .connector_wallets_details
- .as_deref()
- .cloned(),
Some(&merchant_connector_account.connector_name),
)? {
let connector_data = api::ConnectorData::get_connector_by_name(