menzzo:v2:sales
Overview​
Imports newly created Magento 2 Menzzo sales into LogiDAV.
This command is the entry point for new Menzzo order ingestion and is part of the broader Sales Import Workflow.
Disabled-import alert monitoring is handled by the separate command menzzo:v2:sales:check-disabled-import, which must be scheduled every 30 minutes.
Schedules​
*/10 * * * *- Line 3 in system-crontab.md
Command Details​
menzzo:v2:sales
Intent & Purpose​
The command reads the last imported Magento sale ID from configuration, fetches Magento orders with a greater entity_id, and imports them one by one through SaleService::addOrder(..., true).
This makes it a cursor-based incremental importer rather than a full reconciliation job.
Dependencies​
- Magento order API via
mz.sale.api SaleServicefor create/update logic- config storage for the last imported Magento sale ID
MZ_ACTIVATE_SALES_IMPORTfeature flag inmz_configSystemAlertServicefor failure reporting- RDV handling through
SaleService::handleRdv()
Workflow​
Side Effects​
- creates new
Salerecords when the order is not yet present locally - updates existing
Salerecords when the order already exists - creates or updates
SaleProductrecords - advances the persistent Magento import cursor
- may trigger stock movement logging inside
SaleService::addOrder() - may trigger RDV handling for imported sales in
processingorcomplete - raises a system alert on import failure and continues with the next order
Error Handling and Recovery​
- uses
LockableTraitto avoid concurrent runs - exits with
Sales import is disabled!when the sales import feature flag is disabled - throws if the Magento cursor is missing
- catches per-order exceptions, alerts operators, and skips the failed order instead of aborting the whole batch
- treats deadlock and closed entity manager failures as warning-level alerts rather than full-stop failures
Operator Notes​
- The cursor is stored through
SaleService::getLastMagentoId()/setLastMagentoId(). MZ_ACTIVATE_SALES_IMPORTis the feature flag controlling LogiDAV sales import. A value of1enables the importer; any other value disables this command before Magento orders are fetched.- If
MZ_ACTIVATE_SALES_IMPORTis missing, the command recreates it idempotently with default value1. This default is intentional so a deployment or config corruption does not leave the sales import cron unusable. Existing config values are never overwritten, so this does not change import behavior when the row exists. - This command does not create or resolve disabled-import alerts. That lifecycle belongs to
menzzo:v2:sales:check-disabled-import. - The importer is incremental: if an order is skipped because of an exception, replay usually requires reviewing the cursor and the failed Magento order.
- This command is not the main status reconciliation path. Status drift is handled by
menzzo:v2:sales:update.
Risk Assessment​
Risk Level: critical
This command directly controls whether new orders enter LogiDAV. A failure here can lead to missing orders, delayed fulfillment, and downstream reconciliation issues.
Documentation Status​
- Command class located
- Business purpose documented
- Side effects identified
- Risk level confirmed
- @doc.* annotations added to code