feat: Add pending status for Amazon orders awaiting shipment#8
Closed
eshaffer321 wants to merge 10 commits intomainfrom
Closed
feat: Add pending status for Amazon orders awaiting shipment#8eshaffer321 wants to merge 10 commits intomainfrom
eshaffer321 wants to merge 10 commits intomainfrom
Conversation
- Add /sync page with form to configure and start sync jobs - Support provider selection (Walmart, Costco, Amazon) - Add lookback days, max orders, and order ID configuration - Include dry run, force, and verbose options - Display real-time job progress with polling - Add job cancellation support - Fix SyncJob type to match API response (dry_run at top level) - Add Playwright e2e tests for sync page (9 tests) - Add sync API client functions (startSync, getSyncJobs, etc.) - Update navigation to include Sync link
- Fix memory leak by wrapping loadActiveJobs in useCallback - Add confirmation dialog before canceling sync jobs - Improve API error handling to parse server error messages
Brand Designer Fixes: - Use cyan for progress bar and running status (brand color) - Change Amazon badge to orange (official brand color) - Add shadow/depth to progress bar - Tighter table gutters Product Designer Fixes: - Prominent Dry Run toggle with warning styling when disabled - Help text on all form fields - Collapsible Advanced Options section (Force, Verbose) - Auto-dismiss success/error messages after 5 seconds - Save provider preference to localStorage - Mobile card view for job table (responsive) - 4-column form layout on large screens - Last updated timestamp on job list - Improved empty state with icon - Full-width button on mobile - ARIA labels on status badges
- Fix Button component type error by using inline red text styling instead of color prop with plain prop (not allowed by component types) - Add eslint-disable comment for intentional missing dependency in useEffect (loadActiveJobs only needed on mount, not as dependency)
Create brand-aligned SVG icons with sync arrows and receipt/transaction symbolism to represent retail order synchronization: - Add monarch-sync.svg sidebar icon with outer ring, sync arrows, and receipt - Add favicon.svg with simplified design for browser tabs - Update layout to reference new favicon - Update sidebar to use custom brand icon - Include accessibility tags (title, desc) for screen readers Design validated by Brand Designer: A grade (96/100)
Rename from 'Monarch Sync' to 'Retail Sync' to avoid trademark issues with the third-party Monarch Money service. This commit also addresses feedback from expert reviews: - Add desc tag to favicon for WCAG accessibility compliance - Standardize SVG stroke widths to 1.5px for visual consistency - Add immutable cache headers (1 year) for static SVG assets - Update all UI references to new brand name
Fixes branding inconsistency where Quick Start page still referenced 'Monarch Sync' while the rest of the UI uses 'Retail Sync'.
…tracking Tracks payment method charges, refunds, and gift cards for Walmart orders. Provides API endpoints to view ledger history by order ID with filtering by provider, state (pending/charged/partial_refund), and pagination.
Enables starting, cancelling, and monitoring sync jobs via the REST API. Includes job tracking, progress reporting, and concurrent provider handling.
Orders that haven't shipped yet (no bank charges) are now tracked as "pending" instead of "failed". This provides clearer status reporting and ensures these orders are retried on subsequent syncs. Changes: - Add ErrPaymentPending sentinel error for orders not yet charged - Amazon handler detects pending orders and returns skip with reason - Orchestrator records pending status (not error) and logs at INFO level - UI already supports pending status with amber badge; added filter option The pending status is recorded in the database but doesn't block retries since IsProcessed() only checks for status='success'.
| } | ||
|
|
||
| // Get total count | ||
| countQuery := fmt.Sprintf("SELECT COUNT(*) FROM order_ledgers %s", where) |
Check failure
Code scanning / gosec
SQL string formatting Error
Comment on lines
+970
to
+978
| query := fmt.Sprintf(` | ||
| SELECT id, order_id, sync_run_id, provider, fetched_at, ledger_state, | ||
| ledger_version, ledger_json, total_charged, charge_count, | ||
| payment_method_types, has_refunds, is_valid, validation_notes | ||
| FROM order_ledgers | ||
| %s | ||
| ORDER BY fetched_at DESC | ||
| LIMIT ? OFFSET ? | ||
| `, where) |
Check failure
Code scanning / gosec
SQL string formatting Error
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
Orders that haven't shipped yet (no bank charges) are now tracked as "pending" instead of "failed". This provides clearer status reporting and ensures these orders are retried on subsequent syncs.
Problem: When an Amazon order is placed but hasn't shipped yet, there are no bank transactions to match. Previously this was logged as an ERROR and recorded as "failed", which was misleading since the order isn't actually broken - it's just not ready yet.
Solution:
ErrPaymentPendingsentinel error for orders awaiting shipmentChanges
internal/adapters/providers/amazon/order.go- AddErrPaymentPendingerror and improvedGetFinalCharges()logicinternal/adapters/providers/amazon/order_test.go- Add tests for pending scenariosinternal/adapters/providers/amazon/provider_test.go- Update existing testsinternal/application/sync/handlers/amazon.go- Detect pending and return skipinternal/application/sync/orchestrator.go- Handle pending inhandleResult()internal/application/sync/recording.go- AddrecordPending()functionweb/src/app/(app)/orders/page.tsx- Add "Pending" to status filter dropdownTest plan
go test ./...)