Skip to content

1.2.3

🚀 New Features

  • Added per-item fee estimation using Amazon SP-API Fees Estimate (ProductFees). Fee estimates are stored on each order item as fee_estimate_amount and fee_estimate_currency.

🔧 Improvements

  • Record per-item shipping price returned by Amazon order items as shipping_price_amount and shipping_price_currency.
  • fetch_amazon_order_lines() now collects ItemPrice and ShippingPrice, deduplicates ASINs and requests fee estimates in batches (with retry/backoff) and enriches every returned order line with fee estimate data.
  • Added helper _fetch_fee_estimates() to query the Fees Estimate endpoint (OptionalFulfillmentProgram=FBA_EFN) in batches.
  • Added get_cancelled_orders() and get_all_marketplace_cancelled_orders() to the SP-API client and purge cancelled orders (last 14 days) after sync runs.

🐛 Bug Fixes

  • After syncing Amazon orders we now check for cancelled orders in the recent window and delete corresponding amazon_orders rows to avoid keeping items that were cancelled after being created as Pending/Unshipped.

SQL

  • shipping_fee_amazon_orders.sql

  • DB schema additions (nullable columns added to amazon_orders table via SQLModel):

  • shipping_price_amount (FLOAT NULL)
  • shipping_price_currency (TEXT NULL)
  • fee_estimate_amount (FLOAT NULL)
  • fee_estimate_currency (TEXT NULL)

Run your migration tool or apply the generated SQL (shipping_fee_amazon_orders.sql) to add the columns before deploying.

Files changed:

  • app/services/amazon/spapi_client.py — added fee-estimate helper, shipping price extraction, ProductFees usage, and cancelled-order helpers.
  • app/models/amazon_credentials.py — added shipping_price_* and fee_estimate_* fields to AmazonOrderLine.
  • app/schemas/amazon_credentials.py — added corresponding nullable columns to AmazonOrderLineRecord (SQLModel).