-
-
Notifications
You must be signed in to change notification settings - Fork 793
Tech Doc: Orders and Adjustments updates
Luis Ramos edited this page Apr 11, 2019
·
1 revision
Updating adjustments can be a bit tricky in Spree due to a web of callbacks. Adjustments can be in three different states (simplified): open, closed and finalised. An adjustment can be updated either open or closed.
But when an adjustment is associated to an order, and update triggers the after_save callback update_adjustable which calls update! on the order and that eventually triggers a reset of the adjustment unless it's closed. Here is the rough call trace:
-
adjustment.update_attributestriggersadjustable.update!. -
Order#update!triggers theSpree::OrderUpdater. - The updater updates all shipments and adjustments.
-
Adjustment#update!doesn't do anything if the adjustment is closed. - When the adjustment is open,
originator.update_adjustmentis called. -
ShippingMethod#Adjustmentrecalculates the amount and callsadjustment.update_attribute_without_callbacks(:amount, compute_amount(calculable)).
All this is Spree code. It's not something we accidentally caused with OFN overrides. So Spree defines this way:
- Open shipping adjustments are always recalculated -> can't be changed to a custom value.
- Closed shipping adjustments are not recalculated -> can be changed to a custom value.
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Testing GitHub Actions Locally with act
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
- API documentation
- Authentication
- Integration & API
- Data migration
- Data model diagram (ERD)
- Stripe
- DFC Guide
Instance-specific configuration
External services
Design
- Design styleguide: colors and shadows
- Design styleguide: fonts and text styles
- Design styleguide: size and spacing
- Design styleguide: icons
- Design styleguide: links and buttons
- Design styleguide: navigation and menus
- Design styleguide: tables
- Email templates
- Design tools
Product