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: delete requires cvv config when merchant account is deleted (#2525)

Chethan Raob96855217359
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index ec229bd8a5..226d77d598 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -491,6 +491,25 @@ pub async fn merchant_account_delete(
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
is_deleted = is_merchant_account_deleted && is_merchant_key_store_deleted;
}
+
+ match db
+ .delete_config_by_key(format!("{}_requires_cvv", merchant_id).as_str())
+ .await
+ {
+ Ok(_) => Ok::<_, errors::ApiErrorResponse>(()),
+ Err(err) => {
+ if err.current_context().is_db_not_found() {
+ crate::logger::error!("requires_cvv config not found in db: {err:?}");
+ Ok(())
+ } else {
+ Err(err
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed while deleting requires_cvv config"))?
+ }
+ }
+ }
+ .ok();
+
let response = api::MerchantAccountDeleteResponse {
merchant_id,
deleted: is_deleted,