fix(web): add missing customer API routes#244
Open
Ibochkarev wants to merge 1 commit intomodx-pro:betafrom
Open
fix(web): add missing customer API routes#244Ibochkarev wants to merge 1 commit intomodx-pro:betafrom
Ibochkarev wants to merge 1 commit intomodx-pro:betafrom
Conversation
Restore the public CustomerAPI contract by wiring customer/add to a whitelisted partial profile update and customer/changeAddress to the existing saved-address order flow.
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.
Описание
Восстановлен публичный контракт
CustomerAPI: методыcustomer.add()иcustomer.changeAddress()теперь имеют соответствующие Web API маршруты и больше не уходят в 404.POST /api/v1/customer/addделегирует вCustomerProfileController::updateField()и обновляет только разрешённые поля профиля (first_name,last_name,email,phone). Для email переиспользуется общая проверка уникальности и сбросemail_verified_at, чтобы частичное и полное обновление профиля работали одинаково.POST /api/v1/customer/changeAddressделегирует вOrderController::changeCustomerAddress()и использует уже существующий механизм выбора сохранённого адреса в черновике заказа поaddress_hash. Логика вынесена из routes в контроллер, чтобы маршруты оставались тонкими.Тип изменений
Связанные Issues
Fixes #241
Как это было протестировано?
Проверены синтаксис PHP и whitespace diff:
git diff --checkphp -l core/components/minishop3/src/Controllers/Api/Web/CustomerProfileController.phpphp -l core/components/minishop3/src/Controllers/Api/Web/OrderController.phpphp -l core/components/minishop3/config/routes/web.phpphp -l core/components/minishop3/lexicon/ru/customer.inc.phpphp -l core/components/minishop3/lexicon/en/customer.inc.phpРучное тестирование
Автоматические тесты (PHPStan, ESLint)
Тестирование на разных версиях PHP/MODX
Конфигурация тестирования:
fix/customer-api-missing-routes-241Скриншоты (если применимо)
Чеклист
Дополнительные заметки
JSDoc
CustomerAPI.add()уточнён под фактический whitelist быстрых полей профиля. IDE Intelephense по-прежнему показывает существующие ложноположительные ошибки по MODX/xPDO magic methods (get,set,save,toArray) и типуMODX\\Revolution\\modX; PHP syntax check проходит.