Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] merchant account delete does not delete the merchant_key_store #2154

Closed
2 tasks done
Narayanbhat166 opened this issue Sep 13, 2023 · 4 comments · Fixed by #2367
Closed
2 tasks done

[BUG] merchant account delete does not delete the merchant_key_store #2154

Narayanbhat166 opened this issue Sep 13, 2023 · 4 comments · Fixed by #2367
Assignees
Labels
C-bug Category: Bug good first issue Good for newcomers

Comments

@Narayanbhat166
Copy link
Member

Bug Description

When a merchant is created a merchant_key_store is created, which goes along with the merchant_account. But when the merchant account is deleted, the key store is not deleted.

Expected Behavior

Both merchant account and key store should be delted.

Actual Behavior

The key store still exists.

Steps To Reproduce

  • Create a merchant account.
  • Delete the merchant account.

Context For The Bug

No response

Environment

Local

Have you spent some time checking if this bug has been raised before?

  • I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

No, but I'm happy to collaborate on a PR with someone else

@Narayanbhat166 Narayanbhat166 added C-bug Category: Bug good first issue Good for newcomers labels Sep 13, 2023
@dalprahcd
Copy link
Contributor

Hello @Narayanbhat166 I would like to help with this issue.

@Narayanbhat166
Copy link
Member Author

Sure @dalprahcd I have assigned this to you.
Try to do this in a transaction if possible. Refer to this issue for more information #1793

@dalprahcd
Copy link
Contributor

dalprahcd commented Sep 17, 2023

@Narayanbhat166 could you assist me further?

Should I create a delete_merchant_key_store_by_merchant_id function in the crates/router/src/types/storage/merchant_key_store.rs

And then call it here:

https://github.com/juspay/hyperswitch/blob/272f5e4c1f34710fe13b1ede1b938d2f0b76e251/crates/router/src/core/admin.rs#L461C1-L474C2

@SanchithHegde
Copy link
Member

Should I create a delete_merchant_key_store_by_merchant_id function in the crates/router/src/types/storage/merchant_key_store.rs

@dalprahcd A couple of corrections:

  1. You can implement a delete_by_merchant_id() method on MerchantKeyStore in the diesel_models crate here. You can make use of the generic_delete() function to delete the merchant key store entry. (Refer to usages of the generic_delete() function to understand how it can be called.)
  2. You can then add delete_merchant_key_store_by_merchant_id() as a trait method on the MerchantKeyStoreInterface trait and implement it here.

And then call it here:

272f5e4/crates/router/src/core/admin.rs#L461C1-L474C2

Correct. We'd preferably want this to happen in a transaction, but we can take it up in a separate issue and PR, not a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants