Repository navigation
feat(manager): order cost recalculation API and admin UI (#212) - #288
Merged
Merged
Conversation
POST /api/mgr/orders/{id}/recalculate-cost with ManagerOrderCostRecalculator;
Vue summary controls, lexicons ru/en; refactors after review.
chore: list AGENTS.md in .gitignore for local AI context.
…212) Use shared PriceAdjustment for delivery/payment surcharges (negative discounts), OrderService::clampComputedTotal for total; remove redundant AGENTS.md from .gitignore; drop CHANGELOG entry from this branch.
9 of 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.
Replacement for #255 (rebased on top of
beta, CHANGELOG conflict resolved). Original PR from @Ibochkarev.Описание
Реализует #212: явный endpoint
POST /api/mgr/orders/{id}/recalculate-cost+ кнопка «Пересчитать стоимость» в админке заказа, чтобы менеджер мог пересчитатьcart_cost/weight/delivery_cost/costбез побочных эффектов на других полях заказа.Связанные Issues
Closes #212
Состав
Backend
ManagerOrderCostRecalculator(новый сервис) с тремя режимами:auto— пересчитывает только дляDefaultDelivery/DefaultPayment(без вызова внешних провайдеров). Для кастомных классов возвращает warningdelivery_manual_required/payment_manual_requiredи сохраняет прежнююdelivery_cost/ комиссию 0.manual— оператор передаётmanual_delivery_cost, оплата считается автоматом.force_provider— явный вызовloadController()/loadHandler()→getCost()вtry/catch. Сбой провайдера → warning*_provider_error, без молчаливого затирания данных.OrdersController::recalculateCost()+ routePOST /api/mgr/orders/{id}/recalculate-cost. Ответ — те же данные что вGET /api/mgr/orders/{id}, плюсbreakdown(cart/delivery/payment/cost) иwarnings[].v2 — учёт ревью
PriceAdjustment(feat(settings): allow negative delivery and payment costs #246) вместо собственной copy-paste логики расчёта:isPercent/getPercent/isAllowedPercent/calculate— отрицательные значения и проценты корректно пересчитываются.OrderService::clampComputedTotal()(feat(order): защита total от минуса и бейджи скидки/наценки #266) перед сохранением —costне уходит в минус.max(0, $withFee - $paymentBase)убран в FORCE_PROVIDER ветке для payment — отрицательная комиссия (скидка) теперь проходит.AGENTS.mdиз.gitignore.Vue (
OrderInfoTab.vue,OrderView.vue)Тестирование
ManagerOrderCostRecalculator.php+OrdersController.php:[OK] No errors.PriceAdjustment— работают.