Skip to content
Snippets Groups Projects

fix: Fix "restricted shipping" validation bug

Merged stephen requested to merge fix-restricted-shipping-bug into main
All threads resolved!

One of the lesser-seen features of the donation form is its capability to detect when a country has been selected from the drop-down list which is ineligible for shipping (due in this case to active geopolitical conflict). A custom message politely informs the user that their selected country cannot cannot be shipped to, and the front-end validation infrastructure prevents the donation from being processed. However, when those two countries are not selected, nothing is shown at all to indicate that there is a shipping blocklist.

Perhaps due to its subtle nature, this feature slipped under a few radars when the testing and go-live plan was being carried out, and while other forms of validation were tested heavily, the "quiet invalidation" of this feature, due to its custom implementation - it doesn't invalidate the form field, but it does make the form itself invalid to submit - was much less tested, even though its bespoke nature means that other forms of form testing would not cover it. It also escaped notice when the backend validation was implemented; while we test the country field for existence in the Django donate form validation, we do not explicitly test against a list of blocklisted countries.

As a result, it appears that the "restricted shipping" validation feature was underimplemented at time of launch; it has not been properly validated in all cases as a disqualifying condition for form submission, and it has not been properly testing the form field value in some other cases. This MR addresses all of this:

  • The country field is now properly validated on both the front and the back end. It retains the design direction of having the country selection action itself not trigger a standard form validation state, instead displaying the custom purplish message.
  • When the country field is set to a country with restricted shipping and the user submits the form anyway, displayPaymentError() is used to display a separate validation error immediately above the payment area, informing the user of the specific problem.
  • Unit testing has been written against the backend restricted-shipping validation.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • stephen resolved all threads

    resolved all threads

  • stephen added 1 commit

    added 1 commit

    • 02140cab - Adjusting long validation error to use triple-quotes and linter silencing...

    Compare with previous version

  • anarcat resolved all threads

    resolved all threads

  • anarcat
  • stephen added 1 commit

    added 1 commit

    • c7566c63 - Tweaking longline fix to pass all testing.

    Compare with previous version

  • anarcat resolved all threads

    resolved all threads

  • anarcat enabled an automatic merge when all merge checks for c7566c63 pass

    enabled an automatic merge when all merge checks for c7566c63 pass

  • anarcat resolved all threads

    resolved all threads

  • anarcat canceled the automatic merge

    canceled the automatic merge

  • anarcat mentioned in commit f7667219

    mentioned in commit f7667219

  • merged

  • stephen mentioned in issue #138 (closed)

    mentioned in issue #138 (closed)

  • Please register or sign in to reply
    Loading