{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/4540","repository_url":"https://api.github.com/repos/Automattic/wp-calypso","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/4540/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/4540/comments","events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/4540/events","html_url":"https://github.com/Automattic/wp-calypso/pull/4540","id":146140599,"number":4540,"title":"Purchases: Remove notices associated with path fragments when possible","user":{"login":"drewblaisdell","id":1130674,"avatar_url":"https://avatars.githubusercontent.com/u/1130674?v=3","gravatar_id":"","url":"https://api.github.com/users/drewblaisdell","html_url":"https://github.com/drewblaisdell","followers_url":"https://api.github.com/users/drewblaisdell/followers","following_url":"https://api.github.com/users/drewblaisdell/following{/other_user}","gists_url":"https://api.github.com/users/drewblaisdell/gists{/gist_id}","starred_url":"https://api.github.com/users/drewblaisdell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewblaisdell/subscriptions","organizations_url":"https://api.github.com/users/drewblaisdell/orgs","repos_url":"https://api.github.com/users/drewblaisdell/repos","events_url":"https://api.github.com/users/drewblaisdell/events{/privacy}","received_events_url":"https://api.github.com/users/drewblaisdell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/Purchases","name":"Purchases","color":"006b75"},{"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"drewblaisdell","id":1130674,"avatar_url":"https://avatars.githubusercontent.com/u/1130674?v=3","gravatar_id":"","url":"https://api.github.com/users/drewblaisdell","html_url":"https://github.com/drewblaisdell","followers_url":"https://api.github.com/users/drewblaisdell/followers","following_url":"https://api.github.com/users/drewblaisdell/following{/other_user}","gists_url":"https://api.github.com/users/drewblaisdell/gists{/gist_id}","starred_url":"https://api.github.com/users/drewblaisdell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewblaisdell/subscriptions","organizations_url":"https://api.github.com/users/drewblaisdell/orgs","repos_url":"https://api.github.com/users/drewblaisdell/repos","events_url":"https://api.github.com/users/drewblaisdell/events{/privacy}","received_events_url":"https://api.github.com/users/drewblaisdell/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-04-05T23:46:30Z","updated_at":"2016-04-06T18:33:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/4540","html_url":"https://github.com/Automattic/wp-calypso/pull/4540","diff_url":"https://github.com/Automattic/wp-calypso/pull/4540.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/4540.patch"},"body":"Currently, in `/purchases`, we have four routes that are used to display a notice:\r\n\r\n- `/purchases/cancel-success`\r\n- `/purchases/cancel-problem`\r\n- `/purchases/:site/:purchaseId/thank-you`\r\n- `/purchases/:site/:purchaseId/canceled-private-registration`\r\n\r\nThe first two are necessary, because the user can visit those URLs after canceling a domain through wpcom. The latter two were created because of the pattern established by the former, and can be replaced with global notices.\r\n\r\nThis PR:\r\n- updates the first two routes to use the \"flash pattern\", where we trigger the notice in the controller and strip the `/cancel-[type]` fragment from the URL with a redirect.\r\n- removes the last two routes in favor of global notices.\r\n\r\n**Testing**\r\n`/purchases/cancel-success`\r\n- Visit `/purchases/cancel-success`.\r\n- Assert that you are redirected to `/purchases` and that a success notice is displayed.\r\n\r\n`/purchases/cancel-problem`\r\n- Visit `/purchases/cancel-problem`.\r\n- Assert that you are redirected to `/purchases` and that an error notice is displayed.\r\n\r\n`/purchases/:site/:purchaseId/thank-you` (removed)\r\n- Visit `/purchases` and click on a purchase that is expiring.\r\n- Click the 'Renew Now' button.\r\n- Assert that you are redirected to checkout.\r\n- Purchase the renewal.\r\n- Assert that you are redirected back to the `ManagePurchase` page for the purchase with a success notice displayed.\r\n\r\n`/purchases/:site/:purchaseId/canceled-private-registration` (removed)\r\n- Visit `/purchases` and click on a domain purchase that has private registration.\r\n- Click 'Cancel Private Registration'.\r\n- Cancel the private registration.\r\n- Assert that you are redirected back to the purchase and that a success notice is displayed.\r\n\r\n- [x] Code review\r\n- [ ] Product review"},"comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments/206506335","html_url":"https://github.com/Automattic/wp-calypso/pull/4540#issuecomment-206506335","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/4540","id":206506335,"user":{"login":"Tug","id":230230,"avatar_url":"https://avatars.githubusercontent.com/u/230230?v=3","gravatar_id":"","url":"https://api.github.com/users/Tug","html_url":"https://github.com/Tug","followers_url":"https://api.github.com/users/Tug/followers","following_url":"https://api.github.com/users/Tug/following{/other_user}","gists_url":"https://api.github.com/users/Tug/gists{/gist_id}","starred_url":"https://api.github.com/users/Tug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tug/subscriptions","organizations_url":"https://api.github.com/users/Tug/orgs","repos_url":"https://api.github.com/users/Tug/repos","events_url":"https://api.github.com/users/Tug/events{/privacy}","received_events_url":"https://api.github.com/users/Tug/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T18:33:38Z","updated_at":"2016-04-06T18:33:38Z","body":"Product :+1: "}}