-
Notifications
You must be signed in to change notification settings - Fork 115
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
[Revamp Shipping Labels • Customs] Validation & Required #14921
[Revamp Shipping Labels • Customs] Validation & Required #14921
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mention this ITN requirement:
Required ITN: If any item in Customs has a value of more than $2500 and a valid HS Tariff, the ITN is required.
But based on the Slack conversation, my understanding is the ITN requirement is for the entire shipment cost:
ITN is also required for shipments exceeding $2500
Looking at the legacy flow, it looks the ITN validation is slightly different from both of these explanations (the requirement is if the total amount corresponding to a given HS tariff number in the shipment is above $2,500).
Could we clarify that requirement to make sure we're validating it correctly here?
|
||
// Items valued more than $2500 with a valid HSTariff Number require an International Transaction Number | ||
self.internationalTransactionNumberIsRequired = self.currencySymbol == "$" && | ||
(Double(valuePerUnit) ?? 0) > 2500 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to calculate this for all items in the shipment, right? So not just the valuePerUnit
for an individual item. For example:
If a shipment contains 2 apples and 1 orange, and each apple costs $1,000 and an orange costs $600, the individual values per unit are all under $2,500 but the total shipment exceeds $2,500 so it requires an ITN.
// Items valued more than $2500 with a valid HSTariff Number require an International Transaction Number | ||
self.internationalTransactionNumberIsRequired = self.currencySymbol == "$" && | ||
(Double(valuePerUnit) ?? 0) > 2500 && | ||
hsTariffNumber.isNotEmpty && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the HS Tariff Number requirement here. Shouldn't the ITN requirement be based only on the shipment cost?
Edit to add: Unless the requirement is for the total amount depending on this number, but that's slightly different than what's defined here.
Thanks for the comments @rachelmcr! After verification with the legacy flow and wp-admin, I see the logic is to require the ITN If the value of the items linked to an HS Tariff adds more than $2500. That takes into account when items have more than one quantity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 🚢
self?.internationalTransactionNumberIsRequired = value | ||
.sink { [weak self] value in | ||
// Remove nils | ||
let compactedValues = value.compactMap { $0 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tip: You can use compacted()
when you want to remove nils; it does the same as compactMap { $0 }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point thanks! Done in 46288e7
Part of: #13784
Description
With this PR we implement validation and requirements for the International Transaction Number in Customs in Woo Shipping Label:
"^(?:(?:AES X\\d{14})|(?:NOEEI 30\\.\\d{1,2}(?:\\([a-z]\\)(?:\\(\\d\\))?)?))$"
Required ITN: If any item in Customs has a value of more than $2500 and a valid HS Tariff, the ITN is required.Update: If the value of the items linked to an HS Tariff adds more than $2500Steps to reproduce
Validation
ITN Required
"International Transaction Number is required for shipping items valued over $2,500"
Testing information
See above
I tested:
Screenshots
Validation
Simulator.Screen.Recording.-.iPhone.16.-.2025-01-20.at.15.23.34.mp4
ITN required
In this video, we can see how the items linked to an HS Tariff add more than $2500 (the second item has a quantity of 2)
Simulator.Screen.Recording.-.iPhone.16.-.2025-01-21.at.17.41.27.mp4
"Save Customs Details" button
Simulator.Screen.Recording.-.iPhone.16.-.2025-01-20.at.15.26.34.mp4
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: