Commit Graph

68 Commits

Author SHA1 Message Date
Justin DiRose a282475da3
FEATURE: Admin > Subscriptions Pagination (#50)
Meta topic: https://meta.discourse.org/t/subscriptions-add-pagination-to-admin-subscriptions-view/172500

This adds support for pagination using our `{{load-more}}` component in core. Implementation on the backend was a bit tricky because we don't return all results from Stripe, only those that match local subscriptions stored in the `DiscourseSubscriptions::Subscription` model.
2021-02-05 11:57:53 -06:00
Joffrey JAFFEUX 3f8fca3246
DEV: prettier 2.2.1 (#48) 2021-01-27 10:38:33 +01: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 da9b58398b
FEATURE: Support for coupons in checkout (#41)
This adds support for Stripe Promo Codes in the user checkout process. 

Also adds a discounted field to User > Billing > Subscriptions to show the amount or percent discounted.

This does not currently add in support for creating promo codes in the Subscriptions interface (that will come at a later point in time). Instead a coupon can be created with a promo code right from the Stripe dashboard.
2021-01-07 15:25:44 -06:00
Justin DiRose 443fdc3ec6
DEV: Transition from Ember constant to imports (#34) 2020-11-30 10:35:21 -06:00
Justin DiRose b92627677f
FEATURE: Implement refunds from dashboard (#27)
An implementation of refunds from the Admin dashboard. To refund, go to Plugins > Subscriptions > Subscriptions then click the `Cancel` button. You'll be presented with a modal. If you wish to refund only the most recent payment, check the box. 

This only implements refunds for Subscriptions, not One Time Payments. One Time Payments will still need to be handled manually at this time.
2020-10-29 10:31:12 -05: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 7e753d45bd
DEV: Update to new prettier standards 2020-09-16 09:53:50 -05:00
Justin DiRose 9f914c7793
DEV: run prettier 2020-09-01 20:35:53 -05:00
Justin DiRose 4457713901
FEATURE: Show renewal date on uncanceled subscriptions 2020-08-19 15:08:38 -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 c9ff55b46a
REFACTOR: Use the Prices API in place of Plans (#17)
Stripe has a newer API called Prices where you can create a price for any product and it can either be recurring or one-time. The easy part is existing Plans work with the Prices API by passing a Plan ID, but objects are returned in the slightly-different Prices API object format.

This commit is a refactor to the new API to handle the data in its new form, and lays the foundation for a one time payment plan to be added to any subscriptions product.
2020-07-15 08:44:40 -05:00
Mark VanLandingham 8bcb7aa93c
DEV: Import getURL to fix deprecation warnings (#16) 2020-07-07 13:50:16 -05:00
Justin DiRose 892c889c31
FIX: Products & Subscriptions returned blank 2020-06-08 15:09:41 -05:00
Justin DiRose 9c46794e80
DEV: Remove deprecations & improve error handling (#12)
- Replace deprecated methods on client
- Fix broken dropdowns due to select kit 2 upgrade
- Graceful error handling when Stripe keys are not configured but plugin enabled
2020-05-28 10:32:57 -05:00
Justin DiRose fb4fac197b
REFACTOR: Use models to store data (#11)
* REFACTOR: Use api to add subscribe link

* FIX: I18n subscribe link

* REFACTOR: Use models to store some data

This enables the plugin to show only subscription information which was
generated on Discourse. Subscription data storage is limited to the
external identifiers Stripe generates so we can interact with the API.

* DEV: Test/linting fixes/rake task
2020-05-22 11:20:05 -05:00
Roman Rizzi 7ba08ab7da
FIX: Discourse.Model was removed. Use EmberObject instead (#10) 2020-05-06 19:06:14 -03:00
Raj Rathore 30299a5f13 fix(currency-symbol): hard-coded dollar symbol removed 2020-04-23 16:06:02 +05:30
Rimian Perkins bf4fdd18ef fix white space 2019-12-17 17:43:30 +11:00
Rimian Perkins 52db93ecd8 user payments page 2019-12-17 16:31:58 +11:00
Rimian Perkins 57fb508514 buttons for selecting price and one time payment 2019-12-13 10:41:14 +11:00
Rimian Perkins 831e64317b refactor models, routes and buttons 2019-12-12 12:59:26 +11:00
Rimian Perkins 08cbff0c1c change engine mount point and base path in jsapp 2019-12-03 10:29:44 +11:00
Rimian Perkins 382fd4ac41 name space the js admin 2019-12-02 18:58:14 +11:00
Rimian Perkins b1db6e7a4c set currency 2019-11-30 17:44:16 +11:00
Rimian Perkins b65fd5568a upgrade prettier 2019-11-19 11:01:55 +11:00
Rimian Perkins 75f5ec4393 fix missing radix on parseInt 2019-11-19 10:21:05 +11:00
Rimian Perkins 6590d8051c delete subscriptions in admin 2019-11-14 10:51:04 +11:00
Rimian Perkins 0f17acc47e rm unused var 2019-11-13 15:33:53 +11:00
Rimian Perkins 5fdd81ac77 link to user admin 2019-11-13 15:27:32 +11:00
Rimian Perkins 8aed6b8d30 add link to user 2019-11-13 14:21:21 +11:00
Rimian Perkins 482ce178d5 pretty js 2019-11-06 20:59:35 +11:00
Rimian Perkins 4a812ceff6 toggle the subscribe button 2019-11-06 20:43:16 +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 e3ac6f7dac date format and product description 2019-11-01 12:30:19 +11:00
Rimian Perkins 86c77a7395 rubocop && fix i18n 2019-11-01 10:50:34 +11:00
Rimian Perkins bec2d57920 pretty 2019-10-31 13:31:24 +11:00
Rimian Perkins b0a4665bf4 set the dollar amount 2019-10-31 13:29:11 +11:00
Rimian Perkins 1074d84901 feedback error when plan creates and updates 2019-10-31 12:41:02 +11:00
Rimian Perkins ced4d1c786 format the amount in admin 2019-10-31 11:41:01 +11:00
Rimian Perkins 842fac9176 format the rate in the plan model 2019-10-31 10:44:46 +11:00
Rimian Perkins dbaa30ba18 user cancels subscription 2019-10-31 10:01:41 +11:00
Rimian Perkins ee0901aeca delete subscription 2019-10-29 14:35:07 +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 1f7549060d fix eslint and rubocop 2019-10-25 14:00:59 +11:00
Rimian Perkins 6fbcea2cf3 product controller 2019-10-25 08:18:16 +11:00
Rimian Perkins 603ddc354b plan can be active or not 2019-10-24 10:02:31 +11:00