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(router): return missing required field error when a domain is missing during apple pay session call (#5596)
Shankar Singh C751ba15482f6
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rsindex cdd8452fdb..4a1d57cda3 100644--- a/crates/router/src/core/payments/flows/session_flow.rs+++ b/crates/router/src/core/payments/flows/session_flow.rs@@ -411,10 +411,8 @@ async fn create_applepay_session_token("Retry apple pay session call with the merchant configured domain {error:?}");let merchant_configured_domain = merchant_configured_domain_optional- .ok_or(errors::ApiErrorResponse::InternalServerError)- .attach_printable(- "Failed to get initiative_context for apple pay session call retry",- )?;+ .get_required_value("apple pay domain")+ .attach_printable("Failed to get domain for apple pay session call")?;let apple_pay_retry_session_request =payment_types::ApplepaySessionRequest {initiative_context: merchant_configured_domain,@@ -496,15 +494,16 @@ fn get_session_request_for_manual_apple_pay(session_token_data: payment_types::SessionTokenInfo,merchant_domain: Option<String>,) -> RouterResult<payment_types::ApplepaySessionRequest> {- let initiative_context = session_token_data- .initiative_context- .ok_or(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Failed to get initiative_context for apple pay session call")?;+ let initiative_context = merchant_domain+ .or_else(|| session_token_data.initiative_context.clone())+ .get_required_value("apple pay domain")+ .attach_printable("Failed to get domain for apple pay session call")?;+Ok(payment_types::ApplepaySessionRequest {merchant_identifier: session_token_data.merchant_identifier.clone(),display_name: session_token_data.display_name.clone(),initiative: session_token_data.initiative.to_string(),- initiative_context: merchant_domain.unwrap_or(initiative_context),+ initiative_context,})}