refactor(payment_methods): add requires_cvv config while creating merchant account (#2431)

This commit is contained in:
Chethan Rao
2023-10-04 17:37:37 +05:30
committed by GitHub
parent d177b4d94f
commit 6e5ab0d121
2 changed files with 12 additions and 1 deletions

View File

@ -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()

View File

@ -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";