mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
fix(router): merchant account delete does not delete the merchant_key_store (#2367)
This commit is contained in:
@ -465,11 +465,19 @@ pub async fn merchant_account_delete(
|
||||
state: AppState,
|
||||
merchant_id: String,
|
||||
) -> RouterResponse<api::MerchantAccountDeleteResponse> {
|
||||
let mut is_deleted = false;
|
||||
let db = state.store.as_ref();
|
||||
let is_deleted = db
|
||||
let is_merchant_account_deleted = db
|
||||
.delete_merchant_account_by_merchant_id(&merchant_id)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
|
||||
if is_merchant_account_deleted {
|
||||
let is_merchant_key_store_deleted = db
|
||||
.delete_merchant_key_store_by_merchant_id(&merchant_id)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
|
||||
is_deleted = is_merchant_account_deleted && is_merchant_key_store_deleted;
|
||||
}
|
||||
let response = api::MerchantAccountDeleteResponse {
|
||||
merchant_id,
|
||||
deleted: is_deleted,
|
||||
|
||||
Reference in New Issue
Block a user