Skip to content

feat: Add pending status for Amazon orders awaiting shipment#9

Merged
eshaffer321 merged 1 commit intomainfrom
feat/pending-order-status
Jan 2, 2026
Merged

feat: Add pending status for Amazon orders awaiting shipment#9
eshaffer321 merged 1 commit intomainfrom
feat/pending-order-status

Conversation

@eshaffer321
Copy link
Owner

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:

  • Added ErrPaymentPending sentinel error for orders awaiting shipment
  • Amazon handler detects this and returns a skip with reason "payment pending"
  • Orchestrator records as status="pending" (not "failed") and logs at INFO level
  • Orders with pending status will be retried on subsequent syncs

Changes

  • internal/adapters/providers/amazon/order.go - Add ErrPaymentPending error and improved GetFinalCharges() logic
  • internal/adapters/providers/amazon/order_test.go - Add tests for pending scenarios
  • internal/adapters/providers/amazon/provider_test.go - Update existing tests
  • internal/application/sync/handlers/amazon.go - Detect pending and return skip
  • internal/application/sync/orchestrator.go - Handle pending in handleResult()
  • internal/application/sync/recording.go - Add recordPending() function
  • web/src/app/(app)/orders/page.tsx - Add "Pending" to status filter dropdown

Test plan

  • All Go tests pass (go test ./...)
  • UI already supports pending status with amber badge
  • Manual test: Run sync with an unshipped Amazon order - should show INFO log and pending status

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'.
@eshaffer321 eshaffer321 force-pushed the feat/pending-order-status branch from d506e30 to 64abf2f Compare January 2, 2026 03:55
@eshaffer321 eshaffer321 merged commit 6656ef7 into main Jan 2, 2026
13 checks passed
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