fix: handle Amazon gift-card orders and non-reducing non-bank charge entries#26
Open
denniswalker wants to merge 1 commit into
Open
Conversation
…entries - Introduce ErrGiftCardOrder sentinel; handler now skips (not errors) orders paid entirely with gift cards/points - ValidateCharges passes when bank sum equals full order total, covering promotional credits/rewards-earned entries that don't reduce the card charge - Update tests to use errors.Is(err, ErrGiftCardOrder) and add regression cases for both bugs (orders 112-4444156-8489869 and 113-6125291-9439466) - Document both fixes in docs/bug-fixes.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
ErrGiftCardOrdersentinel inamazon/order.go. The handler detects it viaerrors.Isand setsresult.Skipped = truewith reason"paid entirely with gift cards/points"— previously these logged asERRORand halted processing of subsequent orders.ValidateChargesnow passes whenbankSum ≈ orderTotal, covering promotional credits / rewards-earned entries that appear in Amazon's transaction list but don't actually reduce the card charge — previously these caused a spurious "bank charges exceed expected" warning and the order was skipped.docs/bug-fixes.mdwith reproduction order IDs.Test plan
TestAmazonHandler_ProcessOrder_FullyGiftCardOrder— new test; handler returnsSkipped=true, no errorTestOrder_GetFinalCharges_OnlyGiftCard— updated to useerrors.Is(err, ErrGiftCardOrder)TestValidateCharges_BankMatchesOrderTotalWithNonBankEntry— new test; validates order 113-6125291-9439466 scenario passesgo test ./...— all existing tests continue to pass🤖 Generated with Claude Code