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

refactor(payment-methods): update session confirm response with payment methods data for a pm token (#12484)

Prasunna Soppa3db97366b676
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 4408cde2ef..4eee988a4f 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -4563,7 +4563,6 @@ pub struct PaymentMethodSessionResponse {
/// payment method data to be sent in session response
#[schema(value_type = Option<PaymentMethodResponseData>)]
- #[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_data: Option<PaymentMethodResponseData>,
/// SDK authorization token for client SDK usage
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index acd2416780..355be673bb 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -6523,6 +6523,8 @@ pub async fn payment_methods_session_confirm(
.await?;
};
+ let associated_pm_data = payment_method_response.payment_method_data.clone();
+
let associated_payment_methods = common_types::payment_methods::AssociatedPaymentMethods {
payment_method_token: common_types::payment_methods::AssociatedPaymentMethodTokenType::PaymentMethodSessionToken(parent_payment_method_token),
};
@@ -6580,7 +6582,7 @@ pub async fn payment_methods_session_confirm(
(tokenization_response.flatten()),
payment_method_response.storage_type,
payment_method_response.card_cvc_token_storage,
- None,
+ associated_pm_data,
payment_method_response.network_token,
);