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(connector): [Noon] Remove Default Case Handling #2677

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

SagarDevAchar
Copy link
Contributor

@SagarDevAchar SagarDevAchar commented Oct 25, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

No test cases. As In this PR only error message have been populated for all default cases.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@SagarDevAchar SagarDevAchar requested a review from a team as a code owner October 25, 2023 00:59
@SagarDevAchar SagarDevAchar reopened this Oct 25, 2023
@swangi-kumari swangi-kumari added A-connector-integration Area: Connector integration C-refactor Category: Refactor hacktoberfest Issues that are up for grabs for Hacktoberfest participants labels Oct 25, 2023
@swangi-kumari
Copy link
Contributor

Hey @SagarDevAchar ,
The changes you made is right but you also have to fill the default cases for WalletData (line - 248) Please fill the matching arms for that too.

@SagarDevAchar
Copy link
Contributor Author

@swangi-kumari got it!

@swangi-kumari
Copy link
Contributor

Hey @SagarDevAchar ,

Pls address the CI fails

Run cargo +nightly fmt for formatting.

and cargo run --features openapi -- generate-openapi-spec for validating generated openApi spec file. And commit it.

@SagarDevAchar
Copy link
Contributor Author

@swangi-kumari

Pls address the CI fails

Will do!

and cargo run --features openapi -- generate-openapi-spec for validating generated openApi spec file. And commit it.

I cannot seem to get cargo run --features openapi -- generate-openapi-spec or cargo clippy to run successfully
I am stuck with errors like:

error[E0432]: unresolved import `core::any::Demand`
.
.
error[E0432]: unresolved imports `core::any::Demand`, `core::any::Provider`
.
.
error[E0425]: cannot find function `request_ref` in module `any`
.
.

How do I resolve this?
Is there a different version / build of rust I need to be using? (My rustc version is 1.75.0-nightly)

@SanchithHegde
Copy link
Member

@SagarDevAchar You don't necessarily need the nightly toolchain for compiling our code, please use the stable toolchain for the purpose. For formatting code alone, you can use the nightly toolchain using the command cargo +nightly fmt.

And I checked the changes in this PR, I don't think you need to specify the generics for the return type (Ok::<NoonPaymentData, E>(...)), only using Ok(...) should suffice.

@SagarDevAchar
Copy link
Contributor Author

SagarDevAchar commented Oct 27, 2023

@SanchithHegde

@SagarDevAchar You don't necessarily need the nightly toolchain for compiling our code, please use the stable toolchain for the purpose. For formatting code alone, you can use the nightly toolchain using the command cargo +nightly fmt.

Got it!

And I checked the changes in this PR, I don't think you need to specify the generics for the return type (Ok::<NoonPaymentData, E>(...)), only using Ok(...) should suffice.

Well, on router compilation with just Ok(...), the toolchain gave out errors stating the need for type annotations for Result

image

Hence, I have added the type annotations to Ok(...) as Ok::<NoonPaymentData, errors::ConnectorError>(...) and the CI Checks succeed (The CI-pr / Spell check failure is due to #2596 which has been merged into main)

Please review and let me know of any changes necessary!

crates/router/src/connector/noon/transformers.rs Outdated Show resolved Hide resolved
crates/router/src/connector/noon/transformers.rs Outdated Show resolved Hide resolved
crates/router/src/connector/noon/transformers.rs Outdated Show resolved Hide resolved
@swangi-kumari swangi-kumari linked an issue Oct 29, 2023 that may be closed by this pull request
2 tasks
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Thanks for the PR, @SagarDevAchar!

@preetamrevankar preetamrevankar added this pull request to the merge queue Oct 30, 2023
Merged via the queue into juspay:main with commit 452090d Oct 30, 2023
11 checks passed
@deepanshu-iiitu
Copy link
Contributor

Hey @SagarDevAchar ,
Thanks a bunch for all your contributions! We've got a little something for you to show our appreciation.
Just take a moment to fill out this form, and get ready for some awesome swag coming your way.
Thanks!

@SagarDevAchar SagarDevAchar deleted the noon_issue_2277 branch November 1, 2023 04:57
@SagarDevAchar SagarDevAchar restored the noon_issue_2277 branch November 5, 2023 10:58
@SanchithHegde SanchithHegde added the hacktoberfest-accepted Pull requests accepted as Hacktoberfest contributions label Nov 5, 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-refactor Category: Refactor hacktoberfest Issues that are up for grabs for Hacktoberfest participants hacktoberfest-accepted Pull requests accepted as Hacktoberfest contributions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR]: [Noon] Remove Default Case Handling
7 participants