Skip to content

Commit f254aa1

Browse files
committed
fix/pmd_getting_overrided
1 parent 9017fd1 commit f254aa1

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

crates/router/src/core/payments/operations/payment_confirm.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,12 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
640640
None
641641
};
642642
// Only set `payment_attempt.payment_method_data` if `additional_pm_data_from_locker` is not None
643-
if additional_pm_data_from_locker.is_some() {
644-
payment_attempt.payment_method_data = additional_pm_data_from_locker
645-
.as_ref()
646-
.map(Encode::encode_to_value)
647-
.transpose()
648-
.change_context(errors::ApiErrorResponse::InternalServerError)
649-
.attach_printable("Failed to encode additional pm data")?;
643+
if let Some(additional_pm_data) = additional_pm_data_from_locker.as_ref() {
644+
payment_attempt.payment_method_data = Some(
645+
Encode::encode_to_value(additional_pm_data)
646+
.change_context(errors::ApiErrorResponse::InternalServerError)
647+
.attach_printable("Failed to encode additional pm data")?,
648+
);
650649
}
651650

652651
payment_attempt.payment_method = payment_method.or(payment_attempt.payment_method);

crates/router/src/core/payments/operations/payment_create.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,12 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
532532
None
533533
};
534534
// Only set `payment_attempt.payment_method_data` if `additional_pm_data_from_locker` is not None
535-
if additional_pm_data_from_locker.is_some() {
536-
payment_attempt.payment_method_data = additional_pm_data_from_locker
537-
.as_ref()
538-
.map(Encode::encode_to_value)
539-
.transpose()
540-
.change_context(errors::ApiErrorResponse::InternalServerError)
541-
.attach_printable("Failed to encode additional pm data")?;
535+
if let Some(additional_pm_data) = additional_pm_data_from_locker.as_ref() {
536+
payment_attempt.payment_method_data = Some(
537+
Encode::encode_to_value(additional_pm_data)
538+
.change_context(errors::ApiErrorResponse::InternalServerError)
539+
.attach_printable("Failed to encode additional pm data")?,
540+
);
542541
}
543542
let amount = payment_attempt.get_total_amount().into();
544543

0 commit comments

Comments
 (0)