Skip to content

Allow changing the order recalculator - #5110

Merged
kennyadsl merged 1 commit into
solidusio:mainfrom
mamhoff:configurable-order-updater
Jun 5, 2023
Merged

kennyadsl merged 1 commit into
solidusio:mainfrom
mamhoff:configurable-order-updater

Conversation

@mamhoff

@mamhoff mamhoff commented May 31, 2023

Copy link
Copy Markdown
Contributor

Summary

This adds a preference to change the order updater. The order updater, a very central piece of Solidus' infrastructure, carries a bit of technical debt. Unfortunately, it's extremely hard to change because every line of this class might have been overwritten by implementors.

This configuration allows switching the order updater class, with the intention of being able to introduce breaking changes from a gem without patching the original order recalculator.

Additionally, the order.recalculate and order.recalculator are introduced as aliases to the now deprecated order.update and order.updater in order to clarify the intention of these methods.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@mamhoff
mamhoff requested a review from a team as a code owner May 31, 2023 10:23
@github-actions github-actions Bot added the changelog:solidus_core Changes to the solidus_core gem label May 31, 2023
@mamhoff
mamhoff force-pushed the configurable-order-updater branch from 795fb96 to fcf0e8a Compare May 31, 2023 10:37
@codecov

codecov Bot commented May 31, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #5110 (fcf0e8a) into main (474877a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5110   +/-   ##
=======================================
  Coverage   88.63%   88.64%           
=======================================
  Files         563      563           
  Lines       13879    13883    +4     
=======================================
+ Hits        12302    12306    +4     
  Misses       1577     1577           
Impacted Files Coverage Δ
core/app/models/spree/order.rb 94.63% <100.00%> (+0.02%) ⬆️
core/app/models/spree/order_merger.rb 100.00% <100.00%> (ø)
core/app/models/spree/order_updater.rb 100.00% <100.00%> (ø)
core/app/models/spree/refund.rb 97.91% <100.00%> (ø)
core/lib/spree/app_configuration.rb 99.27% <100.00%> (+<0.01%) ⬆️
core/lib/spree/core/importer/order.rb 97.47% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

This adds a preference to change the order updater. The order updater, a
very central piece of Solidus' infrastructure, carries a bit of
technical debt. Unfortunately, it's extremely hard to change because
every line of this class might have been overwritten by implementors.

This configuration allows switching the order updater class, with the
intention of being able to introduce breaking changes from a gem without
patching the original order recalculator.

Additionally, the `order.recalculate` and `order.recalculator` are
introduced as aliases to the now deprecated `order.update` and
`order.updater` in order to clarify the intention of these methods.

@waiting-for-dev waiting-for-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like a step in the good direction to me! Thanks for taking this.

@kennyadsl kennyadsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like it! Even with this first step only, it's a big improvement, thanks @mamhoff!

@kennyadsl
kennyadsl merged commit 4cf0ca4 into solidusio:main Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants