Skip to content

1.2.4

🚀 New Features

  • Otto repricer: deduplicate products with the same ASIN when fetching from the Sheets source; only the most recent row per ASIN is kept.

  • Amazon Orders: optional Reports-based sync path using the Selling Partner Reports API (createReport / getReport / getReportDocument). This is enabled by the use_reports toggle on the POST /orders/sync endpoint (default: true). Reports are saved as TSVs under app/logs/omni/reports/ for inspection and replay.

🔧 Improvements

  • Reworked Amazon Orders sync to use the Orders v2026-01-01 searchOrders endpoint with per-status and per-marketplace requests so orders from all marketplaces (e.g. IT, FR, ES) are returned.
  • Added a token-bucket rate limiter for searchOrders that respects Amazon's quota (0.0056 req/s, burst 20) to avoid QuotaExceeded storms.
  • Preserve base query params across pagination pages to avoid InvalidInput errors when following paginationToken.
  • Fee estimation: skip ProductFees requests for zero-priced items to avoid client-side errors and log noise.
  • Compute totals for PENDING orders from unit prices when the proceeds dataset is missing values.
  • Cancellation sweep uses lastUpdatedAfter/lastUpdatedBefore to avoid invalid-parameter errors and correctly capture cancelled orders.
  • Reports-based sync:
  • Report window automatically extends 14 days back from the requested start date so status changes (Pending → Shipped) and cancellations are captured and reconciled in a single run.
  • Rows are filtered to FBA (fulfillment-channel == 'Amazon') and cancelled rows are ignored when building insert/update rows.
  • order_status is extracted from the report and persisted.
  • total_invoice_amount is computed as the sum of item-price across all rows sharing the same amazon-order-id. Item-level price is stored as per-unit price (item-price / quantity).
  • Fee estimation fixes:
  • ProductFees calls are grouped per-marketplace so each ASIN receives an estimate tied to the correct marketplace/currency (e.g. SE → SEK, DE → EUR).
  • Server-side ProductFees ServerError results are retried individually with exponential backoff rather than being treated as permanent failures.
  • ASIN deduplication is done per (asin, marketplace) to avoid returning the wrong fee when the same ASIN sells in multiple countries.
  • Removed item-level shipping fields from the model and from the fee-estimate inputs: shipping is no longer stored per-order-line.

🐛 Bug Fixes

  • Fixed missing orders from non-DE marketplaces (e.g. 171-... IT orders) by querying each marketplace individually instead of sending multiple marketplace IDs in a single call.
  • Prevent ProductFees ClientError spam by only requesting fee estimates for ASINs with a positive price.
  • Removed temporary debug dump of raw orders created during troubleshooting.
  • Fixed pagination-related InvalidInput errors by always including the required date and marketplace params when requesting next pages.
  • Fixed report download crash caused by an internal get_report_document download option — downloads are now performed via the presigned URL with explicit gzip handling and encoding fallbacks (utf-8 / iso-8859-1).
  • Fixed incorrect path resolution when saving reports (now persists to app/logs/omni/reports/ using Path(__file__).parents[2]).
  • Ensure only FBA (fulfillment-channel == 'Amazon') rows are stored and cancelled rows are consistently identified via order-status.

SQL

  • Added migration: docker/postgres/updates/add_order_status_amazon_orders.sql
  • Adds order_status column to amazon_orders and an index
  • Drops legacy shipping/quantity_shipped columns that were removed from the application model (shipping_price_amount, shipping_price_currency, quantity_shipped).

Run this SQL against the Postgres instance before deploying to ensure the database schema matches the application changes.