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): add `requires_cvv` config while creating merchant account (#2431)

Chethan Rao6e5ab0d121d6
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index dabe22da62..c7009bf4cc 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -219,6 +219,17 @@ pub async fn create_merchant_account(
.insert_merchant(merchant_account, &key_store)
.await
.to_duplicate_response(errors::ApiErrorResponse::DuplicateMerchantAccount)?;
+
+ db.insert_config(diesel_models::configs::ConfigNew {
+ key: format!("{}_requires_cvv", merchant_account.merchant_id),
+ config: "true".to_string(),
+ })
+ .await
+ .map_err(|err| {
+ crate::logger::error!("Error while setting requires_cvv config: {err:?}");
+ })
+ .ok();
+
Ok(service_api::ApplicationResponse::Json(
merchant_account
.try_into()
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index c22b732309..20a3e130eb 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1831,7 +1831,7 @@ pub async fn list_customer_payment_method(
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to fetch merchant_id config for requires_cvv")?;
+ .attach_printable("Failed to fetch requires_cvv config")?;
let requires_cvv = is_requires_cvv.config != "false";