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

refactor(router): modify net_amount to be a struct in the domain model of payment_attempt and handle amount changes across all flows #6323

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

sai-harsha-vardhan
Copy link
Contributor

Type of Change

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

Description

modify net_amount to be a struct in the domain model of payment_attempt and handle amount changes across all flows

Main PR - #6252

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?

Test cases in main PR

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

…del of payment_attempt and handle amount changes across all flows (#6252)

Co-authored-by: swangi-kumari <swangi.12015941@lpu.in>
Co-authored-by: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows C-refactor Category: Refactor labels Oct 15, 2024
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Oct 15, 2024
@sai-harsha-vardhan sai-harsha-vardhan requested review from a team as code owners October 15, 2024 11:20
Copy link

semanticdiff-com bot commented Oct 15, 2024

Review changes with SemanticDiff.

Analyzed 36 of 36 files.

Overall, the semantic diff is 11% smaller than the GitHub diff.

File Information
Filename Status
✔️ crates/storage_impl/src/payments/payment_attempt.rs 0.9% smaller
✔️ crates/storage_impl/src/mock_db/payment_attempt.rs Analyzed
✔️ crates/router/src/types.rs 28.31% smaller
✔️ crates/router/src/types/transformers.rs 72.22% smaller
✔️ crates/router/src/types/storage/payment_attempt.rs 38.49% smaller
✔️ crates/router/src/services/kafka/payment_attempt.rs 42.97% smaller
✔️ crates/router/src/services/kafka/payment_attempt_event.rs 42.97% smaller
✔️ crates/router/src/core/payment_link.rs 51.01% smaller
✔️ crates/router/src/core/payments.rs 26.27% smaller
✔️ crates/router/src/core/refunds.rs Analyzed
✔️ crates/router/src/core/payments/helpers.rs 5.0% smaller
✔️ crates/router/src/core/payments/retry.rs 16.45% smaller
✔️ crates/router/src/core/payments/routing.rs Analyzed
✔️ crates/router/src/core/payments/transformers.rs 30.08% smaller
✔️ crates/router/src/core/payments/types.rs Analyzed
✔️ crates/router/src/core/payments/operations/payment_complete_authorize.rs Analyzed
✔️ crates/router/src/core/payments/operations/payment_confirm.rs 53.92% smaller
✔️ crates/router/src/core/payments/operations/payment_create.rs 17.2% smaller
✔️ crates/router/src/core/payments/operations/payment_response.rs 86.94% smaller
✔️ crates/router/src/core/payments/operations/payment_update.rs 1.84% smaller
✔️ crates/router/src/core/payments/operations/payments_incremental_authorization.rs 55.58% smaller
✔️ crates/router/src/core/payment_methods/cards.rs 39.09% smaller
✔️ crates/router/src/core/payment_methods/surcharge_decision_configs.rs 1.46% smaller
✔️ crates/router/src/core/fraud_check/flows/checkout_flow.rs 81.18% smaller
✔️ crates/router/src/core/fraud_check/flows/fulfillment_flow.rs 77.04% smaller
✔️ crates/router/src/core/fraud_check/flows/record_return.rs 81.18% smaller
✔️ crates/router/src/core/fraud_check/flows/sale_flow.rs 81.18% smaller
✔️ crates/router/src/core/fraud_check/flows/transaction_flow.rs 81.18% smaller
✔️ crates/hyperswitch_domain_models/src/router_request_types.rs 5.58% smaller
✔️ crates/hyperswitch_domain_models/src/payments/payment_attempt.rs 1.62% smaller
✔️ crates/diesel_models/src/payment_attempt.rs Analyzed
✔️ crates/diesel_models/src/query/payment_attempt.rs Analyzed
✔️ crates/api_models/src/payment_methods.rs Analyzed
✔️ crates/api_models/src/payments.rs Analyzed
✔️ api-reference-v2/openapi_spec.json 25.0% smaller
✔️ api-reference/openapi_spec.json 25.0% smaller

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 15, 2024
Comment on lines +867 to +868
surcharge_amount,
tax_amount,
Copy link
Member

Choose a reason for hiding this comment

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

Do we allow updating surcharge and tax amounts without updating net amount? Should we include net_amount 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.

Will take up this fix

@bernard-eugine bernard-eugine merged commit 6eb86e7 into hotfix-2024.10.04.0 Oct 15, 2024
18 checks passed
@bernard-eugine bernard-eugine deleted the net-amount-refactor-hotfix branch October 15, 2024 15:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-core Area: Core flows C-refactor Category: Refactor M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants