fix(order): align finalize cost with ManagerOrderCostRecalculator#448
Open
Ibochkarev wants to merge 4 commits into
Open
fix(order): align finalize cost with ManagerOrderCostRecalculator#448Ibochkarev wants to merge 4 commits into
Ibochkarev wants to merge 4 commits into
Conversation
Extract calculateBreakdown() from manager recalculate and use it when finalizing draft orders so free_delivery_amount, percent delivery, and payment commission match the recalculate-cost path. Closes #373
Move default delivery/payment formulas to a pure helper used by ManagerOrderCostRecalculator and smoke tests. Clarify recalculator docblock for manager recalculate and draft finalize paths.
Return error from calculateCosts when ManagerOrderCostRecalculator reports degraded AUTO breakdown so draft orders are not finalized with potentially wrong totals. Surface warnings in Vue with recalc hints.
Add xPDO/modX stubs and integration cases for ManagerOrderCostRecalculator including free delivery, cart+delivery payment fee, and custom handler warnings.
16 tasks
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.
Описание
При finalize черновика стоимость считалась упрощённо (
delivery.price+ вес ×weight_price, комиссия оплаты всегда 0). ТеперьOrderFinalizeService::calculateCosts()делегирует вManagerOrderCostRecalculator::calculateBreakdown()— те же правила, что у «Пересчитать стоимость» (#212):free_delivery_amount,%доставки черезPriceAdjustment, комиссия оплаты (база cart + delivery).Коммиты (4)
calculateBreakdown()изrecalculate(), wiring в finalizedelivery_manual_required/payment_manual_requiredfinalize возвращает error, не переводит заказ в «Новый»; Vue показывает подсказки пересчётаТип изменений
Связанные Issues
Closes #373
Follow-up (вне scope PR): #449 —
OrdersController::recalculateOrderTotals()без payment fee в preview черновикаКак это было протестировано?
ManagerOrderCostRecalculatorRulesTest:OrderPersistedCostRules— free delivery, percent delivery, payment на базе cart+deliveryManagerOrderCostRecalculator::calculateBreakdown()через stubs — integrated total (1102.1), warning для custom deliveryРучное тестирование — рекомендуется: draft с
free_delivery_amount/ оплатой с%; finalize vs recalculate-cost; custom delivery → error + hints в UIАвтоматические тесты (
composer ci:php, ESLint наOrderView.vue)Тестирование на разных версиях PHP/MODX
Конфигурация тестирования:
fix/issue-373-finalize-order-costСкриншоты (если применимо)
Чеклист
OrderPersistedCostRules)ms3_order_finalize_cost_recalc_requiredOrderView.vue)Дополнительные заметки
ms3_order_finalize_cost_recalc_requiredсerrors.warnings; Vue заполняетcostRecalcWarningsи показывает hints (order_cost_recalc_*_hint).$order->save()после записи cost — с проверкой результата.cart + delivery(как вManagerOrderCostRecalculator); web checkout (OrderCostCalculator) может отличаться — отдельная тема.recalculateOrderTotals) — не менялся; см. [Bug] OrdersController::recalculateOrderTotals без payment fee в preview черновика #449.