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]: [CryptoPay] Remove Default Case Handling #2267

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

[REFACTOR]: [CryptoPay] Remove Default Case Handling #2267

Sakilmostak opened this issue Sep 22, 2023 · 14 comments · Fixed by #2643
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
@heysagnik
Copy link

I would like to work on this issue.

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

Sure @heysagnik , I have assigned this issue to you

@swangi-kumari
Copy link
Contributor

Hey @heysagnik ,
Are you still working on this issue?
Please let us know if you need any help:)

@heysagnik heysagnik removed their assignment Oct 18, 2023
@ashutuptiwari
Copy link
Contributor

assign it to me

@ashutuptiwari
Copy link
Contributor

ashutuptiwari commented Oct 18, 2023

Also , just to be clear, we need to handle this default match case
image
and handle it explicitly for the value 'refunded' as well.

@HeetVekariya
Copy link
Contributor

HeetVekariya commented Oct 18, 2023

  • @ashutuptiwari I think that the issue asks to handle the default cases where error is generated.
  • You can just simply search for this errors::connectorerror:: , and you may find the match case which you have to handle default cases.
  • @swangi-kumari You can correct me if I am wrong.

@ashutuptiwari
Copy link
Contributor

this?
image

@ashutuptiwari
Copy link
Contributor

Also, assign this issue to me @swangi-kumari

@swangi-kumari
Copy link
Contributor

Hello @ashutuptiwari , Sure I have assigned this issue to you.

In case you have any queries, you can ask them on this issue thread, or on our discord server, or on slack whichever you are comfortable with

@ashutuptiwari
Copy link
Contributor

Can you clarify the doubts that I mentioned in the previous messages in this thread? @swangi-kumari

@swangi-kumari
Copy link
Contributor

Sure @ashutuptiwari ,
For this issue you just have to handle for the Payment Methods default cases. So handle each and every variant explicitly for that part.

@ashutuptiwari
Copy link
Contributor

Alrighty

@ashutuptiwari
Copy link
Contributor

this?
image

This one?

@swangi-kumari
Copy link
Contributor

Yes @ashutuptiwari

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
Development

Successfully merging a pull request may close this issue.

6 participants