Files
KEVYN SUAREZ a0bb77a6d8 fix: commerce and enrollment error handling and ux (#36612)
Returns HTTP 400 for disallowed enrollments instead of HTTP 500.
Prevents infinite loading spinners on the enrollment page.
Displays clear error messages to users before redirection.
Ensures consistent and meaningful responses from enrollment API endpoints.

* fix: commerce and enrollment apis return 403 when enrollment not allowed

* fix: now both apis send the right message and http code when enrollment fails

* fix: InvalidEnrollmentAtribute as final exception to catch and HTTP 400 returned

* style: the message is displayed as a popup instead of creating a div at the end

* fix:  import not used removed for pylint checks

* style: popup now use utility classes

* refactor: use const instead of let for existing const

* refactor: textContent const structure changed due check failed

* refactor: SetTimeout settled as arrow function

* feat: button incorporated to bring users enough time to read the message

* refactor: ErrorStatuses defined at the top of the file to use it in conditionals

* style: typo fixed

Co-authored-by: Diana Olarte <dcoa@live.com>

* refactor: double validation of redirectUrl eliminated and better styling of the message

Co-authored-by: Diana Olarte <dcoa@live.com>

* refactor: redirectUrl param eliminated in showmessage function, close button redirects to dashboard always

* docs: remove unused redirectUrl param from JSDoc and explain hardcoded URL

* style: endline added

* feat: enrollmentNotAllowed exception added in views and the js

* docs: comment added to especify exception

* style: endline added

* refactor: error statuses velidation changed to one single validation instead of two

* refactor: function added to handle enrollment errors

* feat: enrollmentNotAllowed exception added for API coherence and consistency

* style: empty line added

* style: pylint check line too long disabled

---------

Co-authored-by: Diana Olarte <dcoa@live.com>
2025-07-03 12:36:14 +02:00
..