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: use hashmap deserializer for generic_link options #5157

Merged
merged 12 commits into from
Jul 2, 2024

Conversation

kashif-m
Copy link
Contributor

refactor: use url crate for handling URLs instead of strings in generic_link flows

Type of Change

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

Description

This PR includes below items

  • map requires_fulfillment to Processing state in payout link's status UI
  • use hashmap deserializer for generic_link's enabled_payment_methods
  • migrate any generic_link URL (SDK host / logos / etc.) to use url crate instead of String

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?

  • Tested GenericLink functionality locally.
  • Tested loading of startup variables in application state by modifying values in Cargo.toml and env variables

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

refactor: use url crate for handling URLs instead of strings in generic_link flows
@kashif-m kashif-m self-assigned this Jun 28, 2024
@kashif-m kashif-m linked an issue Jun 28, 2024 that may be closed by this pull request
2 tasks
crates/api_models/src/payment_methods.rs Outdated Show resolved Hide resolved
crates/router/src/configs/settings.rs Outdated Show resolved Hide resolved
crates/router/src/configs/settings.rs Outdated Show resolved Hide resolved
Comment on lines 149 to 153
link: url::Url::parse(url)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!("Failed to parse the payment method collect link - {}", url)
})?,
Copy link
Member

Choose a reason for hiding this comment

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

If this URL is going to be an external input (say provided by the merchant), then raising an internal server error may not be suitable. If it is something that we generate, then it can be an internal server error.

Also, is making it a Url in the other places an option here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By other places, do you mean making it a Url in storage models?

I have kept the URL specific fields in storage models as a String. It's going to use Url in every place (API interface + data injection in HTML) other than storage models

@kashif-m kashif-m marked this pull request as ready for review June 30, 2024 12:58
@kashif-m kashif-m requested review from a team as code owners June 30, 2024 12:58
SanchithHegde
SanchithHegde previously approved these changes Jul 1, 2024
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jul 1, 2024
SanchithHegde
SanchithHegde previously approved these changes Jul 1, 2024
@sahkal sahkal added this to the June 2024 Release milestone Jul 1, 2024
SanchithHegde
SanchithHegde previously approved these changes Jul 1, 2024
sahkal
sahkal previously approved these changes Jul 1, 2024
@kashif-m kashif-m dismissed stale reviews from sahkal and SanchithHegde via 2e1bda1 July 1, 2024 12:31
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 2, 2024
Merged via the queue into main with commit a343f69 Jul 2, 2024
11 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refactor_links branch July 2, 2024 10:01
pixincreate added a commit that referenced this pull request Jul 3, 2024
…ror-handling-in-cypress

* 'main' of github.com:juspay/hyperswitch:
  fix: realtime user analytics (#5129)
  refactor: use hashmap deserializer for generic_link options (#5157)
  refactor(router): changed payment method token TTL to api contract based config from const value (#5115)
  feat(router): collect billing details from wallet connector based on the `collect_billing_details_from_wallet_connector` field (#5065)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add links for collecting payout method details
5 participants