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 Revamp] Add Customs requirement check #13413

Open
wants to merge 23 commits into
base: trunk
Choose a base branch
from

Conversation

ThomazFB
Copy link
Contributor

@ThomazFB ThomazFB commented Jan 28, 2025

Why

Fix issue #13365 by introducing both the Customs section UI and the Customs requirement logic check.

How

Customs Section UI

The Customs section UI and state data is introduced through the same Mutable state flow logic using a new CustomsState. When no Customs data is required, the state is set as NotRequired, when it's required but not available, it's set as Unavailable. The DataAvailable state option will be added later once the form is finished.

Customs requirement check

A use case called ShouldRequireCustomsForm is introduced, replicating the same logic used in the old Shipping Labels implementation declared at the ShippingLabelsStateMachine.

Screen Capture

How to Test

Scenario 1 - Customs required

  1. Start the Shipping Labels creation flow
  2. Fill the origin and destination address data, or make it pre-filled from the code if filling it is not available yet
  3. Ensure the selected country between origin and destination addresses are different from each other
  4. Verify the Customs section is displayed

Scenario 2 - Customs NOT required

  1. Start the Shipping Labels creation flow
  2. Fill the origin and destination address data, or make it pre-filled from the code if filling it is not available yet
  3. Ensure the selected country between origin and destination addresses are exactly the same
  4. Verify the Customs section is hidden

Update release notes:

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

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@ThomazFB ThomazFB added type: task An internally driven task. feature: shipping labels Related to creating, ordering, or printing shipping labels. labels Jan 28, 2025
@ThomazFB ThomazFB added this to the 21.6 milestone Jan 28, 2025
@ThomazFB ThomazFB linked an issue Jan 28, 2025 that may be closed by this pull request
@dangermattic
Copy link
Collaborator

dangermattic commented Jan 28, 2025

1 Warning
⚠️ This PR is assigned to the milestone 21.6. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 28, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit092eeb8
Direct Downloadwoocommerce-wear-prototype-build-pr13413-092eeb8.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 28, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit092eeb8
Direct Downloadwoocommerce-prototype-build-pr13413-092eeb8.apk

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 83.87097% with 5 lines in your changes missing coverage. Please review.

Project coverage is 41.12%. Comparing base (73135c1) to head (092eeb8).
Report is 68 commits behind head on trunk.

Files with missing lines Patch % Lines
...hippinglabels/WooShippingLabelCreationViewModel.kt 84.21% 1 Missing and 2 partials ⚠️
...shippinglabels/customs/ShouldRequireCustomsForm.kt 83.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #13413      +/-   ##
============================================
+ Coverage     41.10%   41.12%   +0.01%     
- Complexity     6486     6497      +11     
============================================
  Files          1325     1326       +1     
  Lines         77572    77601      +29     
  Branches      10694    10699       +5     
============================================
+ Hits          31889    31913      +24     
- Misses        42850    42851       +1     
- Partials       2833     2837       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomazFB ThomazFB requested a review from atorresveiga January 29, 2025 20:13
@ThomazFB ThomazFB marked this pull request as ready for review January 29, 2025 20:13
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. type: task An internally driven task. unit-tests-exemption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Shipping Labels: Customs] Add Customs section in main form
4 participants