Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(business_profile): introduce domain models for business profile v1 and v2 APIs #5497

Merged
merged 14 commits into from
Aug 1, 2024

Conversation

SanchithHegde
Copy link
Member

Type of Change

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

Description

This PR includes the following changes:

  1. Refactors code to ensure that all updates to the business_profile table always include an update of the modified_at field.
  2. Introduces the BusinessProfileUpdate::RoutingAlgorithmUpdate for use in routing code and to slightly improve code readability.
  3. Updates the apply_changeset() method on BusinessProfileUpdate to use fields from the source object for fields which are not being updated.
    • This function is only called in the BusinessProfileInterface implementation for MockDb, so this should not affect production code.
  4. Adds database migrations for business profile v2, and introduces corresponding types (and feature flags) in the diesel_models and common_enums crates.
  5. Introduces business profile v1 and v2 types (and feature flags) in the hyperswitch_domain_models crate.
    • The code has not been updated to make use of either of these domain models anywhere. The refactor to use business profile v1 domain models throughout the codebase will be taken up in a separate PR, since it affects a lot of files.

To reiterate, this PR does not affect any production code, and only adds new code, while moving existing code behind suitable feature flags.

Additional Changes

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

This PR includes database migrations for and updates schema for business profile v2 APIs, does not affect business profile v1 schema.

Motivation and Context

Enabling / unblocking business profile v2 changes or any other changes dependent on business profile v2 types.

How did you test it?

Ran the following commands and ensured they've passed:

# Ensuring successful compilation of v1 and v2 diesel models
cargo clippy -p diesel_models
cargo clippy -p diesel_models --no-default-features --features v2,business_profile_v2

# Ensuring successful compilation of v1 and v2 domain models
cargo clippy -p hyperswitch_domain_models
cargo clippy -p hyperswitch_domain_models --no-default-features --features v2,business_profile_v2

# Ensuring clippy passes as usual
just clippy

Attaching a screenshot of the same:
Screenshot of checks running successfully

In addition, I've done sanity testing using Postman.

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

@SanchithHegde SanchithHegde added A-framework Area: Framework C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed M-database-changes Metadata: This PR involves database schema changes labels Jul 31, 2024
@SanchithHegde SanchithHegde self-assigned this Jul 31, 2024
@SanchithHegde SanchithHegde requested review from a team as code owners July 31, 2024 15:46
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Jul 31, 2024
@SanchithHegde SanchithHegde added the M-database-changes Metadata: This PR involves database schema changes label Jul 31, 2024
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Jul 31, 2024
@SanchithHegde SanchithHegde added the M-database-changes Metadata: This PR involves database schema changes label Jul 31, 2024
Narayanbhat166
Narayanbhat166 previously approved these changes Aug 1, 2024
justfile Outdated Show resolved Hide resolved
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
@SanchithHegde SanchithHegde added the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
jarnura
jarnura previously approved these changes Aug 1, 2024
@SanchithHegde SanchithHegde added this to the July 2024 Release milestone Aug 1, 2024
@SanchithHegde SanchithHegde added the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
Narayanbhat166
Narayanbhat166 previously approved these changes Aug 1, 2024
Aprabhat19
Aprabhat19 previously approved these changes Aug 1, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 1, 2024
@SanchithHegde SanchithHegde removed this pull request from the merge queue due to a manual request Aug 1, 2024
@hyperswitch-bot hyperswitch-bot bot removed the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
@SanchithHegde SanchithHegde added the M-database-changes Metadata: This PR involves database schema changes label Aug 1, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 1, 2024
Merged via the queue into main with commit 537630f Aug 1, 2024
14 checks passed
@likhinbopanna likhinbopanna deleted the business-profile-domain-models branch August 1, 2024 14:08
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Aug 1, 2024
pixincreate added a commit that referenced this pull request Aug 5, 2024
…ypress-x2

* 'main' of github.com:juspay/hyperswitch:
  refactor(cypress): pass `connector_type` externally (#5522)
  refactor(router): refactor merchant_connector update v2 flow (#5484)
  feat(router): add accept language header middleware  (#5500)
  chore(version): 2024.08.05.0
  chore(postman): update Postman collection files
  fix(pm_auth): Added mca status check in pml (#5421)
  refactor(payment_methods): List the Payment Methods for Merchant , based on the connector  type (#4909)
  fix(router): [Iatapay] make error status and error message optional (#5382)
  chore(version): 2024.08.02.0
  feat(business_profile): introduce domain models for business profile v1 and v2 APIs (#5497)
  feat(auth): Add `profile_id` in `AuthenticationData` (#5492)
  feat(core): accept business profile in core functions for payments, refund, payout and disputes (#5498)
  refactor(router): domain and diesel model changes for merchant_connector_account create v2 flow (#5462)
  fix(open_payment_links): send displaySavedPaymentMethods as false explicitly for open payment links (#5501)
  refactor(role): determine level of role entity (#5488)
pixincreate added a commit that referenced this pull request Aug 5, 2024
* 'main' of github.com:juspay/hyperswitch: (37 commits)
  fix(connector): Fixed status mapping for Plaid (#5525)
  feat(core): accept profile_id in merchant_account, connectors and customers core functions (#5505)
  refactor(auth): Pass `profile_id` from the auth to core functions (#5520)
  refactor(routing): Refactor api v2 routes for deactivating and retrieving the routing config (#5478)
  refactor(cypress): pass `connector_type` externally (#5522)
  refactor(router): refactor merchant_connector update v2 flow (#5484)
  feat(router): add accept language header middleware  (#5500)
  chore(version): 2024.08.05.0
  chore(postman): update Postman collection files
  fix(pm_auth): Added mca status check in pml (#5421)
  refactor(payment_methods): List the Payment Methods for Merchant , based on the connector  type (#4909)
  fix(router): [Iatapay] make error status and error message optional (#5382)
  chore(version): 2024.08.02.0
  feat(business_profile): introduce domain models for business profile v1 and v2 APIs (#5497)
  feat(auth): Add `profile_id` in `AuthenticationData` (#5492)
  feat(core): accept business profile in core functions for payments, refund, payout and disputes (#5498)
  refactor(router): domain and diesel model changes for merchant_connector_account create v2 flow (#5462)
  fix(open_payment_links): send displaySavedPaymentMethods as false explicitly for open payment links (#5501)
  refactor(role): determine level of role entity (#5488)
  feat(cypress): add corner cases (#5481)
  ...
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-framework Area: Framework C-feature Category: Feature request or enhancement M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants