Commit Graph

42 Commits

Author SHA1 Message Date
David Taylor 4e1a17c40c
DEV: Introduce syntax_tree for ruby formatting (#144) 2022-12-29 13:35:06 +01:00
Jarek Radosz d59a283fd2
DEV: Fix mocha deprecations (#140)
It now supports strict keyword argument matching by default.
2022-11-02 10:47:35 +01:00
David Taylor c93be7632c
DEV: Bump rubocop-discourse (#136) 2022-10-04 09:18:34 +01:00
Vinoth Kannan 3ce422ffbe
FIX: set interval field correctly in object root for recurring plans. (#91)
The interval field was missing in the Ember object since it was only available inside the nested object.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-09-21 18:12:17 +05:30
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 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
Justin DiRose 072b558d40
FEATURE: Give option to repurchase products multiple times (#46)
Feature requested here: https://meta.discourse.org/t/subscriptions-allow-users-to-purchase-one-time-products-multiple-times/173732/

There may be cases where a site admin wants to allow the repurchasing of a product. This implements the functionality by adding a repurchaseable toggle in the admin screen when creating a product. This saves an attribute to the Stripe product metadata.

When a user has already purchased an item with this toggle enabled, they will be able to purchase it again when browsing to `/s`.
2021-01-31 14:17:44 -06: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 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 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
Justin DiRose d360a4155d DEV: Fix tests after changes to controllers 2020-05-28 11:45:58 -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
Rimian Perkins b397ba5a68 name space module 2019-12-04 11:23:45 +11:00
Rimian Perkins a95c119bcf fix paths in request specs 2019-12-03 11:48:12 +11:00
Rimian Perkins 57a18f5a4e whoops did not set currency 2019-11-30 17:24:49 +11:00
Rimian Perkins a371d2baf6 fix broke test 2019-11-30 16:55:24 +11:00
Rimian Perkins 709aebb593 set the currency in the plan 2019-11-30 16:39:28 +11:00
Rimian Perkins 3b7ff90672 user removed from the group in admin 2019-11-29 10:37:32 +11:00
Rimian Perkins 298e70b32a delete customer record 2019-11-28 20:44:38 +11:00
Rimian Perkins 3e4fd76891 show product and plan nickname in admin 2019-11-26 12:55:49 +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 e3ac6f7dac date format and product description 2019-11-01 12:30:19 +11:00
Rimian Perkins a80e9d9bc2 add subscription to group 2019-10-24 11:37:20 +11:00
Rimian Perkins 603ddc354b plan can be active or not 2019-10-24 10:02:31 +11:00
Rimian Perkins 922dee581c fix bugs in create plans 2019-10-23 15:55:06 +11:00
Rimian Perkins a94287434d plans have group names 2019-10-23 11:50:54 +11:00
Rimian Perkins c6bf9ca4d3 fix trial period 2019-10-23 10:16:17 +11:00
Rimian Perkins 2179e3d280 fix statement descriptor param 2019-10-22 09:24:54 +11:00
Rimian Perkins c6dd47d328 templates, plans 2019-10-21 15:28:45 +11:00
Rimian Perkins b05b03e25b fix up forms and requests to plan api 2019-10-17 20:34:26 +11:00
Rimian Perkins e2b915b905 plans and products 2019-10-17 12:07:06 +11:00
Rimian Perkins d02ba3ef6a meta data 2019-10-16 21:06:19 +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 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 321f6b8a71 spec unauthenticated plans request 2019-10-10 12:31:32 +11:00
Rimian Perkins 8cc4f880eb name space admin controller 2019-10-10 12:08:52 +11:00