hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

[BUG] 5xx in Payouts flow

Open kashif-m opened this issue 1 year ago • 1 comments

Bug Description

There are a couple of 5xx errors which are thrown during payouts flow. These include

  • Usage of unsupported payment method types for a given connector Eg: Currently, Adyen supports only SEPA bank transfers. If a payout is created for ACH or Bacs transfers, the response would fail with 500 Internal Server Error Fix: Map ConnectorError to ApiErrorResponse for payouts flow

  • If profile_id is not passed during a transaction, given that more than 1 business exist, we receive a 500 until a valid profile_id is passed. Even for an invalid profile_id it throws a 500 which is unexpected Fix: Verify profile_id existence during request validation and map to appropriate error

Expected Behavior

For invalid requests, server throws - 500 Internal Server Error.

Actual Behavior

For invalid requests, server should throw - 4xx depending on the type of error.

Steps To Reproduce

Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.

  1. Head to Postman collection
  2. Create a merchant with two business units
  3. Create an API key
  4. Create two payout connectors - adyen and wise

Issue 1 - 5xx when using payment method not supported by the underlying connector

  1. Create ACH / Bacs bank payout for adyen with confirm: true

Issue 2 - 5xx when profile_id is not passed

  1. Create a card payout for adyen without passing profile_id and confirm: true

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 to help us debug your issue.

If not (or if building/running locally), please provide the following details:

  1. Operating System or Linux distribution: Debian GNU/Linux 12 (bookworm)
  2. Rust version: rustc 1.72.0 (5680fa18f 2023-08-23)
  3. App version: router v1.58.0-3-ge922165-e922165-2023-10-16T15:20:02.000000000Z

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

  • [X] I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

Yes, I am willing to submit a PR!

kashif-m avatar Oct 16 '23 15:10 kashif-m