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

Add custom amounts business logic #10035

Merged
merged 61 commits into from
Nov 3, 2023

Conversation

AnirudhBhat
Copy link
Contributor

@AnirudhBhat AnirudhBhat commented Oct 27, 2023

Closes: #10016

NOTE: Please follow the below PR orders for reviewing

This one!
#10054
#10057
#10062

Description

This PR introduces the core business logic and UI components required for the "Custom Amounts" feature.

Key Changes:

Business Logic for Custom Amounts: Implemented the essential logic to handle the addition of custom amounts.

Custom Amounts Adapter: Introduced a new adapter to handle the display of added custom amounts within a RecyclerView.

Custom Amount Item UI: Designed a user-friendly and intuitive UI for each custom amount item.

Testing instructions

  1. Navigate to the orders tab
  2. Click on "+" button to navigate the the order creation screen
  3. Click on the "Add custom amount" button
  4. Add a custom amount
  5. Ensure the custom amount gets added
  6. Ensure you see the "custom amount" subsection instead of fees
  7. Ensure the order total is correct
  8. Add any product and ensure the custom amount, and order total are correct.

Images/gif

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

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 27, 2023

📲 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
FlavorJalapeno
Build TypeDebug
Commit982a0bb
Direct Downloadwoocommerce-prototype-build-pr10035-982a0bb.apk

@AnirudhBhat AnirudhBhat added feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: task An internally driven task. labels Oct 30, 2023
@AnirudhBhat AnirudhBhat added this to the 16.1 milestone Oct 30, 2023
Base automatically changed from issue/9938-custom-amounts-flow-ui to trunk October 31, 2023 05:08
# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditFormFragment.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/creation/OrderCreateEditProductsAdapter.kt
#	WooCommerce/src/main/res/layout/order_creation_product_item.xml
@peril-woocommerce
Copy link

peril-woocommerce bot commented Oct 31, 2023

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone
⚠️ PR has more than 300 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@AnirudhBhat AnirudhBhat marked this pull request as ready for review October 31, 2023 06:45
@AnirudhBhat
Copy link
Contributor Author

@samiuelson Please note that I've added the unit-tests-exemption label because the CI was asking for it. Specifically for customAmountsAdapter class. I don't think we should unit test the adapter class since it has a direct dependency on the Android framework classes.

@samiuelson samiuelson self-assigned this Nov 1, 2023
Copy link
Contributor

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM

@AnirudhBhat AnirudhBhat requested a review from a team as a code owner November 2, 2023 13:47
@wpmobilebot
Copy link
Collaborator

4 Warnings
⚠️ View files have been modified, but no screenshot is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class OrderCreateEditCustomAmountAdapter is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ This PR is assigned to the milestone 16.1. 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

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (8966787) 42.29% compared to head (982a0bb) 42.32%.
Report is 70 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #10035      +/-   ##
============================================
+ Coverage     42.29%   42.32%   +0.02%     
- Complexity     4631     4636       +5     
============================================
  Files           953      954       +1     
  Lines         52065    52120      +55     
  Branches       6741     6749       +8     
============================================
+ Hits          22022    22060      +38     
- Misses        28167    28183      +16     
- Partials       1876     1877       +1     
Files Coverage Δ
...orders/creation/MapFeeLineToCustomAmountUiModel.kt 80.00% <80.00%> (ø)
...oid/ui/orders/creation/OrderCreateEditViewModel.kt 81.88% <68.00%> (-0.95%) ⬇️

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

@AnirudhBhat AnirudhBhat merged commit 7357fea into trunk Nov 3, 2023
@AnirudhBhat AnirudhBhat deleted the issue/10016-add-custom-amounts-business-logic branch November 3, 2023 04:04
@@ -47,6 +48,7 @@ class OrdersUITest : TestBase() {
TabNavComponent().gotoOrdersScreen()
}

@Ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that the current test failures are a direct result of the modifications introduced in this PR, which affect the order creation screen. Sergiy Fedosov has taken on the task of implementing a fix. In the interim, we have agreed to bypass the affected test, as well as any other UI tests impacted by this PR, until a resolution is in place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: task An internally driven task. unit-tests-exemption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Custom amounts with Custom Name
4 participants