feat(core): add shipment lifecycle and delivery webhook - #605
Open
Ibochkarev wants to merge 2 commits into
Open
Conversation
Fulfillment packages need a first-class shipment row and tracking without overloading order status or msDelivery.properties. Keep checkout unchanged until ms3_shipment_enabled is on.
This was referenced Aug 19, 2026
Keep webhook replay honest across event ids, expose shipment in Fenom and the order editor, and cover PdoShipmentStore on MySQL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Добавляет сущность отгрузки (
ms3_shipments) иShipmentLifecycleService, чтобы fulfillment-пакеты вели статус доставки и трек отдельно от справочникаmsDeliveryи от одного толькоorder.status_id.По умолчанию
ms3_shipment_enabled=false. Checkout, submit и ручная смена статуса заказа не меняются. Публичный webhook отвечает 404. Менеджер или пакет может создать shipment и записатьtracking_numberбез смены статуса заказа.При включённом флаге
shippedмапится наms3_status_sentчерезOrderStatusService(не прямойstatus_id).cancelled/failedидут вms3_status_canceled.in_transitиdeliveredпо умолчанию статус заказа не трогают (сидsentфинальный). Падениеchange()логируется, строка отгрузки уже сохранена.Публичный callback:
POST /api/v1/delivery/webhook/{delivery_id}(без customer token, подпись провайдера). Cost-onlyDefaultDeliverywebhook не принимает. ОпциональныйShipmentProviderInterface. HMAC:ShipmentWebhookHmac. Кабинет и Fenomms3_get_orderотдаютshipments[]черезShipmentPublicDtoбезmeta/provider/external_id/секретов.Повтор webhook ищется в
ms3_shipment_events(уникальная пара shipment + provider_event_id). Полеlast_event_idостаётся кэшем последнего id.Менеджер:
GET/PUT /api/mgr/orders/{id}/shipment(msorder_list/msorder_save) и вкладка «Отслеживание» в карточке заказа.v1: один shipment на заказ. Реализаций CDEK/Почты/DPD/Яндекса нет.
Тип изменений
Связанные Issues
Closes #591
Closes #606
Closes #607
Closes #608
Closes #609
Как это было протестировано?
Локальный CI-гейт (без полной установки MODX), PHP lint + vueManager jobs из
.github/workflows/ci.yml.composer ci:phpчерез Composer упёрся в process-timeout 300 с. Те же шаги (php -l, smoke, PHPUnit) прошли с exit 0.composer test:smoke/composer test,npm run lint:ci,composer stan)Конфигурация тестирования:
feat/issue-591-shipment-lifecycleотbeta.phpstan-depsСкриншоты (если применимо)
не приложено
Чеклист
composer stan/ CI jobPHPStan)npm run lint:ciдля Vue)Дополнительные заметки
ms3_shipment_events. Повтор старого id после нового не вызывает второйchange().MiniShop3::shipmentPublicForOrder(), без новых$modx->servicesв сниппете (phpstan ignore.count остаётся 5).@group mysqlдляPdoShipmentStoreпропускается безMS3_TEST_MYSQL_DSN.