-
Notifications
You must be signed in to change notification settings - Fork 130
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
[Order creation] Update coupons display order details #12855
[Order creation] Update coupons display order details #12855
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
@@ -738,6 +760,22 @@ class OrderCreateEditFormFragment : | |||
} else { | |||
additionalInfoCollectionSection.addShippingButtonGroup.show() | |||
} | |||
|
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.
This code would ideally live in the VM so it could be unit tested, however, refactoring it felt like out of scope and bringing inconsistency to the surrounding code feels worse than not having this tested. I'm open to suggestions though.
...merce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditViewModel.kt
Show resolved
Hide resolved
...merce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditViewModel.kt
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #12855 +/- ##
============================================
- Coverage 40.24% 40.20% -0.04%
- Complexity 5784 5786 +2
============================================
Files 1247 1249 +2
Lines 71160 71247 +87
Branches 9933 9954 +21
============================================
+ Hits 28638 28647 +9
- Misses 39889 39966 +77
- Partials 2633 2634 +1 ☔ View full report in Codecov by Sentry. |
…ior-in-order-creation
...merce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditViewModel.kt
Outdated
Show resolved
Hide resolved
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.
Great work, @malinajirka! I added small improvement ideas. The most important seems to be the one related to long coupon codes' appearance. Feel free to ignore others.
One more thing that caught my attention is the singular form of the "Coupon" label in the bottom sheet despite multiple coupons applied (isn't it slightly confusing?). Maybe worth considering reporting an issue:
...e/src/main/kotlin/com/woocommerce/android/ui/orders/creation/coupon/CouponLineFormSection.kt
Show resolved
Hide resolved
...e/src/main/kotlin/com/woocommerce/android/ui/orders/creation/coupon/CouponLineFormSection.kt
Outdated
Show resolved
Hide resolved
...e/src/main/kotlin/com/woocommerce/android/ui/orders/creation/coupon/CouponLineFormSection.kt
Outdated
Show resolved
Hide resolved
...e/src/main/kotlin/com/woocommerce/android/ui/orders/creation/coupon/CouponLineFormSection.kt
Outdated
Show resolved
Hide resolved
onAdd: () -> Unit, | ||
onEdit: (id: Long) -> Unit, | ||
onAddClicked: () -> Unit, | ||
onEditClicked: (id: Long) -> Unit, |
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.
❤️
...merce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditViewModel.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Samuel Urbanowicz <[email protected]>
Co-authored-by: Samuel Urbanowicz <[email protected]>
Thanks so much for the thorough review @samiuelson ! I have implemented all the changes except of the performance optimization.
I noticed this as well but then forgot about it :X. I updated it in 18e079d. We use plural for products no matter whether there is one or multiple, so the change brings it to consistency. |
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.
LGTM!
Closes: #12619 #12848
Ref: pe5pgL-5G4-p2#comment-4599
This PR updates the how coupons are displayed during Order creation to match the iOS behavior.
Changes:
Notes:
I planned to add unit tests for the added code. However, I haven't figured out how to test the code in the current state without significant refactoring. It felt like the unit tests would be tightly coupled with the inner workings of the VM, which felt off. In any case, if you have some ideas how to write reasonable tests or if you believe it's worth spending more time on, I will be happy to look into it more.
P.S. I also noticed shipping lines are editable at all times which is a bug I reported here.
Testing
I tested the following flows on my phone and tablet.
Case: Add coupon to order success:
+ Add Coupon
row is disabled.+ Add Coupon
row is now enabled.+ Add Coupon
-> Apply a eligible coupon to that product -> Observe how it appears in the Order, with a "trash bin" button.Case: Delete coupon from order:
Case: Add coupon to order error
Case: Editing an existing order
Edit
Case: Editing an existing PAID order
Edit
I also tested adding and removing shipping lines in combination with coupons with gift card extension installed/uninstalled.
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: