Commit Graph

133 Commits

Author SHA1 Message Date
David Taylor 7b15f57af3
DEV: Update eslint config (#245) 2024-11-19 11:31:14 +01:00
Blake Erickson c02193943b
FIX: Admins unable to cancel a subscription for a user (#220) 2024-07-12 14:33:04 -06:00
Blake Erickson 45754baa00
FEATURE: Add new stripe based pricing table (#202)
This commit adds an optional new stripe based pricing table.
If the user is logged in, the email field will be prepopulated with the users email.

The pricing table can be configured in the stripe dashboard.

Once the discourse_subscriptions_pricing_table setting is filled with the pricing table embed code from the stripe dashboard,
the pricing table will be displayed on /s/subscriptions

For more details see https://stripe.com/docs/payments/checkout/pricing-table
---------

Co-authored-by: spirobel <spirobel@protonmail.com>
2024-04-29 12:47:58 -06:00
Michelle Bueno Saquetim Vendrame d63f241e0d
FEATURE: add ZAR currency support (#199) 2024-04-15 21:26:26 +02:00
Jarek Radosz d33cf2921e
DEV: Update linting (#189) 2024-01-16 17:51:44 +01:00
Isaac Janzen 331c8630c3
DEV: Upgrade modal to Component API (#186)
- Upgrade modal to Component API
- Co-locate templates
2023-12-08 15:25:05 -07:00
David Taylor 2ea8d7b6eb
DEV: Resolve transitionTo deprecation (#185) 2023-12-01 18:30:36 +00:00
alex-tee b855ce9bb9
add JPY currency (#176) 2023-09-06 12:14:41 +02:00
Mark Reeves 803bba7938
FEATURE: Capture cardholder address fields for Stripe customer (#161)
- Adds the following fields to the subscription payment form:
  - Cardholder Name
  - Country
  - Postal Code
  - Address Line 1
  - City
  - State or Province
- Stripe recommends Cardholder Name & Country for verification; Cardholder Name, Country, and State/Province for US/Canada selections are required fields
- All fields are passed to Stripe for verification on submit
- Fields are also captured on the customer record in Stripe, under Billing Details
2023-05-05 13:20:35 -04:00
Penar Musaraj 550e8347e3
DEV: Refactor bootbox dialogs (#137) 2022-10-17 14:42:40 -04:00
Faizaan Gagan 945af4f140
FIX: Allow user to update card details for recurring subscriptions (#123)
* add new route for card update

* create backend route

* update label

* basic functionality working

* ran rubocop

* added rspec tests for functionality

* make payment_method param compulsory

* fixed js linting

* improve client side error handling

* improve server side error handling

* improved update card page UI

* improve button UI for user subscriptions page

* give feedback to user about save status

* remove heading from last column

* fix padding on edit/delete buttons for update table

Co-authored-by: Blake Erickson <o.blakeerickson@gmail.com>
2022-07-05 19:53:27 -06:00
Jarek Radosz 98c843b8f2
DEV: Fix imports (#113) 2022-03-07 00:30:01 +01:00
Jarek Radosz d6eaba632d
DEV: Lose the es6 suffix (#112) 2022-03-07 00:20:03 +01:00
Justin DiRose 5ead25feb6
REFACTOR: Rename s to subscribe (#86) 2021-07-19 19:56:19 -05:00
Justin DiRose 8ab7a63167
FEATURE: Validate coupon codes on form submit (#74) 2021-06-16 12:54:54 -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
chalkadmin 1ae5a552a6
FEATURE: Add SGD as supported currency (#60)
Add additional currency Singapore dollars as supported Stripe currency
2021-04-13 12:20:00 +02:00
Brian Bønk 312b1182b9
FEATURE: Add DKK as supported currency 2021-04-06 09:59:27 -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 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 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 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
Justin DiRose 7e753d45bd
DEV: Update to new prettier standards 2020-09-16 09:53:50 -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
Justin DiRose 88f36c18a6
FEATURE: Add BRL currency support 2020-06-30 10:13:05 -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
Raj Rathore f91b257198 feat(currency-inr): inr added to supported currencies 2020-04-16 01:57:56 +05:30
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 9176471551 toggle single payments allowed setting 2019-12-17 21:14:13 +11:00
Rimian Perkins b79eed42ef redirect and rm activity connector 2019-12-16 10:47:59 +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
Rimian Perkins 57fb508514 buttons for selecting price and one time payment 2019-12-13 10:41:14 +11:00
Rimian Perkins e27b55ea6f customer declared already in upper scope 2019-12-12 13:45:16 +11:00
Rimian Perkins 831e64317b refactor models, routes and buttons 2019-12-12 12:59:26 +11:00
Rimian Perkins ff1740d035 validate plan 2019-12-10 10:55:24 +11:00
Rimian Perkins 86bc9bb3e6 rm redundant action 2019-12-10 10:15:30 +11:00
Rimian Perkins d3eed3546d test button click 2019-12-06 14:33:38 +11:00
Rimian Perkins 2ce314fc8d initial payment buttons component 2019-12-06 13:52:03 +11:00