Skip to content

fix: handle Amazon gift-card orders and non-reducing non-bank charge entries#26

Open
denniswalker wants to merge 1 commit into
eshaffer321:mainfrom
denniswalker:fix/amazon-giftcard-and-charge-validation
Open

fix: handle Amazon gift-card orders and non-reducing non-bank charge entries#26
denniswalker wants to merge 1 commit into
eshaffer321:mainfrom
denniswalker:fix/amazon-giftcard-and-charge-validation

Conversation

@denniswalker
Copy link
Copy Markdown

Summary

  • Gift-card-only orders now skip instead of error: Introduced ErrGiftCardOrder sentinel in amazon/order.go. The handler detects it via errors.Is and sets result.Skipped = true with reason "paid entirely with gift cards/points" — previously these logged as ERROR and halted processing of subsequent orders.
  • Charge validator accepts bank-equals-full-total as valid: ValidateCharges now passes when bankSum ≈ 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.
  • Both bugs documented in docs/bug-fixes.md with reproduction order IDs.

Test plan

  • TestAmazonHandler_ProcessOrder_FullyGiftCardOrder — new test; handler returns Skipped=true, no error
  • TestOrder_GetFinalCharges_OnlyGiftCard — updated to use errors.Is(err, ErrGiftCardOrder)
  • TestValidateCharges_BankMatchesOrderTotalWithNonBankEntry — new test; validates order 113-6125291-9439466 scenario passes
  • go test ./... — all existing tests continue to pass

🤖 Generated with Claude Code

…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>
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