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 theuse_reportstoggle on thePOST /orders/syncendpoint (default:true). Reports are saved as TSVs underapp/logs/omni/reports/for inspection and replay.
🔧 Improvements¶
- Reworked Amazon Orders sync to use the Orders v2026-01-01
searchOrdersendpoint 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
searchOrdersthat 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
PENDINGorders from unit prices when theproceedsdataset is missing values. - Cancellation sweep uses
lastUpdatedAfter/lastUpdatedBeforeto 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_statusis extracted from the report and persisted.total_invoice_amountis computed as the sum ofitem-priceacross all rows sharing the sameamazon-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
ServerErrorresults 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
ClientErrorspam by only requesting fee estimates for ASINs with a positive price. - Removed temporary debug dump of raw orders created during troubleshooting.
- Fixed pagination-related
InvalidInputerrors by always including the required date and marketplace params when requesting next pages. - Fixed report download crash caused by an internal
get_report_documentdownload 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/usingPath(__file__).parents[2]). - Ensure only FBA (
fulfillment-channel == 'Amazon') rows are stored and cancelled rows are consistently identified viaorder-status.
SQL¶
- Added migration:
docker/postgres/updates/add_order_status_amazon_orders.sql - Adds
order_statuscolumn toamazon_ordersand 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.