Repository navigation
fix: match Amazon multi-shipment charges by their own charge date - #120
Merged
Merged
Conversation
Order 112-8585165-6989818 (Nov 5) had a second shipment charged Nov 11, 6 days later. The multi-charge matcher only checked the order date ±5 days, so the order sat at "Waiting for remaining Amazon charges to post" forever. Carry each charge's date from Amazon into the matcher and accept transactions near either the order date or the charge date.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #120 +/- ##
==========================================
+ Coverage 66.91% 67.03% +0.11%
==========================================
Files 53 53
Lines 7460 7480 +20
==========================================
+ Hits 4992 5014 +22
+ Misses 2111 2108 -3
- Partials 357 358 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Problem
Amazon order
112-8585165-6989818(dated Nov 5, $492.65) was charged in two shipments: $294.46 on Nov 6 and $198.19 on Nov 11. Both posted to Monarch, but every sync loggedWaiting for remaining Amazon charges to post expected=2 found=1and left the transactions uncategorized.The multi-charge matcher compared every charge only to the order date ±5 days. The Nov 11 charge was 6 days out. Amazon reports each charge's date, but
GetFinalChargesreturned only the amounts, so that date was lost.Fix
amazon.Order.GetFinalChargeDates(): charge dates aligned index for index withGetFinalChargesMatcher.FindMultipleMatchesWithDates: a transaction is eligible within tolerance of the order date or that charge's own date, and a known charge date is used for scoring.FindMultipleMatchesdelegates with no dates, so Walmart is unchanged.Testing
skip reason: payment pending):TestMatcher_FindMultipleMatchesWithDates_UsesChargeDateTestMatcher_FindMultipleMatchesWithDates_ZeroDateFallsBackToOrderDateTestOrder_GetFinalChargeDates_AlignedWithChargesTestAmazonHandler_ProcessOrder_LateShipmentChargeMatchesByChargeDatego test -race ./..., golangci-lint v2.14.0,go vet, andgo mod tidyare all cleanAlso runs gofmt on
internal/domain/matcher/multi{,_test}.go, which were already unformatted (import order and comment alignment only).