refactor: delete requires cvv config when merchant account is deleted (#2525)

This commit is contained in:
Chethan Rao
2023-10-11 11:45:58 +05:30
committed by GitHub
parent 7acf101014
commit b968552173

View File

@ -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,