{"action":"created","issue":{"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/1000","repository_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro","labels_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/1000/labels{/name}","comments_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/1000/comments","events_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/1000/events","html_url":"https://github.com/restrictcontentpro/restrict-content-pro/issues/1000","id":208919628,"number":1000,"title":"Create pending payments & expand payments table","user":{"login":"nosegraze","id":6324272,"avatar_url":"https://avatars1.githubusercontent.com/u/6324272?v=3","gravatar_id":"","url":"https://api.github.com/users/nosegraze","html_url":"https://github.com/nosegraze","followers_url":"https://api.github.com/users/nosegraze/followers","following_url":"https://api.github.com/users/nosegraze/following{/other_user}","gists_url":"https://api.github.com/users/nosegraze/gists{/gist_id}","starred_url":"https://api.github.com/users/nosegraze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nosegraze/subscriptions","organizations_url":"https://api.github.com/users/nosegraze/orgs","repos_url":"https://api.github.com/users/nosegraze/repos","events_url":"https://api.github.com/users/nosegraze/events{/privacy}","received_events_url":"https://api.github.com/users/nosegraze/received_events","type":"User","site_admin":false},"labels":[{"id":5100961,"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":270622518,"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/labels/has%20PR","name":"has PR","color":"009800","default":false},{"id":30272017,"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/labels/needs%20testing","name":"needs testing","color":"0b02e1","default":false}],"state":"open","locked":false,"assignee":{"login":"nosegraze","id":6324272,"avatar_url":"https://avatars1.githubusercontent.com/u/6324272?v=3","gravatar_id":"","url":"https://api.github.com/users/nosegraze","html_url":"https://github.com/nosegraze","followers_url":"https://api.github.com/users/nosegraze/followers","following_url":"https://api.github.com/users/nosegraze/following{/other_user}","gists_url":"https://api.github.com/users/nosegraze/gists{/gist_id}","starred_url":"https://api.github.com/users/nosegraze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nosegraze/subscriptions","organizations_url":"https://api.github.com/users/nosegraze/orgs","repos_url":"https://api.github.com/users/nosegraze/repos","events_url":"https://api.github.com/users/nosegraze/events{/privacy}","received_events_url":"https://api.github.com/users/nosegraze/received_events","type":"User","site_admin":false},"assignees":[{"login":"nosegraze","id":6324272,"avatar_url":"https://avatars1.githubusercontent.com/u/6324272?v=3","gravatar_id":"","url":"https://api.github.com/users/nosegraze","html_url":"https://github.com/nosegraze","followers_url":"https://api.github.com/users/nosegraze/followers","following_url":"https://api.github.com/users/nosegraze/following{/other_user}","gists_url":"https://api.github.com/users/nosegraze/gists{/gist_id}","starred_url":"https://api.github.com/users/nosegraze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nosegraze/subscriptions","organizations_url":"https://api.github.com/users/nosegraze/orgs","repos_url":"https://api.github.com/users/nosegraze/repos","events_url":"https://api.github.com/users/nosegraze/events{/privacy}","received_events_url":"https://api.github.com/users/nosegraze/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/milestones/66","html_url":"https://github.com/restrictcontentpro/restrict-content-pro/milestone/66","labels_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/milestones/66/labels","id":2280864,"number":66,"title":"2.9","description":"","creator":{"login":"pippinsplugins","id":1034109,"avatar_url":"https://avatars2.githubusercontent.com/u/1034109?v=3","gravatar_id":"","url":"https://api.github.com/users/pippinsplugins","html_url":"https://github.com/pippinsplugins","followers_url":"https://api.github.com/users/pippinsplugins/followers","following_url":"https://api.github.com/users/pippinsplugins/following{/other_user}","gists_url":"https://api.github.com/users/pippinsplugins/gists{/gist_id}","starred_url":"https://api.github.com/users/pippinsplugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pippinsplugins/subscriptions","organizations_url":"https://api.github.com/users/pippinsplugins/orgs","repos_url":"https://api.github.com/users/pippinsplugins/repos","events_url":"https://api.github.com/users/pippinsplugins/events{/privacy}","received_events_url":"https://api.github.com/users/pippinsplugins/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":35,"state":"open","created_at":"2017-01-26T19:51:04Z","updated_at":"2017-07-03T15:16:31Z","due_on":"2017-05-16T07:00:00Z","closed_at":null},"comments":87,"created_at":"2017-02-20T15:59:03Z","updated_at":"2017-07-07T14:18:22Z","closed_at":null,"body":"Creating a new issue based on the discussion in #999\r\n\r\nWe should start creating pending payments before sending the user to the gateway, then update the payment record after payment is received. We should also consider adding more data to our payments table, like:\r\n\r\n- Discount code used\r\n- Name of the payment gateway (we currently save like \"Credit Card One Time\" rather than \"stripe\")\r\n- Whether or not it's for a free trial (should we create an initial $0 payment record for that?)\r\n- Subscription ID (we save the name now, but IMO the ID would be better)\r\n\r\n## To do:\r\n\r\n- [x] Expand payments table to include:\r\n  - Discount code used\r\n  - Discounted amount\r\n  - Proration credits\r\n  - Fees\r\n  - Subtotal (actual price of the subscription level)\r\n  - Change `payment_type` to be the actual name of the gateway.\r\n  - Change `subscription` to be the subscription ID number instead of the name.\r\n- [x] Back-fill `subscription_level_id` column via magic getter\r\n- [x] Create pending payment before going to gateway.\r\n- [x] Remove these from `rcp_process_registration()` : \r\n  - Setting pending subscription level/key.\r\n  - Setting expiration date.\r\n  - Role updates/removal.\r\n  - Increasing discount code usage and adding to profile.\r\n- [x] Update all gateways to not insert new payments, and instead change the existing payment to `complete`.\r\n- [x] Trigger action when a payment record is completed and insert all removed code here.\r\n- [x] Remove discount code stuff from `rcp_remove_subscription_data_on_failure()` as that should no longer be necessary.\r\n- [x] Maintain and test for backwards compatibility so as not to break custom gateways.\r\n\r\n## Gateway Testing\r\n\r\n**Stripe**\r\n\r\n- [x] Regular, non-recurring payment.\r\n- [x] Manually renew non-recurring payment and check that there's no proration and expiration date is extended from current expiration date.\r\n- [x] Recurring subscription signup.\r\n- [x] Renewal payment from recurring subscription.\r\n- [x] Free trial (double check trial expiration date is correct and `$0` payment is completed).\r\n- [x] Failed payment when upgrading. Make sure old subscription level/role/etc. remains active and the user doesn't get any new settings from upgraded level.\r\n\r\n**PayPal Express**\r\n\r\n- [x] Regular payment\r\n- [x] Recurring payment both with and without signup fees\r\n- [x] Free trial\r\n\r\n**PayPal Standard**\r\n\r\n- [x] Regular payment.\r\n- [x] Recurring signup both with and without signup fees.\r\n- [ ] Renewal payment from recurring subscription.\r\n- [x] Free trial (double check trial expiration date is correct and `$0` payment is completed).\r\n\r\n**PayPal Pro**\r\n\r\n- [x] Regular payment\r\n- [ ] Free trial (double check trial expiration date is correct and `$0` payment is completed).\r\n- [ ] Renewal payment from recurring subscription.\r\n- [x] Failed payment correctly gets marked as `failed` \r\n\r\n**Authorize.net**\r\n\r\n- [x] Regular, non-recurring payment.\r\n- [x] Recurring subscription signup.\r\n- [x] Renewal payment from recurring subscription.\r\n- [x] Free trial (double check trial expiration date is correct and `$0` payment is completed).\r\n\r\n**Braintree**\r\n\r\n- [x] Regular, non-recurring payment.\r\n- [x] Recurring subscription signup.\r\n- [x] Recurring subscription with signup fee.\r\n- [ ] Renewal payment from recurring subscription.\r\n- [x] Free trial (double check trial expiration date is correct and `$0` payment is completed).\r\n\r\n**2Checkout**\r\n\r\n- [x] Regular, non-recurring payment.\r\n- [x] Recurring subscription signup.\r\n- [ ] Renewal payment from recurring subscription.\r\n\r\n**Misc**\r\n\r\n- [x] Register for free subscription. Ensure expiration date is set to `none` and status is `free`.\r\n- [x] Register with 100% off recurring discount. Ensure expiration date is set to `none`.\r\n- [x] Register for old style free trial (free plan with fixed duration). Make sure expiration date is correct and status is `active`."},"comment":{"url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/comments/313695127","html_url":"https://github.com/restrictcontentpro/restrict-content-pro/issues/1000#issuecomment-313695127","issue_url":"https://api.github.com/repos/restrictcontentpro/restrict-content-pro/issues/1000","id":313695127,"user":{"login":"nosegraze","id":6324272,"avatar_url":"https://avatars1.githubusercontent.com/u/6324272?v=3","gravatar_id":"","url":"https://api.github.com/users/nosegraze","html_url":"https://github.com/nosegraze","followers_url":"https://api.github.com/users/nosegraze/followers","following_url":"https://api.github.com/users/nosegraze/following{/other_user}","gists_url":"https://api.github.com/users/nosegraze/gists{/gist_id}","starred_url":"https://api.github.com/users/nosegraze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nosegraze/subscriptions","organizations_url":"https://api.github.com/users/nosegraze/orgs","repos_url":"https://api.github.com/users/nosegraze/repos","events_url":"https://api.github.com/users/nosegraze/events{/privacy}","received_events_url":"https://api.github.com/users/nosegraze/received_events","type":"User","site_admin":false},"created_at":"2017-07-07T14:18:22Z","updated_at":"2017-07-07T14:18:22Z","body":"Added `$0` payments for all free subscription levels and 100% off recurring discounts."}}
{"actor":{"display_login":"nosegraze"}}