[BUG] : `connector_name` in `MerchantConnectorCreate` accepts any value
Bug Description
When creating a merchant connector account, the connector_name field is of string type. This would mean that any value can be passed to that field. There is no check done to validate whether the connector name given, is actually supported. This creates an issue in the payments flow when the connector is accessed as enum here https://github.com/juspay/hyperswitch/blob/58332f055e640ec810a3c6cc8e534f2f862e57dc/crates/router/src/types/api.rs#L144. The conversion function from string to enum can be found here https://github.com/juspay/hyperswitch/blob/58332f055e640ec810a3c6cc8e534f2f862e57dc/crates/router/src/types/api.rs#L185
Expected Behavior
It should only accept the connector_name which are supported by hyperswitch.
Actual Behavior
It accepts any value and then fails when creating the payment.
Steps To Reproduce
Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
- Create a
connector_accountwith anyconnector_name. ( could be a typo ). - Create a payment with actual connector name.
- The payment fails saying
Merchant connector account does not exist in our records
Context For The Bug
No response
Environment
Are you using hyperswitch hosted version? No
If yes, please provide the value of the x-request-id response header for helping us debug your issue.
If not (or if building/running locally), please provide the following details:
- Operating System or Linux distribution: Macos
- Rust version (output of
rustc --version):rustc 1.68.2 (9eb3afe9e 2023-03-27) - App version (output of
cargo r -- --version): ``
Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Are you willing to submit a PR?
No, but I'm happy to collaborate on a PR with someone else