ABN-443/fix: credit-memo tax tracks surcharge edit (+ auto-refresh)#205
Merged
dgjlindsay merged 2 commits intoJun 4, 2026
Merged
Conversation
After the ABN-443 de-dup fix (#201) the collector left tax_amount to Magento's native collector, which is blind to the surcharge override field — so editing the refunded surcharge down still refunded the full surcharge VAT (Tax line stuck; over-refund). Apply a tax DELTA = (refundedNet - proportionalDefaultNet) * rate to both tax_amount and grand_total. The proportional default is the surcharge VAT native already refunded, so the delta is exactly zero on the non-override path (preserves #201) and moves the Tax line to the VAT actually refunded when the merchant overrides. Handles override = 0 (removes the default surcharge VAT). Refs ABN-443 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bind the surcharge override input so the totals (Tax line + Grand Total) refresh when the merchant edits it — on blur and on a debounced change — instead of requiring a manual "Update Qty's" click. Reuses Magento's own updateQty round-trip (the input is part of #edit_form) by re-enabling and clicking the existing Update Qty's button; the server-side recalculation is the tax-delta fix in Model/Total/Creditmemo/Surcharge. Implemented as an AMD module taking (doc, win) so the blur/debounce/no-op behaviour is unit-tested under jsdom. Refs ABN-443 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #201/#203/#204. Two parts:
Server (collector): after the #201 de-dup fix the credit-memo collector left
tax_amountto Magento's native collector, which is blind to the surcharge-override field — so editing the refunded surcharge down still refunded the full surcharge VAT (Tax line stuck; over-refund). Now the collector applies a tax delta =(refundedNet − proportionalDefaultNet) × rateto bothtax_amountandgrand_total:Client (UX): the surcharge input now refreshes the totals automatically — on blur and on a debounced change — by re-firing Magento's own "Update Qty's" round-trip (the input is part of
#edit_form), instead of requiring a manual click.Tests: PHPUnit override/no-op cases (147 pass); Jest blur/debounce/no-op cases under jsdom (33 pass).
Refs ABN-443