Skip to content

ABN-443/fix: credit-memo surcharge override polish (display, zero-handling, messages)#206

Merged
dgjlindsay merged 3 commits into
stagingfrom
doug/ABN-443-surcharge-input-locale-format
Jun 5, 2026
Merged

ABN-443/fix: credit-memo surcharge override polish (display, zero-handling, messages)#206
dgjlindsay merged 3 commits into
stagingfrom
doug/ABN-443-surcharge-input-locale-format

Conversation

@dgjlindsay
Copy link
Copy Markdown
Contributor

@dgjlindsay dgjlindsay commented Jun 5, 2026

Bundled follow-ups on the credit-memo surcharge override input (all touch the same block/plugin/template):

  1. Locale display — input renders in the admin locale, 2dp (e.g. 2,50, not the raw 2.5) via FormatInterface.
  2. Explicit-zero / blank — typing 0 or clearing the field now sticks (refund no surcharge) instead of snapping back to the full default. getDefaultRefund honors the collected value; a blank field is treated as an explicit 0 override.
  3. Brand-neutral guard messages — drop "Two" ("Surcharge refund …", "… exceeds the remaining refundable surcharge …") per U2 brand-isolation, with nl_NL / sv_SE / nb_NO translations.
  4. Remove field auto-refresh — drop the blur/debounce JS; the surcharge recalculates on the standard Update Totals click, consistent with native shipping/adjustment fields.

Tests: PHPUnit block (zero + default paths) + plugin (blank→0, locale value, brand-neutral message); 153 PHPUnit, 28 Jest. Refs ABN-443

The override input re-rendered its value from a raw float, so after an AJAX
recalc a typed "2,50" came back as "2.5" — losing the trailing zero and the
locale decimal separator. Render it via the admin locale: fixed 2dp with the
locale decimal symbol (2,50 for nl_NL, 2.50 for en), no grouping (the override
parser rejects thousands separators by design).

Refs ABN-443

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

dgjlindsay and others added 2 commits June 5, 2026 01:52
…d message

Credit-memo surcharge override fixes:
- An explicit 0 (or a cleared field, now treated as 0) no longer snaps the
  input back to the full proportional default — getDefaultRefund honors the
  collected value once collectTotals has run.
- Guard messages drop the "Two" brand ("Surcharge refund ..."), per U2
  brand-isolation, with nl_NL / sv_SE / nb_NO translations.

Unit tests for the block (explicit-zero + proportional-default paths) and the
plugin (blank→0, locale value, brand-neutral exceeds message).

Refs ABN-443

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e Totals

Removes the blur/debounced-change auto-refresh on the surcharge override input
(JS module + template hook + Jest test). The surcharge now recalculates only
on the standard "Update Qty's"/"Update Totals" click, consistent with
Magento's native shipping/adjustment fields — less surprising than a field
that round-trips on its own.

Refs ABN-443

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dgjlindsay dgjlindsay changed the title ABN-443/fix: render credit-memo surcharge input in admin locale (2dp) ABN-443/fix: credit-memo surcharge override polish (display, zero-handling, messages) Jun 5, 2026
@dgjlindsay dgjlindsay merged commit 7bac9e1 into staging Jun 5, 2026
20 checks passed
@dgjlindsay dgjlindsay deleted the doug/ABN-443-surcharge-input-locale-format branch June 5, 2026 00:58
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