{"action":"created","issue":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/5232","repository_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/5232/labels{/name}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/5232/comments","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/5232/events","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/5232","id":151417078,"number":5232,"title":"Adds better handling of pending payments","user":{"login":"frosty","id":4780,"avatar_url":"https://avatars.githubusercontent.com/u/4780?v=3","gravatar_id":"","url":"https://api.github.com/users/frosty","html_url":"https://github.com/frosty","followers_url":"https://api.github.com/users/frosty/followers","following_url":"https://api.github.com/users/frosty/following{/other_user}","gists_url":"https://api.github.com/users/frosty/gists{/gist_id}","starred_url":"https://api.github.com/users/frosty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frosty/subscriptions","organizations_url":"https://api.github.com/users/frosty/orgs","repos_url":"https://api.github.com/users/frosty/repos","events_url":"https://api.github.com/users/frosty/events{/privacy}","received_events_url":"https://api.github.com/users/frosty/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels/Plans%20&%20Checkout","name":"Plans & Checkout","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"koke","id":8739,"avatar_url":"https://avatars.githubusercontent.com/u/8739?v=3","gravatar_id":"","url":"https://api.github.com/users/koke","html_url":"https://github.com/koke","followers_url":"https://api.github.com/users/koke/followers","following_url":"https://api.github.com/users/koke/following{/other_user}","gists_url":"https://api.github.com/users/koke/gists{/gist_id}","starred_url":"https://api.github.com/users/koke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koke/subscriptions","organizations_url":"https://api.github.com/users/koke/orgs","repos_url":"https://api.github.com/users/koke/repos","events_url":"https://api.github.com/users/koke/events{/privacy}","received_events_url":"https://api.github.com/users/koke/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/61","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/milestones/Plans%20v1","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones/61/labels","id":1719988,"number":61,"title":"Plans v1","description":"First public version of plans\r\n\r\nThis first version should allow a user to purchase one plan for one blog which is currently in the Free plan. ","creator":{"login":"koke","id":8739,"avatar_url":"https://avatars.githubusercontent.com/u/8739?v=3","gravatar_id":"","url":"https://api.github.com/users/koke","html_url":"https://github.com/koke","followers_url":"https://api.github.com/users/koke/followers","following_url":"https://api.github.com/users/koke/following{/other_user}","gists_url":"https://api.github.com/users/koke/gists{/gist_id}","starred_url":"https://api.github.com/users/koke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koke/subscriptions","organizations_url":"https://api.github.com/users/koke/orgs","repos_url":"https://api.github.com/users/koke/repos","events_url":"https://api.github.com/users/koke/events{/privacy}","received_events_url":"https://api.github.com/users/koke/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":0,"state":"open","created_at":"2016-04-20T08:01:51Z","updated_at":"2016-05-04T09:58:16Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-04-27T15:34:52Z","updated_at":"2016-05-05T14:09:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/5232","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/5232","diff_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/5232.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/5232.patch"},"body":"Implements a first stab at some of the items from #5033. \r\n\r\n* The current pending payment is stored in `NSUserDefaults`. This allows us to work with purchases across restarts of the app.\r\n* The app now handles the transaction states that we're interested in (`Failed`, `Deferred`, `Purchased`), and finishes transactions when required.\r\n* `StoreCoordinator` posts out notifications when transactions finish or fail, so we can display the correct UI when necessary.\r\n\r\nThere are a number of things that aren't 'final' in this PR, but I thought I'd look to get this merged and then we can address those things later. For example failure alerts are currently displayed by `PlanDetailViewController`, but we'll probably want to do this from elsewhere in case the app has been relaunched before an error occurs, and the post purchase flow is currently only presented by the plan detail view controller. We've discussed displaying this through a notification elsewhere in the app, but I think that's a bigger piece that doesn't belong here.\r\n\r\nNeeds review: @koke "},"comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments/217164434","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/5232#issuecomment-217164434","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/5232","id":217164434,"user":{"login":"frosty","id":4780,"avatar_url":"https://avatars.githubusercontent.com/u/4780?v=3","gravatar_id":"","url":"https://api.github.com/users/frosty","html_url":"https://github.com/frosty","followers_url":"https://api.github.com/users/frosty/followers","following_url":"https://api.github.com/users/frosty/following{/other_user}","gists_url":"https://api.github.com/users/frosty/gists{/gist_id}","starred_url":"https://api.github.com/users/frosty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frosty/subscriptions","organizations_url":"https://api.github.com/users/frosty/orgs","repos_url":"https://api.github.com/users/frosty/repos","events_url":"https://api.github.com/users/frosty/events{/privacy}","received_events_url":"https://api.github.com/users/frosty/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T14:09:49Z","updated_at":"2016-05-05T14:09:49Z","body":"So I've had a go at making `pendingPayment` private, using `purchasePlan` to create a new pending payment and throwing an error to indicate an unsuccessful payment. What do you think, @koke?"}}