-
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
[Woo POS][Cash & Receipts] Validate empty cash user input as zero #14954
[Woo POS][Cash & Receipts] Validate empty cash user input as zero #14954
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.
Works well, one small stylistic suggestion
@@ -36,8 +36,10 @@ final class CollectCashViewHelper { | |||
func validateAmountOnSubmit(orderTotal: String, | |||
textFieldAmountInput: String, | |||
onError: (String) -> Void) -> Bool { | |||
let userInput = textFieldAmountInput.isEmpty ? "0" : textFieldAmountInput |
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.
nit: I'd do this the other way around – it's easier to understand if the common case comes first (by checking .isNotEmpty
,) then the fallback.
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.
That makes sense, updated: 29b3990
Ref: pdfdoF-6fr#comment-7372-p2
Description
This PR updates the submit validation logic when processing cash, so if an empty textfield is submitted for validation, we assume that it's zero. This is done to handle 0-value carts with free products without the user having to specifically type "0" in the textfield.
Testing information
.acceptCashForPointOfSale
onScreen.Recording.2025-01-23.at.08.25.37.mov
Receipts and the rest of the flow works as before, the only difference is we remove the need to type down
0
in the textfield.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: