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

[REFACTOR]: [PowerTranz] Remove Default Case Handling #2283

Closed
2 tasks done
Sakilmostak opened this issue Sep 22, 2023 · 4 comments · Fixed by #2547
Closed
2 tasks done

[REFACTOR]: [PowerTranz] Remove Default Case Handling #2283

Sakilmostak opened this issue Sep 22, 2023 · 4 comments · Fixed by #2547
Assignees
Labels
A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement good first issue Good for newcomers hacktoberfest Issues that are up for grabs for Hacktoberfest participants

Comments

@Sakilmostak
Copy link
Contributor

📝 Feature Description

  • We utilize match statements to make pivotal decisions, such as generating requests based on the payment method type and managing responses received from the connector.
  • These conditions generally go hand in hand with enum variants.
  • Default case is used because a match statement needs to be exhaustive i.e. every variant needs to be covered.
  • So, if all the explicit cases are handled then default is used to handle the rest.
  • Each connector have these match statements but many of them don’t provide reference to each variant in their default case, rather a _ is put to handle all the other cases.
  • This approach carries a risk because developers may inadvertently overlook the need for explicit handling of the new cases.

🔨 Possible Implementation

🔖 Note: All the changes needed should be contained within hyperswitch/crates/router/src/connector/

📦 Have you spent some time checking if this feature request 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?

@Sakilmostak Sakilmostak added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement S-awaiting-triage Status: New issues that have not been assessed yet hacktoberfest Issues that are up for grabs for Hacktoberfest participants labels Sep 22, 2023
@VedantKhairnar VedantKhairnar added the good first issue Good for newcomers label Sep 28, 2023
@Himanshu-370
Copy link
Contributor

I would like to be assigned on this issue! @VedantKhairnar @Sakilmostak

@Sakilmostak Sakilmostak removed the S-awaiting-triage Status: New issues that have not been assessed yet label Oct 9, 2023
@Sakilmostak
Copy link
Contributor Author

Hi @Himanshu-370 , I have assigned this issue to you👍

@Himanshu-370
Copy link
Contributor

Hi again,
I was trying to understand the issue here and as I am new to rust, I had to take some time reading and understanding the code.
As per my understanding, I had to remove the default match cases _ in the code to handle variants individually. And am I correct to understand that these are the variants here in the screenshot below? (I have commented out the default case code)
image

@Sakilmostak
Copy link
Contributor Author

Hello @Himanshu-370 , Yes, for the default cases you need to remove it and provide all the variants instead.

Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 11, 2023
…ents

This change ensures that all payment variants are handled explicitly to Powertranz payment gateway.

Fixes juspay#2283
Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 11, 2023
Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 11, 2023
Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 20, 2023
Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 20, 2023
Himanshu-370 added a commit to Himanshu-370/hyperswitch that referenced this issue Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement good first issue Good for newcomers hacktoberfest Issues that are up for grabs for Hacktoberfest participants
Projects
None yet
3 participants