hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

[BUG] : `connector_name` in `MerchantConnectorCreate` accepts any value

Open Narayanbhat166 opened this issue 2 years ago • 0 comments

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.

  1. Create a connector_account with any connector_name. ( could be a typo ).
  2. Create a payment with actual connector name.
  3. 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:

  1. Operating System or Linux distribution: Macos
  2. Rust version (output of rustc --version): rustc 1.68.2 (9eb3afe9e 2023-03-27)
  3. 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?

Are you willing to submit a PR?

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

Narayanbhat166 avatar Apr 28 '23 11:04 Narayanbhat166