-
Notifications
You must be signed in to change notification settings - Fork 131
[Shipping labels] Add endpoint to fetch shipments #13995
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
base: trunk
Are you sure you want to change the base?
Conversation
This commit introduces a new data store specifically for WooShipping config, allowing to observe and save the configuration for a specific order.
) { | ||
suspend operator fun invoke(order: Order): List<ShippableItemModel> { | ||
val refunds = orderDetailRepository.getOrderRefunds(order.id) | ||
val noRefundedProducts = refunds.getNonRefundedProducts(order.items) | ||
|
||
val shipments = configDataStore.observeConfig(order.id).first()?.shipments // TODO Use this in the UI |
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 can test the output of this PR by debugging this shipment
.
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 renamed this file because it was storing StoreOptions, not Configuration.
📲 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.
|
dd100e8
to
753c079
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #13995 +/- ##
============================================
- Coverage 38.27% 38.26% -0.01%
- Complexity 9488 9490 +2
============================================
Files 2118 2119 +1
Lines 116345 116394 +49
Branches 14933 14937 +4
============================================
+ Hits 44532 44542 +10
- Misses 67743 67781 +38
- Partials 4070 4071 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR adds the config endpoint to fetch shipments. It does not include any UI changes.
New endpoint: GET
/wp-json/wcshipping/v1/config/label-purchase/$orderId
I decided to fetch the config endpoint (which includes shipments data) on the order detail screen and cache the response. Later, we’ll use the shipments data on this screen. Then, on the create shipment screen, I’ll use the cached shipments and won’t fetch them again. This is consistent with how the shipment screen handles order data.
Steps to reproduce
You can debug and check the
shipments
parameter added in this PR to verify that the shipments are fetched successfully.RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.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: