Commit Graph

351 Commits

Author SHA1 Message Date
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 d430098bad
FIX: Properly allow no group to be selected (#33) 2020-11-24 14:52:00 -06:00
Justin DiRose be9e9c0117
FIX: Make URLs subfolder friendly (#29)
Not all URLs in Subscriptions were not subfolder install friendly. This commit uses link-to in places its needed to properly set URLs if on a subfolder install.
2020-11-02 10:20:31 -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 b950926538
FIX: Payments could not complete (#28)
Due to putting the Stripe Elements HTML inside an if block in the
template, this caused state to be funky. As a result, calling
`this.stripe.createToken` failed to return a promise. Opted instead to
hide the elements via CSS for anonymous users to prevent this
showstopping bug.
2020-10-29 10:21:14 -05:00
Justin DiRose 1ad5b17640
FEATURE: Better UX for anonymous users (#25)
Improves the subscription flow for anonymous users by making the routes available, and showing a login button. Clicking login from this page will save a `destination_url` cookie so that when logging in they're redirected back to the subscription page they were at.
2020-10-28 13:30:26 -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 e13221279d
FIX: Loading state persists after bad card entered (#22)
* FIX: Loading state persists after bad card entered

If a bad card number was entered and the subscribe button clicked, the
subscription button still disappeared and subscribing was not possible
without refreshing the page.

* UX: Add missing tooltip

* DEV: Ignore gems directory for local rubocop runs
2020-10-19 20:54:30 -05:00
Faizaan Gagan 55e6accb9c
FEATURE: Markdown support for product description (#21) 2020-10-12 10:01:33 -05:00
Justin DiRose 7e753d45bd
DEV: Update to new prettier standards 2020-09-16 09:53:50 -05:00
Justin DiRose d60c5b6d54
UX: fix incorrect text on cancel button 2020-09-16 09:49:45 -05:00
Justin DiRose bdcaaf9897
UX: i18ninize string 2020-09-16 09:44:44 -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 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 739296bc72
FIX: Single subscription was not correctly selected 2020-08-03 10:31:21 -05:00
Justin DiRose a1a7ca98a3
DEV: Fix tests 2020-07-28 15:40:16 -05:00
Justin DiRose 83002fab3c
FEATURE: New styling of product page 2020-07-28 12:46:59 -05:00
Justin DiRose 954beeb094
FIX: Properly show information on saved plans 2020-07-28 11:56:58 -05:00
Justin DiRose 0a244111bc
FIX: Buttons out of alignment on some browsers 2020-07-28 11:49:15 -05:00
Justin DiRose 11d9b2e011
FIX: If only one plan, automatically select it 2020-07-28 11:08:21 -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 88f36c18a6
FEATURE: Add BRL currency support 2020-06-30 10:13:05 -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 9153126f59 fix(coding-style): now consistent with existing coding style of the project 2020-04-23 17:17:06 +05:30
Raj Rathore 53a11872ef fix(coding-style): linting changes reverted to be consistent with existing style 2020-04-23 17:11:00 +05:30
Raj Rathore 30299a5f13 fix(currency-symbol): hard-coded dollar symbol removed 2020-04-23 16:06:02 +05:30
Raj Rathore f91b257198 feat(currency-inr): inr added to supported currencies 2020-04-16 01:57:56 +05:30
Rimian Perkins 48c606908a disable billing interval when cannot change 2020-03-21 20:30:30 +11:00
Rimian Perkins 071e1d6cb5 whoops prettier complaint 2020-01-14 20:15:54 +11:00
Rimian Perkins b83da467d0 respond to incomplete payment 2020-01-14 18:46:48 +11:00
Rimian Perkins 2bc780c4f9 Merge branch 'feature/one-time-payment' of github.com:rimian/discourse-subscriptions into feature/one-time-payment 2019-12-18 08:47:17 +11:00
Rimian Perkins 49ac965b24 tidy some scss class names etc 2019-12-18 08:47:01 +11:00
Rimian Perkins 9176471551 toggle single payments allowed setting 2019-12-17 21:14:13 +11:00
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 38c444c489 tidy scss a bit 2019-12-16 13:59:58 +11:00
Rimian Perkins 7d3ca0421a rm old donation form 2019-12-16 10:59:59 +11:00
Rimian Perkins b79eed42ef redirect and rm activity connector 2019-12-16 10:47:59 +11:00
Rimian Perkins 55f4592033 subscription and billing templates 2019-12-16 10:42:55 +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 4b334a69b5 remove subscribe index 2019-12-13 11:54:32 +11:00