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): fix setup mandate payments to store connector mandate details (#6446)

Amisha Prabhatcee84cdcfd6c
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index a18996ccc3..2c09ffd8ff 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1085,6 +1085,34 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDa
))
.await?;
+ payment_data.payment_method_info = if let Some(payment_method_id) = &payment_method_id {
+ match state
+ .store
+ .find_payment_method(
+ &(state.into()),
+ key_store,
+ payment_method_id,
+ merchant_account.storage_scheme,
+ )
+ .await
+ {
+ Ok(payment_method) => Some(payment_method),
+ Err(error) => {
+ if error.current_context().is_db_not_found() {
+ logger::info!("Payment Method not found in db {:?}", error);
+ None
+ } else {
+ Err(error)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Error retrieving payment method from db")
+ .map_err(|err| logger::error!(payment_method_retrieve=?err))
+ .ok()
+ }
+ }
+ }
+ } else {
+ None
+ };
let mandate_id = mandate::mandate_procedure(
state,
resp,