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

Store Orders: Add order status checks to editable sections #19707

Merged
merged 3 commits into from
Nov 15, 2017

Conversation

ryelle
Copy link
Member

@ryelle ryelle commented Nov 13, 2017

This PR wraps up all the features for editing orders 🎉 See #15681

Currently all orders are fully editable, no matter the order status. Obviously you don't want to be able to add products to an already-shipped order, so this PR adds in the status checks for editing the line items and billing/shipping addresses. It also adds the form guard to prevent the user from accidentally leaving a page with pending edits.

So you can edit products on any order that hasn't been paid, and edit addressed on any order that hasn't been shipped yet. A full table of functionality + status can be found at this comment: #15681 (comment)

Note: Editing the shipping fee is in another PR #19641, so I haven't left any testing instructions here – but it will also only be possible before the order is paid for.

To test

  • Open a pending order, check that you can add, edit, & delete products, add & delete fees, edit the customer addresses
  • Open an on-hold order, check that all the same functionality is there
  • Open a processing order, check that you can only edit addresses
  • Open a completed order, check that you can only edit the order status
  • Open a cancelled, refunded, or failed order, check that you can only edit the order status

@ryelle ryelle added Store [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 13, 2017
@ryelle ryelle self-assigned this Nov 13, 2017
@matticbot
Copy link
Contributor

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

This is testing out well for me 🎉

@allendav
Copy link
Contributor

Still strikes me as odd that we can print labels for unpaid orders, but that's a separate issue #19079

@allendav
Copy link
Contributor

You can add things like fees to any order you want by temporarily toggling the order state and then putting it back before saving. Maybe a subsequent issue/PR could examine preventing this

sneaky-fee-flow

Copy link
Contributor

@allendav allendav left a comment

Choose a reason for hiding this comment

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

Tests well. Noted one weird trick that auditors hate. :P :shipit:

@ryelle ryelle added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 14, 2017
@ryelle ryelle merged commit 42cf868 into master Nov 15, 2017
@ryelle ryelle deleted the update/store-order-restrict-edit-status branch November 15, 2017 15:14
@ryelle ryelle mentioned this pull request Nov 15, 2017
12 tasks
rclations pushed a commit to rclations/wp-calypso that referenced this pull request Nov 15, 2017
…c#19707)

* Store Orders: Prevent editing of products/fees on orders that have already been paid for

* Add ProtectFormGuard to prevent users leaving while edits are pending

* Only allow editing of addresses before the order is “finished” (shipped, or there was a problem/refund)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants