Commit Graph

64 Commits

Author SHA1 Message Date
Justin DiRose 227c55e6f5
FIX: Restrict mods from seeing Subscriptions admin features (#70)
As reported [on Meta](https://meta.discourse.org/t/discourse-subscriptions/140818/352?u=justin), moderators could access all of the subscriptions data (plugins/prices/subscribers) and manage them. This should not be the case, so this PR adds a route constraint to 404 moderators from these routes.
2021-06-08 17:24:13 -05:00
Justin DiRose f596a0f78a
FEATURE: Campaigns (#67)
Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>

See https://github.com/discourse/discourse-subscriptions/pull/67 for the full description.
2021-06-02 13:15:03 -05:00
Justin DiRose 400313cded
FEATURE: Allow creation of coupons in admin panel (#43)
Adds full support to create coupon/promo codes in the Admin > Plugins > Subscriptions section of the plugin. The Create Coupon button opens a form on the same page, and the active checkboxes toggle the active status of the coupon code.
2021-01-13 11:47:22 -06:00
Justin DiRose 3a5078ded6
REFACTOR: Simplify controller setup (#24)
The code in the plugin needed a dramatic cleanup. This refactor collapses the Plan/Product/Subscription controllers on the backend into one new controller: `SubscribeController`.

This reduces N+1 calls to the back end during the subscription process and simplifies use of the code. 

I've also removed a bunch of dead code and refactored some logic into methods for easier readability. No feature/functionality changes in this commit; only refactoring. However, refactoring will allow for implementation of better anonymous user handling, so this is largely a foundation to enable making that change.
2020-10-21 13:36:31 -05:00
Justin DiRose a868e6b838
FEATURE: Cancel payments at end of subscription vs immediately
Previously, when a user canceled a subscription, the access would revoke
immediately on Discourse vs. at the end of the billing period. This
commit changes the behavior to remove membership at the end of the
billing period using Stripe's `cancel_at_period_end` attribute on the
Subscription object.

This commit now requires the setup of webhooks for subscription
processing to occur correctly.
2020-08-19 14:37:47 -05:00
Justin DiRose 9491f558ea
FEATURE: Add support for 3D Secure payments (#19)
Adds an additional checkout flow to support authentication of payment methods.
2020-07-24 15:07:18 -05:00
Justin DiRose 587661fafb
FEATURE: Allow one-time purchases on products (#18)
Building off the foundation of using the Prices API, this PR adds the ability to create a one-time purchase plan for any product, which then can add a user to the specified plan group.

Some things to be aware of:

    One-time purchases cannot have trials.
    One-time purchases use the Invoice API instead of Subscriptions. Invoices are created then charged immediately.
    Users should receive emails for these invoices directly from Stripe just like subscriptions.
2020-07-22 11:06:34 -05:00
Justin DiRose fb4f50478d
REFACTOR: Use engine to load files, add constraint (#14) 2020-07-06 11:11:04 -05:00
Rimian Perkins 431279a4f7 Add empty webhook url and upgrade stripe gem 2020-01-10 10:24:09 +11:00
Rimian Perkins 52db93ecd8 user payments page 2019-12-17 16:31:58 +11:00
Rimian Perkins 92f6569f9f fix broken paths 2019-12-16 14:10:25 +11:00
Rimian Perkins 8264930e92 user activity link to payments 2019-12-13 13:44:25 +11:00
Rimian Perkins 53ed40bfc3 fix api routes and eslint 2019-12-13 12:29:34 +11:00
Rimian Perkins 57fb508514 buttons for selecting price and one time payment 2019-12-13 10:41:14 +11:00
Rimian Perkins b397ba5a68 name space module 2019-12-04 11:23:45 +11:00
Rimian Perkins 6590d8051c delete subscriptions in admin 2019-11-14 10:51:04 +11:00
Rimian Perkins e14b4dcd96 the subscribe product page 2019-11-04 16:37:21 +11:00
Rimian Perkins 2b3c52bdd4 name space user subscription request 2019-11-01 13:43:09 +11:00
Rimian Perkins ee0901aeca delete subscription 2019-10-29 14:35:07 +11:00
Rimian Perkins 2a985ae554 fix subscribe request 2019-10-29 14:15:13 +11:00
Rimian Perkins 7edb0fe39b list subscriptions 2019-10-29 11:43:32 +11:00
Rimian Perkins 87c83abcd3 add basic invoices page 2019-10-28 14:05:58 +11:00
Rimian Perkins 570ef2fbb4 use the billing page 2019-10-25 13:55:57 +11:00
Rimian Perkins 6fbcea2cf3 product controller 2019-10-25 08:18:16 +11:00
Rimian Perkins 496f2b9706 save the product 2019-10-16 14:15:01 +11:00
Rimian Perkins 1bedc1ba2f destroy products 2019-10-15 23:14:04 +11:00
Rimian Perkins 23cb6ef93e create the products 2019-10-15 21:50:30 +11:00
Rimian Perkins e51aa5f6f0 products admin route and basic pages 2019-10-15 13:18:25 +11:00
Rimian Perkins 4e615908f4 create the subscription 2019-10-14 11:47:49 +11:00
Rimian Perkins fcfb826929 create the token and make the customer request 2019-10-11 12:26:01 +11:00
Rimian Perkins bb31deae89 basic subscribe page 2019-10-10 13:52:55 +11:00
Rimian Perkins 91045583ad namespace subscriptions controller 2019-10-10 13:09:24 +11:00
Rimian Perkins 8cc4f880eb name space admin controller 2019-10-10 12:08:52 +11:00
Rimian Perkins d4afe93a5d delete plans 2019-09-25 13:20:28 +10:00
Rimian Perkins 1b232a1bd4 list plans 2019-09-25 11:18:11 +10:00
Rimian Perkins a2d120c8b5 save plan model 2019-09-24 20:44:51 +10:00
Rimian Perkins 0d82bcf37e Plans, subscriptions
* Plans controller
* Subscription controller
* Clean admin controller
* Ember Plans route
* Index page
* New Plans
* Translations
2019-09-24 16:04:42 +10:00
Rimian Perkins e1ed1a41b0 add initial controllers 2019-09-23 17:53:05 +10:00
Rimian Perkins e004a18071 templates and routes for subscriptions 2019-09-23 15:01:03 +10:00
Rimian Perkins 871cec9ec3 pretty js 2019-09-14 17:28:58 +10:00
Rimian Perkins 6fe149c4a5 basic admin interface 2019-09-14 12:56:28 +10:00
Rimian Perkins 2e3cdb0dcf fix routes. get specs passing 2019-09-11 19:11:02 +10:00
Rimian Perkins a5dbe4f9bd Show route 2019-09-11 17:38:55 +10:00
Rimian Perkins ac267fabaf basic route and template 2019-09-11 17:13:12 +10:00
Rimian Perkins 78914e0511 Add new plugin files.
This gets the plugin running again without name collisions. A solid starting point
2019-09-11 13:19:07 +10:00
Rimian Perkins 6f826ce7a0 rubocop correct 2019-08-27 20:04:02 +10:00
Angus McLeod 1b1eb215e4 various 2018-06-28 09:32:58 +10:00
Angus McLeod 8453d5cc03 various 2018-06-25 18:14:50 +10:00
Chris Beach d563cd1ddd Working checkout_controller.rb that charges Stripe
* Add billing address setting
2017-10-19 23:51:05 +01:00
Chris Beach 20a38095dd Enable checkout route 2017-10-19 23:51:05 +01:00