Skip to content

Fix: chip shows net in Both surcharge display mode - #419

Merged
dgjlindsay merged 1 commit into
stagingfrom
doug/surcharge-chip-both-mode-net
Sep 2, 2026
Merged

Fix: chip shows net in Both surcharge display mode#419
dgjlindsay merged 1 commit into
stagingfrom
doug/surcharge-chip-both-mode-net

Conversation

@dgjlindsay

Copy link
Copy Markdown
Contributor

Summary

  • Payment-method chip's displayedTermSurcharges() resolved gross whenever mode was not excl, so both mode (order summary already renders both net and gross rows) fed gross into the single-value chip too.
  • Only incl now selects gross; excl and both both resolve to net.

Test plan

  • Test/Js/surcharge-gross-display.test.js updated to expect net in both mode; full JS suite green (904 tests).
  • Mutation-checked: reverting the fix makes the both-mode case fail with the old gross values.

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 ✅

@dgjlindsay

Copy link
Copy Markdown
Contributor Author

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

@dgjlindsay
dgjlindsay merged commit f2091b6 into staging Sep 2, 2026
30 checks passed
@dgjlindsay
dgjlindsay deleted the doug/surcharge-chip-both-mode-net branch September 2, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant