Skip to content

Conversation

jagan-jaya
Copy link
Contributor

@jagan-jaya jagan-jaya commented Mar 17, 2025

Type of Change

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

Description

Currently we are creating the interfaces for CRUD operations for each resource in hyperswitch_domain_models which returns a result of Result<Resource, hyperswitch_domain_models::errors::StorageError> and we are implementing them in storage_impl which is expected to return hyperswitch_domain_models::errors::StorageError.

Instead we are making the result in hyperswitch_domain_models to Result<Resource, Self::Error> by which anyone implementing the trait can pass their own error type, this way we can directly return storage_impl::errors::StorageError directly. So a conversion from DomainStorageError to StorageError is not needed.

Datastorage error can be completely replaced with StorageError as both have conversion of ApplicationErrorResponse and other required errors

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?

  1. No business logic is changed
  2. Compilation of v1 and v2 working fine and all the cypress tests passes

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

@jagan-jaya jagan-jaya self-assigned this Mar 17, 2025
Copy link

semanticdiff-com bot commented Mar 17, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments.rs  82% smaller
  crates/storage_impl/src/utils.rs  77% smaller
  crates/router/src/events.rs  75% smaller
  crates/storage_impl/src/mock_db/payout_attempt.rs  72% smaller
  crates/storage_impl/src/payouts/payout_attempt.rs  69% smaller
  crates/storage_impl/src/mock_db/payouts.rs  59% smaller
  crates/router/src/core/errors.rs  58% smaller
  crates/storage_impl/src/payment_method.rs  57% smaller
  crates/storage_impl/src/payouts/payouts.rs  50% smaller
  crates/storage_impl/src/mock_db/payment_attempt.rs  50% smaller
  crates/storage_impl/src/database/store.rs  26% smaller
  crates/router/src/core/errors/utils.rs  16% smaller
  crates/storage_impl/src/kv_router_store.rs  12% smaller
  crates/payment_methods/src/state.rs  5% smaller
  crates/storage_impl/src/lookup.rs  3% smaller
  crates/storage_impl/src/mock_db.rs  2% smaller
  crates/router/src/db/user/sample_data.rs  2% smaller
  crates/storage_impl/src/payments/payment_attempt.rs  1% smaller
  crates/router/src/services.rs  1% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/analytics/src/opensearch.rs  0% smaller
  crates/hyperswitch_domain_models/src/errors.rs  0% smaller
  crates/hyperswitch_domain_models/src/payment_methods.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  0% smaller
  crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs  0% smaller
  crates/hyperswitch_domain_models/src/payouts/payouts.rs  0% smaller
  crates/router/src/core/errors/user/sample_data.rs  0% smaller
  crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_status.rs  0% smaller
  crates/router/src/core/payouts/helpers.rs  0% smaller
  crates/router/src/core/payouts/validator.rs  0% smaller
  crates/router/src/db.rs  0% smaller
  crates/router/src/db/kafka_store.rs  0% smaller
  crates/storage_impl/src/errors.rs  0% smaller
  crates/storage_impl/src/lib.rs  0% smaller
  crates/storage_impl/src/mock_db/payment_intent.rs  0% smaller
  crates/storage_impl/src/payments/payment_intent.rs  0% smaller

@jagan-jaya jagan-jaya marked this pull request as ready for review March 17, 2025 19:55
@jagan-jaya jagan-jaya requested review from a team as code owners March 17, 2025 19:55
jarnura
jarnura previously approved these changes Mar 18, 2025
racnan
racnan previously approved these changes Mar 18, 2025
ShankarSinghC
ShankarSinghC previously approved these changes Mar 19, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 20, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 21, 2025
Merged via the queue into main with commit 80218d0 Mar 21, 2025
17 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refactor-storage-error branch March 21, 2025 14:08
pixincreate added a commit that referenced this pull request Mar 24, 2025
…lobalpay-fixes

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [Recurly] Add record back support for recurly [V2] (#7544)
  refactor(webhook): add jwt authenticated endpoint to list unique webhook events for a profile (#7325)
  feat(core): Add three_ds_requestor_app_url in business_profile (#7589)
  feat(refunds): Add refunds diesel model support in V2 API (#7503)
  fix(connector): [globalpay] address 5xx due to deserialization issue when `account_name` is not passed (#7540)
  chore: update production endpoint url for globalPay (#7588)
  feat(connector): [Stripebilling] add record back support for stripebilling (#7561)
  feat(router): Make payment_method_subtype optional in payment_attempt [V2] (#7568)
  fix(connector): RSync voided status mapping in AuthorizeDotNet (#7566)
  chore(version): 2025.03.24.0
  feat(connector): [Coingate] implement refunds  (#7513)
  feat(connectors): [Redsys] add Psync and Rsync support (#7586)
  refactor(connector): [BRAINTREE] Pass email in payment requests (#7591)
  feat(webhook): Return events list and total_count on list initial delivery attempt call (#7243)
  refactor(router): make error_type generic in domain_models inorder to avoid conversion of errors in storage_impl (#7537)
  feat(router): [V2] Return connector customer reference IDs in `CustomerResponse` (#7319)
  feat: core changes for extended authorization (#6766)
  feat(coingate): Add Payment webhooks (#7489)
  refactor(dynamic_routing): change insert operation to upsert for dynamic_routing_stats (#7398)
  feat(connectors): [Redsys] add 3D secure card payment support, including transaction capture, cancellation, and refunds (#7508)
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.

7 participants