Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping Labels: Validate that address name field is not empty #4601

Merged
merged 4 commits into from Jul 14, 2021

Conversation

rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Jul 13, 2021

Fixes: #4480

Description

When you start to create a shipping label, we auto-fill the origin address name field with the first and last name from the user's account settings. If the account settings are not in storage, or don't include a first/last name, the name is left blank. This causes problems later on, because the name is required (e.g. to load carriers and rates for the package).

This PR adds local validation to check that the name field is not empty. If it is empty, it opens the Edit Address screen to prompt the user to enter a name. (We already have validation on the Edit Address screen to ensure the name field is filled out there.)

Note that we have related issues for remote name validation (https://github.com/Automattic/woocommerce-services/issues/2457) and making sure account settings are synced in storage after login (#4600), which aren't part of this PR.

Changes

  • Adds a check for address.name.isEmpty before doing the remote address validation in ShippingLabelFormViewModel.
  • Adds a unit test.
Before After
validate-name-before validate-name-after

Testing

  1. Make sure your First name and Last name are empty in your WordPress.com account settings.
  2. Make sure you have configured the WooCommerce WCShip plugin, and you have one or more payment methods set up in WP Admin under WooCommerce > Settings > Shipping > WooCommerce Shipping.
  3. Launch the app.
  4. If you are already logged in, log out and log in again (to make sure you don't have old account settings stored in the app).
  5. Open an order detail that is eligible for the shipping label.
  6. Tap the button "Create Shipping Label".
  7. In the Ship from section, tap the "Continue" button.
  8. Confirm that the Edit Address screen opens (with the "Name missing" validation error prompting you to enter a name).

Submitter Checklist

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added the feature: shipping labels Related to creating, ordering, or printing shipping labels. label Jul 13, 2021
@rachelmcr rachelmcr added this to the 7.2 milestone Jul 13, 2021
@rachelmcr rachelmcr requested a review from a team July 13, 2021 15:20
@rachelmcr rachelmcr added this to In progress in Shipping Labels Milestone 3 via automation Jul 13, 2021
@peril-woocommerce
Copy link

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-woocommerce
Copy link

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@pmusolino pmusolino requested review from pmusolino and removed request for a team July 14, 2021 10:59
@pmusolino pmusolino self-assigned this Jul 14, 2021
Shipping Labels Milestone 3 automation moved this from In progress to Reviewer approved Jul 14, 2021
Copy link
Member

@pmusolino pmusolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this @rachelmcr :shipit:

@rachelmcr rachelmcr merged commit 7570001 into develop Jul 14, 2021
Shipping Labels Milestone 3 automation moved this from Reviewer approved to Done Jul 14, 2021
@rachelmcr rachelmcr deleted the issue/4480-validate-address-name-field branch July 14, 2021 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels.
Projects
No open projects
2 participants