-
Notifications
You must be signed in to change notification settings - Fork 118
[Woo POS][Historical Orders] Order Details: Email Receipt action - Update Order List and Order Details (2/2) #16113
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][Historical Orders] Order Details: Email Receipt action - Update Order List and Order Details (2/2) #16113
Conversation
f54f077
to
fef9630
Compare
|
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.
Nice! LGTM
Some notes, not necessarily for this PR:
- Should refunded orders display the email receipt button? It does in the app, but not in POS.
- This seems an edge case: If an order is sent to X email, but then we assign a customer to the order and this happens to have a billing address, it will override it when rendering in order list, but not in order details. Note order 4305 at the top has different emails in each view.

For this I sent the receipt to X email address, then assigned a customer to the order which had a different email on their billing details.
/// - orderID: ID of the order to load. | ||
/// - Returns: The loaded Order. | ||
/// - Throws: Network or parsing errors. | ||
func loadPOSOrder(siteID: Int64, orderID: Int64) async throws -> Order { |
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.
Question: This could be an async wrapper for existing loadOrder, right? So no need to define the function specifically for POS orders
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 first reused the existing method, but it's a bit awkward since it uses non-async version of enqueue
that returns an optional Data?
and optional Error? which requires to set some
unknown` error state to make sure all the code paths are covered. Seemed cleaner to create this new async method.
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.
Gotcha, sounds good to me! 🕺
|
||
// Setup updated order | ||
let orderToUpdate = initialOrders[0] | ||
let updatedOrder = POSOrder( |
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 if we discussed this previously, or if wasn't worth it due to the small data structures for POS, but do you think we want to make POSOrders and others GeneratedFakeable/Copiable?So we would only need to do things like POSOrder.fake().copy(customerEmail: "[email protected]")
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 advice. Done that 👍
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 regarding test names to use _when_ABC_then_XYZ
struct POSFilledButtonStyle: ButtonStyle { | ||
private let size: POSButtonSize | ||
private let isLoading: Bool | ||
private let state: POSButtonState |
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.
Nice 💯
fef9630
to
f31edba
Compare
@iamgabrielma, thank you for the excellent review!
I think we should do it. I'll leave it for
They will make sense as a separate refunds-related update.
Good catch! That actually was an issue with how state is persisted in OrderListController where we didn't update |
WOOMOB-1140
Description
Continuation of #16110, to update order list and order details after the receipt is sent:
PointOfSaleOrderListController
update the order list and the selected orderPOSButtonStyle
to add a success state to the button that is shown inPOSSendReceiptView
when the receipt is successfully sentSteps to reproduce
Testing information
Tested on iPad Air 26.0 simulator
Screenshots
update.details.mov
RELEASE-NOTES.txt
if necessary.