fix: respect insure from setting - #515
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #515 +/- ##
=========================================
Coverage 94.31% 94.31%
- Complexity 2419 2420 +1
=========================================
Files 352 352
Lines 7738 7738
=========================================
Hits 7298 7298
Misses 440 440 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes insurance calculation so that when shipment option insurance is resolved to tri-state ENABLED (1) by the settings-resolution step, InsuranceCalculator derives the insured amount from carrier settings (including the “insure from” threshold) instead of mistakenly treating 1 as a literal insured amount.
Changes:
- Update
InsuranceCalculatorto treatINHERIT (-1)andENABLED (1)as “derive from carrier settings”. - Add/extend unit coverage to run
TriStateOptionCalculator+InsuranceCalculatortogether for realistic export behavior. - Update the delivery options endpoint unit test expectation to match the corrected insurance derivation logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Unit/App/Order/Calculator/General/InsuranceCalculatorTest.php | Adds integration-style cases that include TriStateOptionCalculator, ensuring “insure from” and “insure up to” settings are applied in the real calculator order. |
| tests/Unit/App/Endpoint/GetDeliveryOptionsEndpointTest.php | Updates expected insurance amount in micro-units to reflect deriving from carrier settings (and applying the exportInsuranceUpTo cap). |
| src/App/Order/Calculator/General/InsuranceCalculator.php | Fixes interpretation of insurance=1 so it triggers settings-based derivation rather than tier resolution of a 1-cent “explicit amount”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
51e8989 to
c59107f
Compare
INT-1781
c59107f to
be3db73
Compare
## [4.7.1](v4.7.0...v4.7.1) (2026-08-07) ### 🐛 Bug Fixes * respect insure from setting ([#515](#515)) ([a611219](a611219))
INT-1781