Fix: chip shows net in Both surcharge display mode - #419
Conversation
displayedTermSurcharges() picked gross whenever mode was not 'excl', so Both mode (which shows both rows in the order-summary total) fed gross into the single-value chip too. Only 'incl' should select gross; 'excl' and 'both' now both resolve to net.
There was a problem hiding this comment.
Small, self-contained fix — logic change in displayedTermSurcharges(), the test harness mock, and the test expectations are all consistent with the stated behavior (chip shows net for excl/both, gross only for incl). No critical issues found.
Ready for human approval ✅
|
Self-review: confirmed `displayedTermSurcharges()` is the sole chip-value resolver — grepped `view/` and `Test/Js/` for `displayedTermSurcharges|termSurchargesGross` and the only consumers are `surcharge.js` itself and `gateway_method.js` (chip/tile renderer). No PHP changes were needed: both webapi endpoints already return net+gross+mode, the mode→value pick was entirely client-side. Confirmed `Model/Total/Surcharge.php` and `Block/Sales/Total/Surcharge.php` (the dual-row summary/document renderers) are untouched in this diff — they don't call this resolver. Mutation-checked: reverting the condition change makes the updated `both`-mode test case fail with the old gross values (121/242 instead of 100/200). Full JS suite green (904/904), all 30 CI checks pass including the full DI-compile matrix. by Claude |
Summary
displayedTermSurcharges()resolved gross whenever mode was notexcl, sobothmode (order summary already renders both net and gross rows) fed gross into the single-value chip too.inclnow selects gross;exclandbothboth resolve to net.Test plan
Test/Js/surcharge-gross-display.test.jsupdated to expect net inbothmode; full JS suite green (904 tests).both-mode case fail with the old gross values.