juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
12.27k stars 1.31k forks source link

[FEATURE] Implement `ApiKeyInterface` for `MockDb` #996

Closed SanchithHegde closed 1 year ago

SanchithHegde commented 1 year ago

Spin out from #172. Please refer to that issue for more information.

derekleverenz commented 1 year ago

Hi, can I give this one a shot?

SanchithHegde commented 1 year ago

@derekleverenz Sure! I've assigned this to you.

Feel free to ask any questions you may have.

derekleverenz commented 1 year ago

@SanchithHegde looking at this today, I think its pretty straightforward, but its simpler if I derive Clone for ApiKey and HashedApiKey. is that ok or do you want to avoid extra implementations like that?

SanchithHegde commented 1 year ago

[...] I think its pretty straightforward, but its simpler if I derive Clone for ApiKey and HashedApiKey. is that ok or do you want to avoid extra implementations like that?

Yes, it should be okay to derive Clone for ApiKey and HashedApiKey.

derekleverenz commented 1 year ago

I have a branch up with the changes (https://github.com/juspay/hyperswitch/compare/main...derekleverenz:hyperswitch:fix-996-mockdb-apikeyinterface) but im not sure how best to test it. I can add some unit tests, or else is there a method you would prefer?

SanchithHegde commented 1 year ago

@derekleverenz It should be fine to add unit tests. I took a quick look at your code, it was quite well written, even though it was for a mock database only. Much appreciated!