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(core): card_network details Missing in Customer Payment Methods List for External 3DS Authentication Payments (#6739)

awasthi2115f873bd1296
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 5a73371c21..67829f1fb7 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -639,12 +639,14 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
} else {
None
};
- payment_attempt.payment_method_data = additional_pm_data_from_locker
- .as_ref()
- .map(Encode::encode_to_value)
- .transpose()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to encode additional pm data")?;
+ // Only set `payment_attempt.payment_method_data` if `additional_pm_data_from_locker` is not None
+ if let Some(additional_pm_data) = additional_pm_data_from_locker.as_ref() {
+ payment_attempt.payment_method_data = Some(
+ Encode::encode_to_value(additional_pm_data)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to encode additional pm data")?,
+ );
+ }
payment_attempt.payment_method = payment_method.or(payment_attempt.payment_method);
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 30891e76e8..3bd5b9abcd 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -531,13 +531,14 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
} else {
None
};
-
- payment_attempt.payment_method_data = additional_pm_data_from_locker
- .as_ref()
- .map(Encode::encode_to_value)
- .transpose()
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to encode additional pm data")?;
+ // Only set `payment_attempt.payment_method_data` if `additional_pm_data_from_locker` is not None
+ if let Some(additional_pm_data) = additional_pm_data_from_locker.as_ref() {
+ payment_attempt.payment_method_data = Some(
+ Encode::encode_to_value(additional_pm_data)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to encode additional pm data")?,
+ );
+ }
let amount = payment_attempt.get_total_amount().into();
payment_attempt.connector_mandate_detail =