mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
refactor(payment_methods): add requires_cvv config while creating merchant account (#2431)
This commit is contained in:
@ -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()
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user