Author SHA1 Message Date
Nat b1f303a1c8 UX: Surface stripe AuthenticationError on the Admin Dashboard 2024-01-04 15:52:24 +08: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
Discourse Translator Bot 316303da5d Update translations (#184) 2023-11-21 14:37:08 +01:00
Discourse Translator Bot 2f9353bc33 Update translations (#183) 2023-11-14 14:30:37 +01:00
Martin Brennan 3608944b9c DEV: Change settings root from plugins: to discourse_subscriptions (#182)
This is so the plugins settings are better categorized in the site settings UI.
2023-11-13 10:23:25 +10:00
Martin BrennanandAlexDev 3aec1a9336 DEV: Metadata update for plugin.rb (#181)
* Update plugin.rb metadata

* Update plugin.rb

---------

Co-authored-by: AlexDev <[email protected]>
2023-11-07 17:29:37 -08:00
Discourse Translator Bot 2f87566366 Update translations (#180) 2023-11-07 21:31:30 +01:00
Kris ac81a7a830 fix typo (#179) 2023-10-24 12:39:32 -04:00
dependabot[bot] a257b386f9 Bump @babel/traverse from 7.20.10 to 7.23.2 (#178)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.20.10 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 12:34:58 -04:00
Natalie Tay c30fea21ef FIX: Clicking on login should show login modal (#177)
* FIX: Clicking on login should show login modal

* Add system test that shows the login modal appears
2023-09-28 14:21:16 +08:00
alex-tee b855ce9bb9 add JPY currency (#176) 2023-09-06 12:14:41 +02:00
Penar Musaraj 1a80f9d52b DEV: Pin plugin for Discourse 3.1 stable (#175) 2023-08-22 13:50:37 -05:00
Discourse Translator Bot c4f8220a55 Update translations (#174) 2023-08-15 21:25:59 +02:00
Penar Musaraj 7140517ec8 DEV: Fix SCSS deprecations (#172)
* DEV: Fix SCSS deprecations

Followup to https://github.com/discourse/discourse-subscriptions/pull/171

Also fixes:

```
    ╷
581 │       hsl(random(360), 100, 50);
    │       ^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
    /Users/pmusaraj/Projects/discourse/discourse-subscriptions.scss 581:7  root stylesheet
Deprecation Warning: $lightness: Passing a number without unit % (50) is deprecated.
```

* More cleanup
2023-07-19 11:15:34 -04:00
dependabot[bot] 9173190181 Bump word-wrap from 1.2.3 to 1.2.4 (#173)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 01:57:35 +02:00
Penar Musaraj 77cb62bf1f DEV: Fixes SCSS deprecation in console (#171)
Sample warning was:

```
Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($sidebar-height, 1.2) or calc($sidebar-height / 1.2)

More info and automated migrator: https://sass-lang.com/d/slash-div
```
2023-07-17 16:42:06 -04:00
dependabot[bot] 2a75da65b8 Bump semver from 6.3.0 to 6.3.1 (#170)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 10:46:20 +02:00
Kris 00e5bc1614 DEV: remove old shadow definition (#168) 2023-06-15 10:18:04 -04:00
Isaac Janzen e365ced531 DEV: Use angle bracket syntax (#167) 2023-05-28 09:32:27 -05:00
Discourse Translator Bot bf41ea9aa7 Update translations (#166) 2023-05-23 21:23:39 +02:00
Discourse Translator Bot 81205cebaf Update translations (#165) 2023-05-16 19:39:51 +02:00
Mark Reeves 49ddc757c9 Make country names translatable (#164) 2023-05-12 08:55:46 -04:00
Discourse Translator Bot d6337e559a Update translations (#163) 2023-05-10 00:48:25 +02:00
Mark Reeves a6a0cd72c8 FIX: A few more syntax fixes for button actions (#162) 2023-05-08 10:37:37 -04:00
Mark Reeves 7bc34bbbb4 FIX: A few more syntax fixes for button actions (#162) 2023-05-08 10:36:11 -04: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
Selase Krakani 2babb43ffb FEATURE: Skip product listing if only one product is present (#160)
At the moment, paying for a product typically involves first clicking
the subscribe link added to the navigation bar, selecting a product and
then adding card details to to make the purchase.

This change skips the product selection step if the site has only one
product.
2023-05-04 13:52:04 +00:00
Mark Reeves 9aa4a44b2a FIX: Fix syntax for some buttons following recent updates (#159) 2023-05-03 15:50:20 -04:00
Isaac Janzen c06ae37048 DEV: Use angle bracket syntax (#158) 2023-05-02 09:24:28 -05:00
Discourse Translator Bot 45b7eb6e6c Update translations (#155) 2023-02-21 17:13:37 +01:00
Discourse Translator Bot ee9741aefa Update translations (#154) 2023-02-15 10:53:27 +01:00
Rafael dos Santos Silva bb99a9a66a Revert "DEV: Dart Sass deprecation (#150)" (#151)
This reverts commit 1834095b23.
2023-02-07 18:33:31 -03:00
Rafael dos Santos Silva 1834095b23 DEV: Dart Sass deprecation (#150) 2023-02-07 16:25:47 -03:00
Discourse Translator Bot 8dfdca567d Update translations (#149) 2023-01-24 16:31:56 +01:00
Discourse Translator Bot d4f0b9a43c Update translations (#147) 2023-01-10 20:56:53 +01:00
discoursebotanddiscoursebuild 3051bceb8f DEV: Update CI workflows (#148)
Co-authored-by: discoursebuild <[email protected]>
2023-01-10 19:06:12 +00:00
David Taylor 7fb0936e5c DEV: Update eslint-config-discourse, use prettier for hbs (#146) 2023-01-04 13:39:58 +01:00
dependabot[bot] fb072aa851 Bump json5 from 2.2.1 to 2.2.2 (#145)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-29 12:25:51 -05:00
David Taylor 4e1a17c40c DEV: Introduce syntax_tree for ruby formatting (#144) 2022-12-29 13:35:06 +01:00
Discourse Translator Bot cbbc23fd5a Update translations (#143) 2022-12-13 17:15:12 +01:00
Discourse Translator Bot e917c3bca6 Update translations (#142) 2022-11-29 15:39:40 +01:00
discoursebotanddiscoursebuild 425fbc0af1 DEV: Update CI workflows (#141)
Co-authored-by: discoursebuild <[email protected]>
2022-11-07 14:21:36 -06:00
Discourse Translator Bot c0b7aa65d7 Update translations (#139) 2022-11-02 15:14:51 +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
Discourse Translator Bot 1f9907d9e7 Update translations (#138) 2022-10-19 15:19:40 +02:00
Penar Musaraj 550e8347e3 DEV: Refactor bootbox dialogs (#137) 2022-10-17 14:42:40 -04:00
David Taylor c93be7632c DEV: Bump rubocop-discourse (#136) 2022-10-04 09:18:34 +01:00
Bianca Nenciu c00e539304 UX: Make styling consistent with everything else (#134) 2022-10-03 16:14:32 +03:00
Bianca Nenciu a58743e376 FIX: Simplify Stripe webhook handler (#135)
The 'customer.subscription.created' webhooks were not handled at all and
the logic was overcomplicated.
2022-10-03 13:33:50 +03:00
Angus McLeod aba86e5e25 FIX: Promo code placeholder (#133) 2022-09-23 10:37:28 +02:00
Discourse Translator Bot 827f9df444 Update translations (#132) 2022-09-20 15:52:53 +02:00
Penar Musaraj 39b7253c08 DEV: Refactor payment plan buttons (#131) 2022-09-14 18:32:22 -04:00
Blake Erickson a78b92ddcc FEATURE: Add quick access button to user profile dropdown (#130) 2022-08-10 13:05:54 +01:00
Discourse Translator Bot e48b817e8e Update translations (#128) 2022-07-12 17:26:08 +02:00
Faizaan GaganandBlake Erickson 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 <[email protected]>
2022-07-05 19:53:27 -06:00
David Taylor d4d92d9653 DEV: Use closure actions (#127) 2022-07-06 00:20:12 +01:00
Faizaan Gagan 392b88265b FIX: set Discourse consistent styles on Stripe card element (#124)
* FIX: set Discourse consistent styles on Stripe card element

* use correct placeholder color

* applied prettier

* mock update method for cardElement

* minor formatting
2022-06-24 21:18:38 +05:30
Blake Erickson 8762d6742e FIX: Import script confirmation flag logic (#126)
The import script has a prompt asking if this is a "procourse" import or
not, but the logic for handling the answer is backwards and will
incorrectly set the `procourse_import` flag to `true`.

This commit also fixes a minor typo.
2022-06-22 17:51:14 -06:00
Discourse Translator Bot 353898a6b4 Update translations (#125) 2022-06-21 15:29:16 +02:00
discoursebotanddiscoursebuild 97caad7205 DEV: Update CI workflows (#122)
Co-authored-by: discoursebuild <[email protected]>
2022-06-17 22:22:31 +02:00
9a9b5a79c1 DEV: Update CI setup and fix linting issues (#119)
* DEV: Update CI workflows
* DEV: Update deps
* DEV: Fix template linting

Co-authored-by: discoursebuild <[email protected]>
Co-authored-by: Jarek Radosz <[email protected]>
2022-06-11 12:54:30 +02:00
Blake Erickson 46759c90cd FIX: Duplicate payments showing up in discourse UI (#118)
Duplicate payments were showing up in the discourse ui for users. Actual
transactions in stripe were not being duplicated. This fix ensures that
when parsing the api response we don't append any duplicates. Added a
duplicate entry to the specs to test for this.

I do think there can be some improvements made to this controller
endpoint, but I'd like to save those for a different and larger PR and
just get this fix out first.
2022-05-17 09:22:42 -06:00
dependabot[bot] 4a27a93e8d Bump async from 2.6.3 to 2.6.4 (#117)
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: async
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-29 18:03:56 +02:00
dependabot[bot] 386d413bf1 Bump minimist from 1.2.5 to 1.2.6 (#116)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-13 19:36:59 +02:00
discoursebotanddiscoursebuild c4093e6820 DEV: Update CI workflows (#115)
Co-authored-by: discoursebuild <[email protected]>
2022-03-22 14:06:27 +01:00
Jarek Radosz 044c18e904 DEV: Fix more imports (#114) 2022-03-07 14:34:05 +01:00
discoursebotanddiscoursebuild 9cbdc8c453 DEV: Update CI workflows (#107)
Co-authored-by: discoursebuild <[email protected]>
2022-03-07 00:30:12 +01: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
David Taylor fa490337ef FIX: Ensure sidebar class is removed when component destroyed (#111) 2022-02-28 11:51:29 +00:00
Gavin 46e0a2aa46 DEV: Update README.md (#109) 2022-02-21 21:04:40 +01:00
Gavin ba6f549f1c DEV: Update README.md (#110) 2022-02-21 20:55:41 +01:00
Vinoth Kannan 6f70af5e42 DEV: execute campaign refresh job only if stripe is configured. (#108) 2022-02-04 11:06:40 +05:30
Discourse Translator Bot 23d5697be4 Update translations (#106) 2022-01-18 14:43:12 +01:00
Discourse Translator Bot f414acee42 Update translations (#104) 2022-01-11 14:23:20 +01:00
Andrei Prigorshnev 45780a1ebc DEV: migrate routes to the new @action pattern (#102) 2022-01-06 15:32:09 +04:00
Discourse Translator Bot 9256a45c2a Update translations (#103) 2022-01-04 17:40:05 +01:00
Discourse Translator Bot 9cf257d6a7 Update translations (#101) 2021-12-28 14:14:38 +01:00
Discourse Translator Bot 306aa0bcca Update translations (#100) 2021-12-17 11:00:50 -07:00
Kim Miller 2c8c04c109 - Subscriptions import Procourse support (#89)
- Stripe pagination support
2021-12-17 11:00:19 -07:00
discoursebotandCvX 74923d01b1 DEV: Update CI workflows (#99)
Co-authored-by: CvX <[email protected]>
2021-12-16 18:06:07 +00:00
Discourse Translator Bot 11de2a6455 Update translations (#98) 2021-12-14 16:53:32 -07:00
Blake Erickson afe6c10452 FIX: html strong tags showing (#97)
We need to use the `html-safe` helper here so to that the html tags in
the translation template are rendered correctly.

See: https://meta.discourse.org/t/211376
2021-12-09 13:30:45 -07:00
Blake Erickson 23bfa1b567 FIX: Exclude blocked charges in campaign total (#96)
The campaign total should only include payments that have succeeded.

See: https://meta.discourse.org/t/209591/14
2021-11-25 08:11:52 -07:00
Blake Erickson c6c5ed2ed3 FIX: Include one-time purchases in campaign total (#95)
* FIX: Include one-time purchases in campaign total

On the subscription banner that shows on the top of the forum it shows
the total amount raised toward a goal. But the amount shown was not
including one-time purchases. It was only showing subscriptions.

This change updates the sync with stripe logic so that it also includes
one-time purchases.

See: https://meta.discourse.org/t/-/209591

* rubocop: remove extra blank line
2021-11-22 12:46:40 -07:00
Blake Erickson 4f2af3b01a FIX: 500 error when editing a pricing plan (#94)
`.dig` isn't valid for stripe objects. This commit fixes this 500 error
you get when trying to edit a pricing plan:

```
NoMethodError (undefined method `dig' for #<Stripe::Price:0x....)
```
2021-11-12 16:20:16 -07:00
Martin Brennan e8621cf5d1 DEV: Update code for eslint object-shorthand-rule (#93)
See https://github.com/discourse/eslint-config-discourse/commit/4f7aba06c03fdd22bb26669aeb8ed4af3127c409
2021-11-10 12:00:39 +11:00
Vinoth Kannan 33008b0b47 DEV: use existing customer id instead of creating. (#92)
Previosuly, new customer record is created in Stripe for each subscription in Discourse.
2021-10-08 09:40:16 +05:30
Vinoth KannanandJarek Radosz 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 <[email protected]>
2021-09-21 18:12:17 +05:30
discoursebotandCvX 6052366472 DEV: Update CI workflows (#90)
Co-authored-by: CvX <[email protected]>
2021-09-15 19:54:13 +02:00
dependabot[bot] 6e96f07378 Bump path-parse from 1.0.6 to 1.0.7 (#87)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 00:51:37 +02:00
Justin DiRose 5ead25feb6 REFACTOR: Rename s to subscribe (#86) 2021-07-19 19:56:19 -05:00
Justin DiRose 6414a1f6e5 FEATURE: Show/hide campaign banner with goal status (#85) 2021-07-15 15:05:27 -05:00
Jarek Radosz ef21e3da58 DEV: Restore gems in .gitignore (#84) 2021-07-05 12:10:20 +02:00
Jarek Radosz 21d71e09fc DEV: Fix linting errors (#83)
Template lint errors and broken rubocop linting.
2021-07-04 21:53:55 +02:00
discoursebotanddavidtaylorhq 03aec5a44a DEV: Update CI workflows (#52)
Co-authored-by: davidtaylorhq <[email protected]>
2021-07-04 20:49:19 +02:00
Penar Musaraj 1c104da947 DEV: Use CSS custom properties for colors (#82) 2021-06-24 09:19:56 -04:00
Justin DiRose d660149ad2 UX: Hide campaign button on goal completion (#81) 2021-06-22 11:26:28 -05:00
Justin DiRose eee1adc40f FIX: New user sessions redirected weirdly on login-required sites (#80) 2021-06-22 10:04:02 -05:00
haroldus- 0b2c8bd513 fix strong (#78) 2021-06-22 09:22:35 -05:00
Discourse Translator Bot b4bc5ef3e2 Update translations (#79) 2021-06-22 15:18:09 +02:00
Jordan Vidrine beb73b58f3 FEATURE: Add fireworks + gradient animation to campaign success banner (#77) 2021-06-21 09:01:35 -05:00
Jordan Vidrine 787c5550c6 FEATURE: Add ability to use custom background image (#76)
* FEATURE: Add ability to use custom background image

* Prettier
2021-06-18 10:20:54 -05:00
Justin DiRose 8ab7a63167 FEATURE: Validate coupon codes on form submit (#74) 2021-06-16 12:54:54 -05:00
Discourse Translator Bot 5f9a84242b Update translations (#75) 2021-06-15 15:59:45 +02:00
dependabot[bot] 28148e2dda Bump glob-parent from 5.1.1 to 5.1.2 (#73)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-12 13:57:52 +02:00
Jordan Vidrine a4f36e4966 Campaign topic footer (#72)
* UX: Restyle banner, add topic footer functionality, other updates
2021-06-10 16:02:54 -05:00
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 791c7fa7a5 UX: Improve mobile campaign flow (#69)
1. Improve mobile checkout styling

These are pretty simple changes. The buttons were crammed together and not wrapping properly on mobile if there were more than a few. Also the padding was weird and causing text to overflow out of the #main-outlet on phone viewports.
2. Renders the top campaign banner on mobile even if sidebar is selected

In the original PR, we refactored using the connector JS out since we now have more Ember operators; however, we needed some more complex logic that couldn't be done in the template. Basically, we choose which outlet to render the component in based on two criteria:

    If the setting is set to sidebar or top
    If we're on a mobile device

Previously, if the site showed the banner on the sidebar and the user browsed to mobile, they wouldn't see a banner at all. This PR changes the logic to use the top outlet on mobile, even if the sidebar is selected.
2021-06-08 12:52:29 -05:00
Discourse Translator Bot 2d7807aeb3 Update translations (#71) 2021-06-08 16:30:55 +02:00
Justin DiRoseandJordan Vidrine f596a0f78a FEATURE: Campaigns (#67)
Co-authored-by: Jordan Vidrine <[email protected]>

See https://github.com/discourse/discourse-subscriptions/pull/67 for the full description.
2021-06-02 13:15:03 -05:00
Discourse Translator Bot dcec7703f8 Update translations (#68) 2021-06-01 15:10:10 +02:00
Jay Pfaffman 3fb597a4cf FIX: Don't use Discourse global (#66)
Discourse.SiteSettings should be this.siteSettings.
2021-05-26 21:33:31 +02:00
haroldus- ccd9454da8 FIX: Allow more than 10 Stripe records (#62) 2021-05-22 20:30:09 -05:00
dependabot[bot] d83425872f Bump lodash from 4.17.20 to 4.17.21 (#65)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 13:41:45 -04:00
dependabot[bot] 916e2f01ce Bump handlebars from 4.7.6 to 4.7.7 (#64)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 10:49:04 +10:00
dependabot[bot] 8abcf34858 Bump rexml from 3.2.4 to 3.2.5 (#63)
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.4...v3.2.5)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-02 17:10:56 +02: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
dependabot[bot] f1dd035ec1 Bump y18n from 4.0.0 to 4.0.1 (#59)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-01 10:04:40 +02:00
Discourse Translator Bot 252a11ed15 Update translations (#58) 2021-03-23 16:07:51 +01:00
Justin DiRose 7f84cee940 UX: Improve usability of purchase page (#54)
Commit does 3 things:

    Remove the duplicative currency abbreviation in favor of the currency symbol alone
    Reorders plans by the cost in ascending order.
    Fixes a flexbox button bug
2021-02-16 12:07:53 -06:00
Justin DiRose 0126b12761 DEV: Remove unused CSS selector (#55) 2021-02-16 11:54:21 -06:00
Discourse Translator Bot 13c3fbdf44 Update translations (#56) 2021-02-16 15:22:44 +01:00
Justin DiRose ab9b81471b UX: Adjust repurchase styles to look better (#53)
Suggested here: https://meta.discourse.org/t/subscriptions-suggestions-for-interface-improvements/177970

Changes order and alignment so it makes a bit more sense in the UX of the /s route. Otherwise it looks too cluttered. This specifically impacted products that can be repurchased.
2021-02-15 15:17:45 -06:00
Discourse Translator Bot cab037574c Update translations (#51) 2021-02-09 14:46:37 +01: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
Discourse Translator Bot eaf1729f6f Update translations (#49) 2021-02-02 14:37:20 +01: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
Joffrey JAFFEUX 3f8fca3246 DEV: prettier 2.2.1 (#48) 2021-01-27 10:38:33 +01:00
Discourse Translator Bot 49c49fe36e Update translations (#47) 2021-01-26 14:48:14 +01:00
Discourse Translator Bot 1c298d8fa4 Update translations (#45) 2021-01-19 15:47:39 +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
Discourse Translator Bot a6de862ba9 Update translations (#42) 2021-01-12 14:27:02 +01: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 70b96cf3b8 FIX: Properly show one time payments in user billing (#40)
Encountered a bug where some one time payments were not showing under User > Billing > Payments. This was due to a simple error in the logic
2021-01-06 14:01:16 -06:00
Justin DiRose b6de4a7b67 DEV: Bump Stripe API gem to 5.29.0 (#38)
Bumping the API gem to 5.29.0 and to the latest API version. This takes into account changes in the API over the last few months and also lays the groundwork for some other improvements to the plugin (namely promo codes).
2021-01-06 13:36:50 -06:00
8036dba315 DEV: Update CI workflows (#36)
* DEV: Update CI workflows
* DEV: Fix linting

Co-authored-by: Justin DiRose <[email protected]>
Co-authored-by: Jarek Radosz <[email protected]>
2021-01-05 01:08:58 +01:00
Roman Rizzi 088b8d2239 REFACTOR: Use the new format for acceptance tests. (#37) 2021-01-04 16:32:33 -03:00
Discourse Translator Bot 0b5f740db5 Update translations (#35) 2020-12-01 14:33:30 +01: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
Discourse Translator Bot 52817018aa Update translations (#32) 2020-11-24 17:21:39 +01:00
Discourse Translator Bot e2485b58a1 Update translations (#31) 2020-11-03 18:06:40 +01:00
Justin DiRose 17bd58afa4 DEV: CI Updates (#30) 2020-11-02 11:57:36 -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
Discourse Translator Bot 8ffe769ca9 Update translations 2020-10-27 15:34:26 +01: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 3428429d77 DEV: Remove Travis CI 2020-10-20 11:29:15 -05:00
Justin DiRose 86c8daf693 DEV: Ignore foreign key migration in rubocop
We don't want foreign keys in migrations going forward as they can be
expensive for large tables. However, we shouldn't be changing old
migrations, so we're having rubocop ignore it in this plugin for now.
2020-10-20 11:27:32 -05:00
Discourse Translator Bot 0bae17dcb6 Update translations 2020-10-20 15:31:51 +02: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
Discourse Translator Bot 866e485c1c Update translations 2020-10-06 15:16:49 +02:00
Discourse Translator Bot 60b6181f0e Update translations 2020-09-29 13:03:03 +00:00
Discourse Translator Bot 99758a256e Update translations 2020-09-22 13:06:48 +00: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
Discourse Translator Bot 8022b3c15a Update translations 2020-09-16 10:20:57 +00:00
Discourse Translator Bot aef967192d Update translations 2020-09-15 13:07:07 +00:00
Justin DiRose 9f914c7793 DEV: run prettier 2020-09-01 20:35:53 -05:00
Justin DiRose bd5d9fc289 DEV: Fix gemfile 2020-09-01 20:33:29 -05:00
Justin DiRose 064000b7bc DEV: Set up dependencies for workflows 2020-09-01 20:31:38 -05:00
Justin DiRose c3a0eb6fe5 DEV: Add GitHub Actions for linting/testing 2020-09-01 20:25:44 -05:00
Discourse Translator Bot 772de6ff10 Update translations 2020-08-25 13:03:24 +00:00
Justin DiRose 6ce6e85ef4 Make rubocop happy 2020-08-19 15:11:16 -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
Discourse Translator Bot 91824dcdae Update translations 2020-08-18 13:04:16 +00:00
Discourse Translator Bot 484fc1eb2f Update translations 2020-08-11 13:06:23 +00:00
Discourse Translator Bot cc1e11850d Update translations 2020-08-05 13:30:17 +00: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 9e66588038 FIX: Missing translation for daily subscriptions 2020-07-27 10:37:41 -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
Discourse Translator Bot fcc90e4fcc DEV: Switch from Transifex to Crowdin 2020-07-16 14:01:25 +02: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 3e6d8734de FIX: Properly namespace payment serializer (#15) 2020-07-06 15:19:45 -05:00
Justin DiRose fb4f50478d REFACTOR: Use engine to load files, add constraint (#14) 2020-07-06 11:11:04 -05:00
Justin DiRose 8c670328b7 DEV: Add translations support 2020-07-03 11:17:13 -05:00
Justin DiRose 88f36c18a6 FEATURE: Add BRL currency support 2020-06-30 10:13:05 -05:00
Justin DiRose 4830468e32 DEV: Fixes for rubocop 2020-06-09 12:37:46 -05:00
Justin DiRose c30daa1b86 FIX: Couldn't dig the payments 2020-06-09 12:26:31 -05:00
Justin DiRose 029232e881 FIX: Stripe returned limited number of plans 2020-06-09 12:06:46 -05:00
Justin DiRose 892c889c31 FIX: Products & Subscriptions returned blank 2020-06-08 15:09:41 -05:00
Justin DiRose d360a4155d DEV: Fix tests after changes to controllers 2020-05-28 11:45:58 -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
Rishabh 3d9fe5fdce Update README.md & plugin.rb after moving to /discourse 2020-04-29 16:27:17 +05:30
Rishabh 071c72419c Update README.md 2020-04-29 16:15:46 +05:30
Rimian Perkins 83b75ab771 Merge pull request #9 from StarWar/feature/inr-currency
Feature/inr currency: INR added to supported currencies
2020-04-27 19:24:29 +10:00
Rimian Perkins 69af94b31f upgrade stripe gem 2020-04-27 19:22:23 +10: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 40a390c3eb merge remote-tracking branch 'upstream/master' 2020-04-23 15:42:13 +05:30
Rimian Perkins 31a6e570bc Merge pull request #7 from SidVal/patch-1
Spanish Translations
2020-04-21 21:33:34 +10:00
SidV b2931cacb1 Create client.es.yml 2020-04-20 22:23:36 -03:00
SidV 4dbfb232eb Create server.es.yml 2020-04-20 22:01:41 -03:00
Raj Rathore f91b257198 feat(currency-inr): inr added to supported currencies 2020-04-16 01:57:56 +05:30
Rimian Perkins 125cdab24e add NZ dollar 2020-03-31 09:46:56 +11:00
Rimian Perkins 755f2d5c46 Merge pull request #4 from iunctis/master
French version
2020-03-27 13:42:50 +11:00
Rimian Perkins 77b5567090 Merge pull request #3 from rimian/fix-disable-billing-interval
disable billing interval when cannot change
2020-03-21 20:36:00 +11:00
Rimian Perkins 39564ea779 bump 2020-03-21 20:35:05 +11:00
Rimian Perkins 48c606908a disable billing interval when cannot change 2020-03-21 20:30:30 +11:00
Rimian Perkins 22a1a5fcac Merge branch 'master' of github.com:rimian/discourse-subscriptions 2020-03-20 10:35:20 +11:00
Rimian Perkins 4ed5d163dd upgrade stripe gem 2020-03-20 10:30:32 +11:00
iunctis.fr c82f1ce141 Améliorations
Sur la page de paiement
2020-03-16 01:16:11 +01:00
iunctis.fr ced756c0fb Create server.fr.yml 2020-03-16 00:31:04 +01:00
iunctis.fr 5def8b4002 Create client.fr.yml 2020-03-16 00:30:14 +01:00
Rimian Perkins c1d0cf3741 Update README.md 2020-02-06 15:12:29 +11:00
Rimian Perkins c2106bc94c broken url 2020-02-06 15:09:52 +11:00
Rimian Perkins 55e03aca8d move the warranty stuff into a file 2020-02-06 15:07:14 +11:00
Rimian Perkins 60847db997 fix up links yo 2020-02-06 15:00:41 +11:00
Rimian Perkins c8172b265a Update README.md 2020-02-06 14:50:22 +11:00
Rimian Perkins c1b198dfb2 Update README.md 2020-02-06 12:45:29 +11:00
Rimian Perkins 087b432203 Update README.md 2020-02-06 12:40:59 +11:00
Rimian Perkins 3376aac8dc Update README.md 2020-02-06 12:39:02 +11:00
Rimian Perkins e968d71309 Update README.md 2020-02-06 12:31:42 +11:00
Rimian Perkins b16e5e4a92 Update README.md 2020-02-06 12:21:14 +11:00
Rimian Perkins 083af76566 Update README.md 2020-02-06 12:20:32 +11:00
Rimian Perkins e86ffc5482 Update README.md 2020-02-06 10:39:32 +11:00
Rimian Perkins 26a3fdf75e Eine kleine dokumentation 2020-02-06 10:32:06 +11:00
Rimian Perkins 412fe9b6f8 move warranty downwards on readme 2020-02-06 09:55:01 +11:00
Rimian Perkins df17e1ed49 add settings screenshot 2020-02-06 09:52:13 +11:00
Rimian Perkins 16e6977ad6 Update README.md 2020-02-06 09:21:09 +11:00
Rimian Perkins 51a320089c Update README.md 2020-02-06 09:15:44 +11:00
Rimian Perkins 100a39a692 Set theme jekyll-theme-cayman 2020-01-31 11:24:33 +11:00
Rimian Perkins 333f9c694c Create FUNDING.yml 2020-01-31 11:19:54 +11:00
Rimian Perkins 81b8e868b7 small edit to link 2020-01-28 09:13:47 +11:00
Rimian Perkins ed9bbc90aa fix link 2020-01-28 09:12:55 +11:00
Rimian Perkins 1e62f698ee bump 2020-01-28 09:11:15 +11:00
Rimian Perkins 272f3eb998 webhook updates subscription 2020-01-26 11:53:56 +11:00
Rimian Perkins cc389d2423 add the user to the group if subscription is completing 2020-01-26 10:49:51 +11:00
Rimian Perkins ebe891c09b fix event hash for subscription 2020-01-25 15:06:05 +11:00
Rimian Perkins 3ec1907c1c upgrade stripe gem 2020-01-15 10:33:33 +11:00
Rimian Perkins 83e7ae2711 spec unsubscribe webhook 2020-01-15 10:20:21 +11:00
Rimian Perkins dca6c7ddc9 deletes the customer on subscription cancel 2020-01-14 23:38:26 +11:00
Rimian Perkins 190ca28089 rm subscription event 2020-01-14 20:58:34 +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 95413ee161 get the payload, signature and secret for webhook 2020-01-14 15:37:53 +11:00
Rimian Perkins 0543b3a6a3 basic hook 2020-01-13 11:10:06 +11:00
Rimian Perkins 0856381fbe skip authenticity check on hooks controller 2020-01-12 09:33:26 +11:00
Rimian Perkins ae36c00fc0 test buttons show 2020-01-12 09:08:00 +11:00
Rimian Perkins 9902947e99 a bit more testing 2020-01-10 16:47:28 +11:00
Rimian Perkins 7e2d4595ca test the payment and subscribe page 2020-01-10 14:41:32 +11:00
Rimian Perkins ba43e9d977 name space tests 2020-01-10 14:24:39 +11:00
Rimian Perkins 431279a4f7 Add empty webhook url and upgrade stripe gem 2020-01-10 10:24:09 +11:00
Rimian Perkins 7f4fb2a503 upgrade stripe gem 2020-01-10 09:59:42 +11:00
Rimian Perkins 330e6f6a2d bump with ux changes 2019-12-18 09:10:14 +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 a09abb4a29 update some images 2019-12-17 19:49:08 +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 fcfd2be41b create a customer when a payment happens 2019-12-17 10:03:00 +11:00
Rimian Perkins 92f6569f9f fix broken paths 2019-12-16 14:10:25 +11:00
Rimian Perkins 38c444c489 tidy scss a bit 2019-12-16 13:59:58 +11:00
Rimian Perkins f21891453b rm removed file reference 2019-12-16 11:09:43 +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
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 a14d26f186 bump with ux change on payment page 2019-12-12 10:09:16 +11:00
Rimian Perkins 41b0667350 fix rubocop newer version 2019-12-12 09:59:38 +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 1c31884475 show the plans in the buttons proper 2019-12-09 12:01:10 +11:00
Rimian Perkins 71d6c6dab2 display the plan in the plan buttons 2019-12-09 10:30:34 +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
Rimian Perkins 2c1eb9b22b bumpus 2019-12-05 17:20:43 +11:00
Rimian Perkins e3d2ac0101 rm old migrations 2019-12-05 17:11:05 +11:00
Rimian Perkins 09bfe419d8 set new product inactive by default 2019-12-05 17:07:26 +11:00
Rimian Perkins e1706ac099 update subscription data 2019-12-05 15:17:06 +11:00
Rimian Perkins 7db60e2c4b tidy up the user subscription list 2019-12-05 14:59:07 +11:00
Rimian Perkins 42b79fdaaa bump and upgrade api 2019-12-05 10:29:26 +11:00
Rimian Perkins 80b721ddd8 rename some settings 2019-12-04 11:53:05 +11:00
Rimian Perkins b397ba5a68 name space module 2019-12-04 11:23:45 +11:00
Rimian Perkins 0b908e4da8 rename engine file 2019-12-04 09:44:20 +11:00
Rimian Perkins 49591130a5 wrapping with longer names 2019-12-04 09:35:07 +11:00
Rimian Perkins 95a263535e rename server translation 2019-12-04 09:33:39 +11:00
Rimian Perkins 21b8340f4f rename the translations 2019-12-04 09:29:13 +11:00
Rimian Perkins d8a3ae5554 fix broken unauthenticated page 2019-12-03 14:31:15 +11:00
Rimian Perkins 56b73139d1 fix pricing plan screenshot 2019-12-03 14:08:51 +11:00
Rimian Perkins 5804f7c882 update single product screenshot 2019-12-03 14:06:40 +11:00
Rimian Perkins a248294c0b update admin products image 2019-12-03 14:02:10 +11:00
Rimian Perkins e10af61f10 bump. table rename 2019-12-03 13:39:28 +11:00
Rimian Perkins e1506bca5f fix table name 2019-12-03 13:29:47 +11:00
Rimian Perkins 29cc54b3c0 whoops forgot this again 2019-12-03 13:11:29 +11:00
Rimian Perkins bdba7686d3 add new table 2019-12-03 13:03:10 +11:00
Rimian Perkins 6d71d26574 rename assets 2019-12-03 11:51:18 +11:00
Rimian Perkins a95c119bcf fix paths in request specs 2019-12-03 11:48:12 +11:00
Rimian Perkins 949e32e4fb fix path to fabricators 2019-12-03 11:01:44 +11:00
Rimian Perkins ce600eec04 fix broken paths 2019-12-03 11:00:03 +11:00
Rimian Perkins ccb6e5fcbd prettier does not like line lengths 2019-12-03 10:52:46 +11:00
Rimian Perkins a21812e886 typos! 2019-12-03 10:34:25 +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 274fd0c518 readme edits 2019-12-02 11:28:55 +11:00
Rimian Perkins b1db6e7a4c set currency 2019-11-30 17:44:16 +11:00
Rimian Perkins 57a18f5a4e whoops did not set currency 2019-11-30 17:24:49 +11:00
Rimian Perkins 325ca5d7b3 bumpus with currency select in plan 2019-11-30 17:07:52 +11:00
Rimian Perkins a371d2baf6 fix broke test 2019-11-30 16:55:24 +11:00
Rimian Perkins 8afae3f3f2 fx prettier 2019-11-30 16:46:38 +11:00
Rimian Perkins 709aebb593 set the currency in the plan 2019-11-30 16:39:28 +11:00
Rimian Perkins 1671d00ffe proper screenshot 2019-11-30 12:11:53 +11:00
Rimian Perkins 96c8322a49 upgrade screenshot 2019-11-30 12:09:40 +11:00
Rimian Perkins 66051b35fc bump. done for card css 2019-11-29 15:54:41 +11:00
Rimian Perkins b4429e4473 rm extra line prettier is complaining about 2019-11-29 15:26:33 +11:00
Rimian Perkins 947ec4338e css the card 2019-11-29 15:08:51 +11:00
Rimian Perkins dc42a057aa fix remove from groups 2019-11-29 12:16:27 +11:00
Rimian Perkins 3b7ff90672 user removed from the group in admin 2019-11-29 10:37:32 +11:00
Rimian Perkins 7580b68711 rm extra line in product page 2019-11-29 10:16:00 +11:00
Rimian Perkins 36865c5ea1 remove the user from the group in user controller 2019-11-29 09:24:56 +11:00
Rimian Perkins 3904310432 group concern 2019-11-29 09:01:56 +11:00
Rimian Perkins ad77fc749b test subcription deletes 2019-11-29 08:15:46 +11:00
Rimian Perkins 2eab43d4a0 delete customer when subscription destroyed 2019-11-29 08:00:13 +11:00
Rimian Perkins 298e70b32a delete customer record 2019-11-28 20:44:38 +11:00
Rimian Perkins e5753095d8 cannot subscribe to a product twice 2019-11-28 20:11:48 +11:00
Rimian Perkins 1429bf116f rubocop 2019-11-28 19:51:03 +11:00
Rimian Perkins 0fddb5e3b9 backend returns if user is already subscribed 2019-11-28 17:43:03 +11:00
Rimian Perkins c7dcc18923 Bump stripe gem 2019-11-27 10:50:06 +11:00
Rimian Perkins ca00b530aa show the product name in subscription lists 2019-11-27 10:48:30 +11:00
Rimian Perkins 3e4fd76891 show product and plan nickname in admin 2019-11-26 12:55:49 +11:00
Rimian Perkins 7340bf5bc5 fix customer id not found 2019-11-26 11:09:54 +11:00
Rimian Perkins 22d5e6f7a0 docs 2019-11-19 15:27:26 +11:00
Rimian Perkins 81a60e58cc more docs 2019-11-19 15:21:12 +11:00
Rimian Perkins fc8b3cbe21 whoops forgot a screenshot 2019-11-19 15:02:19 +11:00
Rimian Perkins ba0d554f49 more screenshots 2019-11-19 15:01:21 +11:00
Rimian Perkins 6d6b4d75bb docs 2019-11-19 14:40:07 +11:00
Rimian Perkins f78e5598d3 Screenshoths 2019-11-19 14:37:07 +11:00
Rimian Perkins 90bb22183b Merge branch 'master' of github.com:rimian/discourse-patrons 2019-11-19 14:31:30 +11:00
Rimian Perkins 6eb4cda27f add admin screenshots 2019-11-19 14:30:11 +11:00
Rimian Perkins 7e94a35c20 linkus 2019-11-19 12:56:30 +11:00
Rimian Perkins fdf5488fbf docs 2019-11-19 11:52:09 +11:00
Rimian Perkins c15a3352a0 docs 2019-11-19 11:36:36 +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 c79d515cd0 typos 2019-11-19 10:12:40 +11:00
Rimian Perkins 44802975d7 docs 2019-11-19 10:10:41 +11:00
Rimian Perkins 00d94253f0 documentation 2019-11-19 09:59:15 +11:00
Rimian Perkins 9626a4fbfa Describe products and plans 2019-11-19 09:37:49 +11:00
Rimian Perkins 423abc8761 bump with spinners 2019-11-14 14:34:28 +11:00
Rimian Perkins b3b7d88481 spinner on subscription cancel 2019-11-14 14:07:45 +11:00
Rimian Perkins d9b5aa6a35 loading on subscription page 2019-11-14 13:43:18 +11:00
Rimian Perkins e4093e5a69 fix null delete subscription error 2019-11-14 12:07:24 +11:00
Rimian Perkins 533dc943d3 bump with auth on subscribe page 2019-11-14 11:23:06 +11:00
Rimian Perkins 3999e1f7fd style the product page a bit 2019-11-14 11:13:12 +11:00
Rimian Perkins 399dca953a Merge branch 'feature/logged-in-subscribe-page' of github.com:rimian/discourse-patrons into feature/logged-in-subscribe-page 2019-11-14 10:51:27 +11:00
Rimian Perkins 6590d8051c delete subscriptions in admin 2019-11-14 10:51:04 +11:00
Rimian Perkins 370566b570 only show subscribe buttons when logged in 2019-11-14 09:47:15 +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 91d9d12371 bump version. subscription metadata 2019-11-13 10:31:45 +11:00
Rimian Perkins 75e077399b Merge branch 'feature/logged-in-subscribe-page' of github.com:rimian/discourse-patrons into feature/logged-in-subscribe-page 2019-11-13 10:20:00 +11:00
Rimian Perkins 84fd12a9a3 add user data to subscription metadata 2019-11-13 10:19:49 +11:00
Rimian Perkins e5ee7143ff problematic test 2019-11-13 08:36:38 +11:00
Rimian Perkins e654e13ff9 rubocop fix 2019-11-13 08:14:53 +11:00
Rimian Perkins 59638daad9 render error message when customer not found 2019-11-13 07:53:48 +11:00
Rimian Perkins 5153a9a634 fix rubocop 2019-11-12 12:56:35 +11:00
Rimian Perkins 608a778b05 upgrade stripe gem 2019-11-12 12:44:40 +11:00
Rimian Perkins b2c5842aa6 only delete the right subscription 2019-11-12 12:43:23 +11:00
Rimian Perkins 1734abc1b9 product pretender 2019-11-12 11:03:04 +11:00
Rimian Perkins d26a60a3e8 Merge pull request #2 from rimian/feature/subscriptions
Feature/subscriptions
2019-11-08 09:23:00 +11:00
Rimian Perkins 7c350b7881 fix broken merge. Doh! 2019-11-08 08:55:23 +11:00
Rimian Perkins bf47fbec86 merge and bump for release 2019-11-08 08:37:20 +11:00
Rimian Perkins d5e753c52a bump version for release 2019-11-08 08:34:22 +11:00
Rimian Perkins 0b90caac2d rm request to empty model 2019-11-07 15:49:10 +11:00
Rimian Perkins 1da6986d8f rm reference to deleted file 2019-11-07 15:27:22 +11:00
Rimian Perkins 1c7591cfb1 merge in master 2019-11-07 15:26:34 +11:00
Rimian Perkins 4743f1a159 upgrade stripe api and gem 2019-11-07 15:25:00 +11:00
Rimian Perkins 098b58c60c remove payments 2019-11-07 15:19:48 +11:00
Rimian Perkins bdb5883d6a enable 2019-11-07 15:14:52 +11:00
Rimian Perkins a4c1168e4f skip another 2019-11-07 15:07:04 +11:00
Rimian Perkins 5c13266e5b skip failing test 2019-11-07 14:58:39 +11:00
Rimian Perkins 59dd4deb76 file name extention wrong 2019-11-07 14:33:08 +11:00
Rimian Perkins b566c437c7 skip unfinished test 2019-11-07 13:17:54 +11:00
Rimian Perkins dafa08f43e disable dashboard 2019-11-07 12:09:40 +11:00
Rimian Perkins a7e8bf46bc add setting to test 2019-11-07 11:30:40 +11:00
Rimian Perkins 482ce178d5 pretty js 2019-11-06 20:59:35 +11:00
Rimian Perkins 78cbfc2652 rm unused arg 2019-11-06 20:51:16 +11:00
Rimian Perkins 3e87d5c896 upgrade api 2019-11-06 20:46: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 3dfa261c19 serialize and order the plans 2019-11-01 10:18:57 +11:00
Rimian Perkins 5fe08c110f format some currency 2019-10-31 14:35:19 +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 03cbc235b1 list customer subscriptions 2019-10-30 14:19:43 +11:00
Rimian Perkins 7963d6dea2 users can have more than one customer id 2019-10-30 11:22:40 +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 5a7097b774 billing/subscriptions 2019-10-28 14:48:59 +11:00
Rimian Perkins 87c83abcd3 add basic invoices page 2019-10-28 14:05:58 +11:00
Rimian Perkins b7a3be9344 add customer model spec and scope 2019-10-26 13:01:49 +11:00
Rimian Perkins dcb4b82dec customer model 2019-10-26 11:31:19 +11:00
Rimian Perkins 1f7549060d fix eslint and rubocop 2019-10-25 14:00:59 +11:00
Rimian Perkins 570ef2fbb4 use the billing page 2019-10-25 13:55:57 +11:00
Rimian Perkins 948399662d transition to billing after payment 2019-10-25 13:40:03 +11:00
Rimian Perkins edd6449105 basic user billing page 2019-10-25 13:23:32 +11:00
Rimian Perkins 9e981c3dae whoops translation 2019-10-25 13:18:18 +11:00
Rimian Perkins 4d2d98037a fix paths to translations 2019-10-25 11:13:14 +11:00
Rimian Perkins 6fbcea2cf3 product controller 2019-10-25 08:18:16 +11:00
Rimian Perkins 5f71def8a4 format the select dropdowns for plans 2019-10-24 16:51:58 +11:00
Rimian Perkins 21b27f169a show a bootbox message instead of console log 2019-10-24 16:37:14 +11:00
Rimian Perkins eead6fd345 user group specs. help page 2019-10-24 15:48:03 +11:00
Rimian Perkins 8650e6c236 user cannot be added to admins 2019-10-24 11:52:31 +11:00
Rimian Perkins a80e9d9bc2 add subscription to group 2019-10-24 11:37:20 +11:00
Rimian Perkins 490c424bc0 only list active plans on the front end 2019-10-24 10:39:10 +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 bb1e330f68 eslint rm & old files 2019-10-23 10:36:12 +11:00
Rimian Perkins fb37c200cd more info on subscription page 2019-10-23 10:30:04 +11:00
Rimian Perkins c6bf9ca4d3 fix trial period 2019-10-23 10:16:17 +11:00
Rimian Perkins 296d5eff1b destroy plan 2019-10-22 19:32:36 +11:00
Rimian Perkins 5cce5f2b84 format dates for plan and product list 2019-10-22 16:35:41 +11:00
Rimian Perkins c26ce1fc80 plans are child of product 2019-10-22 15:45:51 +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 2dbcda49c3 upgrade to klatest api 2019-10-21 12:01:34 +11:00
Rimian Perkins 0d4cd5b1e5 add nested route 2019-10-21 09:47:18 +11:00
Rimian Perkins a914d4ee59 this route in case it is entered in the browser 2019-10-18 11:54:49 +11:00
Rimian Perkins b05b03e25b fix up forms and requests to plan api 2019-10-17 20:34:26 +11:00
Rimian Perkins 95a23eafd1 master upgrade 2019-10-17 12:12:41 +11:00
Rimian Perkins 7e5d92e0e8 upgrade api and gem 2019-10-17 12:08:48 +11:00
Rimian Perkins e2b915b905 plans and products 2019-10-17 12:07:06 +11:00
Rimian Perkins 01b78b31df subscriptions list 2019-10-16 21:29:40 +11:00
Rimian Perkins c845f3be4b form fields 2019-10-16 21:18:29 +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 e2f1f0f523 destroy plans 2019-10-16 11:22:58 +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 b727347b6c basic plans form 2019-10-15 09:40:49 +11:00
Rimian Perkins 892478ab57 initial product pages 2019-10-14 15:39:24 +11:00
Rimian Perkins c6dcff5c06 redirect to group landing page on success 2019-10-14 13:54:46 +11:00
Rimian Perkins 16513e29ea list plans in admin 2019-10-14 12:36:46 +11:00
Rimian Perkins 4e615908f4 create the subscription 2019-10-14 11:47:49 +11:00
Rimian Perkins 51a0820397 upgrade stripe 2019-10-14 10:20:35 +11:00
Rimian Perkins bab76db863 subscriptions controller 2019-10-14 09:52:43 +11:00
Rimian Perkins fcfb826929 create the token and make the customer request 2019-10-11 12:26:01 +11:00
Rimian Perkins f61f756d9c fix broken subscribe page test 2019-10-10 14:18:44 +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
Rimian Perkins 2c6944e66e stub stripe and add pretender 2019-10-09 11:53:58 +11:00
Rimian Perkins bde208ecb6 merge in master 2019-10-09 09:11:02 +11:00
Rimian Perkins 829199ffb2 form not rendering 2019-10-09 09:06:12 +11:00
Rimian Perkins 0a6ade7ab9 stylin, translations 2019-10-08 22:26:58 +11:00
Rimian Perkins 8d24ff455e have a dash board page 2019-10-08 21:59:20 +11:00
Rimian Perkins 19a03aa2ca plan model with destroy and find 2019-10-08 19:37:22 +11:00
Rimian Perkins 6f9195a7d4 Create Plans
* rescue and respond to error from stripe
* save plan name and id
2019-10-08 15:55:38 +11:00
Rimian Perkins 99abd87c73 rm dup title; use nav items 2019-10-08 12:17:47 +11:00
Rimian Perkins 6fd1638a15 add missing translation 2019-10-08 11:56:39 +11:00
Rimian Perkins 48af25b707 merge master 2019-10-08 11:48:31 +11:00
Rimian Perkins 40924d0e98 Merge pull request #1 from rimian/fix/hide-disabled
Hide disabled
2019-10-08 11:46:30 +11:00
Rimian Perkins 89e53744ed Hide disabled
* Do not show the form if the plugin is disabled
* Upgrade Stripe Gem
2019-10-08 11:36:48 +11:00
Rimian Perkins bee940e672 url for edit 2019-09-27 09:42:32 +10:00
Rimian Perkins 9d982307d5 filter by deleted 2019-09-25 13:39:23 +10: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 bfdc8a5691 spec the plans 2019-09-24 20:57:42 +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 dfef3c49cf initial templates and routes 2019-09-24 15:20:07 +10:00
Rimian Perkins 308c8ea771 initial templates and routes 2019-09-24 15:18:58 +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 8b61747fbd FEATURE: Upgrades, translations
* Name space the translations for extensibilty
* Upgrade the Stripe Gem
* Correct the plugin version in the Stripe setup info
2019-09-23 12:04:30 +10:00
Rimian Perkins 9e2d3551e0 rubocop --fix does not pick this up 2019-09-15 22:11:39 +10:00
Rimian Perkins 910e08e4c9 flip ordering 2019-09-15 22:03:42 +10:00
Rimian Perkins 18cf0e7f26 FIX: ordering
* Fix broken user id
* ascending/descending
2019-09-15 21:44:10 +10:00
Rimian Perkins ca62cad04e order the payments in admin 2019-09-15 21:00:39 +10:00
Rimian Perkins 85a90b091c rm redundant brackets 2019-09-15 12:34:36 +10:00
Rimian Perkins a42e98ee5b error for user not permitted 2019-09-15 08:40:52 +10:00
Rimian Perkins bc8ae3449d send the customer to the payment api 2019-09-14 21:00:56 +10:00
Rimian Perkins ad5961a4c5 show the payment on the thankyou page 2019-09-14 20:54:13 +10:00
Rimian Perkins 5d94ed8974 redirect to show page with payment id 2019-09-14 18:31:11 +10:00
Rimian Perkins b77c211a71 request index url not show 2019-09-14 18:21:43 +10:00
Rimian Perkins 1c89252918 render some json 2019-09-14 18:17:45 +10:00
Rimian Perkins d100de9d19 name not email 2019-09-14 17:56:37 +10:00
Rimian Perkins 871cec9ec3 pretty js 2019-09-14 17:28:58 +10:00
Rimian Perkins 059acbdbb8 fix attributes booboo 2019-09-14 17:16:09 +10:00
Rimian Perkins 813937dd22 intial load more 2019-09-14 17:04:02 +10:00
Rimian Perkins 0b8b89f1d4 link username 2019-09-14 16:53:07 +10:00
Rimian Perkins cf46065635 show username 2019-09-14 16:34:51 +10:00
Rimian Perkins 9631ddc7e5 format currency and user 2019-09-14 15:55:25 +10:00
Rimian Perkins 5c33268477 created at and url 2019-09-14 14:20:16 +10:00
Rimian Perkins 6fe149c4a5 basic admin interface 2019-09-14 12:56:28 +10:00
Rimian Perkins 8f4cb95cb5 string for payment intent id 2019-09-13 22:20:29 +10:00
Rimian Perkins b34e7ade8c a payment model is created 2019-09-13 22:03:29 +10:00
Rimian Perkins c1f1bc4ee4 comment out for now 2019-09-13 14:36:25 +10:00
Rimian Perkins d09f654b3e add migration 2019-09-13 14:35:13 +10:00
Rimian Perkins c90d4b2f8e fix params 2019-09-13 14:34:06 +10:00
Rimian Perkins 4287e8aa5d load model 2019-09-13 13:52:41 +10:00
Rimian Perkins 404bede398 fix snake case 2019-09-13 13:46:32 +10:00
Rimian Perkins 68b4d07a94 fix jslint and some settings 2019-09-13 13:02:28 +10:00
Rimian Perkins 7f7bd52552 return empty email if not current user 2019-09-13 12:58:17 +10:00
Rimian Perkins 63ea563553 Set the user email initially in stripe form 2019-09-13 12:56:26 +10:00
Rimian Perkins 2a1d4702fa Merge branch 'master' of github.com:rimian/discourse-patrons 2019-09-13 12:35:55 +10:00
Rimian Perkins cb9af7c258 send the current user 2019-09-13 12:35:38 +10:00
Rimian Perkins 83aa996c42 Link to Chris' version of the plugin 2019-09-13 09:00:57 +10:00
Rimian Perkins 32bf78fa9a send a description to the payment intent 2019-09-12 19:17:08 +10:00
Rimian Perkins c6555ccc63 some css 2019-09-12 19:04:10 +10:00
Rimian Perkins 22af03a42e add billing to confirm dialog 2019-09-12 18:51:40 +10:00
Rimian Perkins 926aee79bb make the payment section a different colour 2019-09-12 18:34:00 +10:00
Rimian Perkins 83fc234b90 settings, headings 2019-09-12 18:27:25 +10:00
Rimian Perkins 9cfdd3f07e This always catches me. Pretty quotes! 2019-09-12 18:18:50 +10:00
Rimian Perkins 6f87f11e4a currency format helper 2019-09-12 18:16:47 +10:00
Rimian Perkins 035187d843 pretty js 2019-09-12 17:47:44 +10:00
Rimian Perkins ba73e688f2 validate billing 2019-09-12 17:47:08 +10:00
Rimian Perkins b60244e809 form text 2019-09-12 16:28:19 +10:00
Rimian Perkins e2cec16b99 forms and settings 2019-09-12 16:16:38 +10:00
Rimian Perkins 1add7e9cdf Fix broken test and form wrap 2019-09-12 15:52:30 +10:00
Rimian Perkins 515882d845 more config 2019-09-12 15:36:08 +10:00
Rimian Perkins 9b69c58be4 Add some billing details 2019-09-12 15:13:08 +10:00
Rimian Perkins a87fcae149 a little formatting 2019-09-12 13:46:30 +10:00
Rimian Perkins 2a1a17793f add some settings for text 2019-09-12 13:40:18 +10:00
Rimian Perkins 8785e98464 readme some 2019-09-12 13:13:06 +10:00
Rimian Perkins c79541a48b pretty 2019-09-12 11:51:28 +10:00
Rimian Perkins ce258d3d08 convert amount in param 2019-09-12 11:49:52 +10:00
Rimian Perkins c636a2896a some translations 2019-09-12 11:34:54 +10:00
Rimian Perkins 7ad42c9b48 combo box with amounts. use decimals 2019-09-12 11:21:27 +10:00
Rimian Perkins c3e3b7ad67 rm acceptance test for now. Stripe is not defined 2019-09-12 09:39:23 +10:00
Rimian Perkins 07f4bb0406 add basic locales 2019-09-12 09:34:28 +10:00
Rimian Perkins 55bab5d936 rm redundant component 2019-09-12 09:28:01 +10:00
Rimian Perkins dfba5471f9 add specs back. fix plugin name 2019-09-12 09:25:06 +10:00
Rimian Perkins 43fde60f3a proper setting 2019-09-12 08:10:41 +10:00
Rimian Perkins c2af580718 import URL helper 2019-09-12 07:58:08 +10:00
Rimian Perkins fb372703a2 try and get the js tests to actually run 2019-09-12 07:51:40 +10:00
Rimian Perkins 36c1731565 add success handler 2019-09-12 07:43:27 +10:00
Rimian Perkins fdd4d1ed5f yarn prettier 2019-09-12 07:14:16 +10:00
Rimian Perkins 11b2917254 eslint 2019-09-11 22:17:07 +10:00
Rimian Perkins 73258b10b9 reorder those settings the same as stripe dashboard 2019-09-11 22:14:15 +10:00
Rimian Perkins 381315f9f3 add settings 2019-09-11 22:06:01 +10:00
Rimian Perkins df1d5a3181 the form submits but an ajax error happens 2019-09-11 21:52:04 +10:00
Rimian Perkins 02c9ea873a add stylesheets 2019-09-11 21:14:48 +10:00
Rimian Perkins 5cddda6703 add controllers 2019-09-11 21:09:34 +10:00
Rimian Perkins a9434f5723 load in components 2019-09-11 20:37:23 +10:00
Rimian Perkins ee2be672f7 initial components 2019-09-11 20:19:50 +10:00
Rimian Perkins af97581911 stub stripe payment create 2019-09-11 19:55:35 +10:00
Rimian Perkins d71ab48fff upgrade stripe gem 2019-09-11 19:42:59 +10:00
Rimian Perkins c70f570479 Rubocop 2019-09-11 19:27:24 +10:00
Rimian Perkins 70138c5269 add readme info 2019-09-11 19:24:25 +10:00
Rimian Perkins b97e9b91c2 add stripe gem 2019-09-11 19:18:30 +10:00
Rimian Perkins 2e3cdb0dcf fix routes. get specs passing 2019-09-11 19:11:02 +10:00
Rimian Perkins 3f90518e18 controller spec runs 2019-09-11 18:32:09 +10:00
Rimian Perkins 109d6fc137 empty specs 2019-09-11 17:57:29 +10:00
Rimian Perkins 683c36e5d1 rm redundant index template 2019-09-11 17:44:26 +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 89af44ff78 link to jsapp 2019-08-29 12:15:27 +10:00
Rimian Perkins d2f85f1a97 Merge branch 'master' into upgrade-stripe-gem 2019-08-28 19:54:07 +10:00
Rimian Perkins 05da88009d whoops add invoice list back 2019-08-28 19:53:29 +10:00
Rimian Perkins 5eb0fca3d8 upgrade really old stripe gem 2019-08-28 19:05:14 +10:00
Rimian Perkins 6d1c4dd28c deprecations and documentation 2019-08-28 19:02:56 +10:00
Rimian Perkins 32f883a7ad pretty code 2019-08-28 18:36:19 +10:00
Rimian Perkins e891eb1517 fix eslint, bump patch 2019-08-28 18:27:45 +10:00
Rimian Perkins 9b2ca50671 fix deprecations 2019-08-28 18:24:55 +10:00
Rimian Perkins e539c34653 apply the css colour to the card 2019-08-28 18:10:54 +10:00
Rimian Perkins 8d8e9f9ad1 abstract out the stripe component for easy future testing 2019-08-28 14:59:45 +10:00
Rimian Perkins f1de907c32 add the basic form 2019-08-27 22:05:30 +10:00
Rimian Perkins e956551d0f Upgrade stripe gem. bump! 2019-08-27 20:53:06 +10:00
Rimian Perkins 0cb3a9acde format with prettier 2019-08-27 20:37:20 +10:00
Rimian Perkins 675c3d27ba appease eslint 2019-08-27 20:18:02 +10:00
Rimian Perkins 6f826ce7a0 rubocop correct 2019-08-27 20:04:02 +10:00
Rimian Perkins f49c0c89a3 empty form component 2019-08-27 19:56:55 +10:00
Rimian Perkins 14b8c1f1a8 enable discourse-plugin-ci 2019-08-27 19:52:25 +10:00
Rimian Perkins 3c23b225fb bumpus 2019-08-27 19:09:24 +10:00
Rimian Perkins a654f7410d rm fails 2019-08-27 18:48:54 +10:00
Rimian Perkins 4c25aa0ad1 add the current user to specs 2019-08-27 18:37:14 +10:00
Rimian Perkins 5724e6d2ed add the json format 2019-08-27 17:29:19 +10:00
Rimian Perkins 4dad8547ca disable shoulda permit 2019-08-27 17:23:22 +10:00
Rimian Perkins 3bde870998 test no account create 2019-08-27 17:10:49 +10:00
Rimian Perkins 9fbf83f19f oops wrong path 2019-08-27 16:45:39 +10:00
Rimian Perkins ae3e67d385 add more stripe factories 2019-08-27 16:43:55 +10:00
Rimian Perkins 53b1e47216 name space fabricators. add plans 2019-08-27 16:28:35 +10:00
Rimian Perkins c8bcc1eb28 factory for stripe responses 2019-08-27 16:06:37 +10:00
Rimian Perkins 1315d240e6 simplify the http stubs 2019-08-27 12:53:20 +10:00
Rimian Perkins 4b41756cfa a zillion http stubs to get this spec to pass! 2019-08-27 11:57:51 +10:00
Rimian Perkins d4d62c5458 Stripe controller specs
* Get some of these to pass.
* skip some

I am going to refactor this anyway
2019-08-26 20:34:13 +10:00
Rimian Perkins 0fb2026123 remove redundant spec 2019-08-26 18:42:06 +10:00
Rimian Perkins 1162aa2070 use same postgres and ruby version as core 2019-08-26 18:02:50 +10:00
Rimian Perkins 8d83fa6a40 update travis badge 2019-08-26 17:53:23 +10:00
Rimian Perkins 0a03a54072 upgrade travis settings 2019-08-26 17:49:34 +10:00
Rimian Perkins abaf101173 initial spec for donation-row component 2019-08-26 17:34:40 +10:00
Rimian Perkins d0bdfab44b fix the test runner 2019-08-26 16:01:57 +10:00
Rimian Perkins 2df3e0d85a disable this to get tests running for now 2019-08-26 11:24:30 +10:00
Rimian Perkins 473df7bd60 Acceptance test runs without crashing 2019-08-25 11:55:32 +10:00
Rimian Perkins 29ec7ec45c upgrade ruby 2019-08-25 11:51:06 +10:00
Angus McLeod 06b775c8c1 add equal to 2019-04-09 09:04:24 +10:00
Angus McLeod 794793f7c3 tweak 2019-04-03 13:15:01 +11:00
Angus McLeod 262ae0f96c add mobile styles 2019-04-03 12:40:03 +11:00
Angus McLeod 44410fa375 add cause release fields 2019-04-03 12:32:24 +11:00
Angus McLeod b7ee6a1b25 preload category custom fields 2019-03-19 12:22:06 +11:00
Angus McLeod c857e020a2 bugfix 2019-01-29 15:00:42 +11:00
Angus McLeod e9746221ab add stripe to CSP 2019-01-29 15:00:29 +11:00
Angus McLeod fc08f8f654 bugfix 2018-10-29 08:59:59 +11:00
Angus McLeod 9481fdba07 bugfix 2018-09-30 11:53:33 +10:00
Angus McLeod b98e603e59 Add proper user path 2018-09-30 11:51:20 +10:00
Angus McLeod a353eed1c3 small fixes 2018-09-30 11:23:05 +10:00
Angus McLeod 02e3438a9c only add metadata element if there is metadata 2018-09-29 10:12:48 +10:00
Angus McLeod e1eb585974 Add additional settings and customizations 2018-09-28 17:33:27 +10:00
Angus McLeod ae793ad247 Add setting for monthly total and other minor improvements 2018-09-24 10:17:53 +10:00
Angus McLeod a3636a5038 if not a category route remove body class 2018-09-23 09:08:39 +10:00
Angus McLeod c4c96046cd only show github and meta links if they exist 2018-09-23 08:44:50 +10:00
Angus McLeod b8cf45aa7f ensure widget is hidden on non-category paths 2018-09-23 08:36:28 +10:00
Angus McLeod b4fd0287ed Add meta link 2018-09-22 17:48:38 +10:00
Angus McLeod d58c04a592 only show cause UI in cause categories 2018-09-22 17:09:06 +10:00
Angus McLeod 45ece34200 Add donations causes 2018-09-22 14:03:30 +10:00
Angus McLeod d686ece85b Redirect to root from '/donate' if the plugin is disabled 2018-07-02 10:30:38 +10:00
Angus McLeod 4e9cc7d187 Merge pull request #12 from chrisbeach/recurring_donations
Recurring donations and other fixes
2018-06-28 14:14:26 +10:00
Angus McLeod 0260197e9e various 2018-06-28 13:46:02 +10:00
Angus McLeod 1b1eb215e4 various 2018-06-28 09:32:58 +10:00
Angus McLeod fd0b53c67c Properly validate email 2018-06-25 18:37:55 +10:00
Angus McLeod 8453d5cc03 various 2018-06-25 18:14:50 +10:00
Angus McLeod 90f5083fb6 Small fixes 2018-06-22 11:55:16 +10:00
Angus McLeod d55d149d7d Add recurring donations 2018-06-21 19:00:43 +10:00
Angus McLeod 5723b91ba2 Donation form style updates 2018-06-21 19:00:19 +10:00
Chris Beach a6712676d2 Update .travis.yml to upgrade ruby version 2018-05-27 13:45:12 +01:00
Chris Beach 76c5641041 Merge pull request #10 from chrisbeach/amount_setting
Make donation amounts a customisable setting
2018-02-02 12:28:19 +00:00
Angus McLeod 446cc75cbc Make donation amounts a customisable setting 2018-02-02 19:49:58 +08:00
Chris Beach 96b09333ad Merge pull request #9 from chrisbeach/transaction_fee
Add ability to allow donor to include stripe transaction fee in their donation
2018-02-02 10:33:16 +00:00
Angus McLeod e307a75a3b Merge branch 'master' into transaction_fee 2018-02-02 17:47:53 +08:00
Angus McLeod e8e558c3e2 Add ability to allow donor to include stripe transaction fee in their donation 2018-02-02 17:43:54 +08:00
Chris Beach 9ec48bc6b1 Merge pull request #8 from chrisbeach/associate_stripe_customer_id_with_users
Save and reuse stripe customer id when user is present
2018-02-02 08:27:56 +00:00
Angus McLeod f46d3394cb BUGFIX: default amount should be 1
This seems to have been broken for a little while.

The bug was that if you just left the donation combo-box as is (i.e. at
‘1.00’), entered your card details and clicked ‘donate’ you would get
an error, because the default ``amount`` property was null rather than
0.
2018-02-02 16:19:21 +08:00
Angus McLeod ccf7f1b73b Save and reuse stripe customer id when user is present 2018-02-02 16:06:43 +08:00
Chris Beach 23e30c7db8 Merge pull request #7 from chrisbeach/donate_page_description
Add page description setting
2018-02-02 07:38:18 +00:00
Angus McLeod 19f197e780 Add page description setting 2018-02-02 13:43:20 +08:00
Chris Beach dd7e86930f Include timestamp in messages to user.
Permit email param in checkout_controller
Fix failing tests
2018-01-18 00:21:41 +00:00
Chris Beach c6f416788c Hide nav link if plugin disabled 2018-01-17 23:10:15 +00:00
Chris Beach a16fdf57ef Merge pull request #6 from chrisbeach/post_donate_button_fix
Move script to jquery insertion on render
2017-11-27 08:15:44 +00:00
Angus McLeod 23bc79513a Rm test element 2017-11-27 10:39:32 +08:00
Angus McLeod bcebbd583b Move script to jquery insertion on render 2017-11-27 10:28:21 +08:00
Chris Beach 41ffb0c437 update readme 2017-11-26 14:09:06 +00:00
Chris Beach 35dd123264 fix tests 2017-11-26 12:41:39 +00:00
Chris Beach df91a44277 fix client/server messages and locales
zip code should be a positive boolean not negative
remove dollar signs
fix stripe.rb method signature and charging logic
2017-11-26 12:24:27 +00:00
Chris Beach 876edfc0d7 Improve README 2017-11-14 01:06:18 +00:00
Chris Beach 5c281cf9ef Merge pull request #4 from chrisbeach/stripe-injection
Add stripe injection to <head> in plugin.rb
2017-11-12 10:02:13 +00:00
Angus McLeod fc8f7560cf fix build by skipping check_xhr 2017-11-12 11:37:21 +08:00
Angus McLeod e4f420a96e add stripe script in plugin.rb 2017-11-12 11:16:47 +08:00
Angus McLeod c22ef46224 rm stripe.js from build
It needs to be loaded directly.

https://stripe.com/docs/stripe-js/reference#including-stripejs
2017-11-12 11:01:08 +08:00
Chris Beach a2fac9a4ff Merge pull request #2 from angusmcleod/suggested_improvements
Include stripe_js && inherit from the application controller
2017-11-08 08:08:18 +00:00
Angus McLeod 38689a59d5 Inherit from the application controller 2017-11-08 08:58:38 +08:00
Angus McLeod c2fa248b79 Include stripe js && inherit from the application controller 2017-11-08 08:45:18 +08: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
Chris Beach 05a2629f8c Add checkout method 2017-10-19 23:51:05 +01:00
Chris Beach 238f4c4eb4 Include amount on form and increase logging 2017-10-19 23:51:05 +01:00
Chris Beach 18196c0a0a Revert "Debugging"
This reverts commit 991631c
2017-10-19 23:51:05 +01:00
Chris Beach e556e75253 Revert "Debugging"
This reverts commit f6d862f
2017-10-19 23:51:05 +01:00
Chris Beach d73e6b5004 Debugging 2017-10-19 23:51:05 +01:00
Chris Beach 37436d1adc Debugging 2017-10-19 23:51:05 +01:00
Chris Beach 173f090c4f Disable that darned discobot 2017-10-16 12:48:26 +01:00
Chris Beach 943343ffa4 Use siteSettings properly 2017-10-12 02:13:20 +01:00
Chris Beach 92639a483f Fix discourse-markdown 2017-10-12 00:37:29 +01:00
Chris Beach ea24600f61 Fix README.md 2017-10-12 00:00:02 +01:00
Chris Beach 8fdd5dad27 Revert removal of donate menu item 2017-10-11 23:58:22 +01:00
Chris Beach 340959c73b Fix failing tests (likely due to Discourse Rails upgrade) 2017-10-11 23:48:41 +01:00
Chris Beach 2b17c87333 Tweak readme 2017-10-11 20:40:13 +01:00
Chris Beach 6814c80540 Stripe Checkout can be created via BBCode markup 2017-10-09 08:39:21 +01:00
Chris Beach 0e19102139 update .gitignore 2017-10-08 23:18:22 +01:00
Rimian Perkins 9f51b0ef10 Merge pull request #8 from Dax74/patch-3
Update client.it.yml
2017-09-22 12:40:40 +10:00
Rimian Perkins 62b2449115 Merge pull request #9 from Dax74/patch-4
Update server.it.yml thanks
2017-09-22 12:40:10 +10:00
Dax74 26d6b27003 Update server.it.yml 2017-07-04 15:16:08 +02:00
Dax74 f533a480e6 Update client.it.yml 2017-07-04 15:02:10 +02:00
Rimian Perkins 70b928707f disable the button as soon as it is clicked 2017-05-29 10:48:32 +10:00
Rimian Perkins e8a50b0930 add some test credit card numbers 2017-05-27 16:59:44 +10:00
285 changed files with 20522 additions and 1133 deletions
+2
View File
@@ -0,0 +1,2 @@
3.1.999: c4f8220a5572ef9a42a9a71500e001d0df206c43
2.9.0.beta9: 39b7253c082270e33839f4b0821fbf75abfdd826
+6
View File
@@ -0,0 +1,6 @@
{
"globals": {
"Stripe": true
},
"extends": "eslint-config-discourse"
}
+11
View File
@@ -0,0 +1,11 @@
name: Discourse Plugin
on:
push:
branches:
- main
pull_request:
jobs:
ci:
uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1
+2 -4
View File
@@ -1,4 +1,2 @@
.DS_Store
gems
log
.byebug_history
node_modules
/gems
+1
View File
@@ -0,0 +1 @@
{}
+8
View File
@@ -0,0 +1,8 @@
inherit_gem:
rubocop-discourse: stree-compat.yml
AllCops:
Exclude:
- "gems/**/*"
- "vendor/bundle/**/*"
Discourse/NoAddReferenceOrAliasesActiveRecordMigration:
Enabled: false
-1
View File
@@ -1 +0,0 @@
2.3.3
+2
View File
@@ -0,0 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};
-42
View File
@@ -1,42 +0,0 @@
language: ruby
env:
global:
- DISCOURSE_HOSTNAME=www.example.com
dist: trusty
cache: bundler --path $TRAVIS_BUILD_DIR/discourse/vendor
addons:
postgresql: 9.5
apt:
packages:
- gifsicle
- jpegoptim
- optipng
- jhead
rvm:
- 2.3.3
services:
- redis-server
before_install:
- git clone https://github.com/discourse/discourse.git discourse
- cd discourse
install:
- touch config/stripe.yml
- git clone $TRAVIS_BUILD_DIR plugins/discourse-donations --depth 50 --branch $TRAVIS_BRANCH
before_script:
- gem install bundler
- bundle install
- bundle exec rake db:create db:migrate
script:
- "bundle exec rake plugin:spec[discourse-donations]"
- "MODULE='Acceptance: Discourse Donations' bundle exec rake qunit:test[20000]"
- "MODULE='component:stripe-card' bundle exec rake qunit:test[20000]"
+9
View File
@@ -0,0 +1,9 @@
# frozen_string_literal: true
source "https://rubygems.org"
group :development do
gem "translations-manager", git: "https://github.com/discourse/translations-manager.git"
gem "rubocop-discourse"
gem "syntax_tree"
end
+50
View File
@@ -0,0 +1,50 @@
GIT
remote: https://github.com/discourse/translations-manager.git
revision: a8b225f7fabd3250ba88a4a2eff797693df51192
specs:
translations-manager (0.6)
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.2)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
prettier_print (1.2.0)
rainbow (3.1.1)
regexp_parser (2.6.0)
rexml (3.2.5)
rubocop (1.36.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-discourse (3.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.13.2)
rubocop (~> 1.33)
ruby-progressbar (1.11.0)
syntax_tree (5.1.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.3.0)
PLATFORMS
ruby
DEPENDENCIES
rubocop-discourse
syntax_tree
translations-manager!
BUNDLED WITH
2.3.4
+3 -34
View File
@@ -1,36 +1,5 @@
# Discourse Donations
# Discourse Subscriptions Plugin
[![Build Status](https://travis-ci.org/choiceaustralia/discourse-donations.svg?branch=master)](https://travis-ci.org/choiceaustralia/discourse-donations)
Discourse Subscriptions allows site owners to sell recurring and one-time purchase subscriptions that grant access to a group on a Discourse instance.
Accept donations in Discourse! Integrates with [Stripe](https://stripe.com).
## Installation
* Be sure your site is enforcing https.
* Follow the install instructions here: https://meta.discourse.org/t/install-a-plugin/19157
* Add your Stripe public and private keys in settings and set the currency to your local value.
* Add the following script to your page header in a custom theme component: `<script src="https://js.stripe.com/v3/"></script>`
* Enable the plugin and wait for people to donate money.
## Creating new user accounts
**This is an experimental feature.** A user can create a new account if they makes a successful donation. Enable this in settings. When a user is not logged in, they will be asked to enter details for a new user account. This feature doesn't support mandatory custom user fields yet.
## Testing
* To run the rails specs, install the plugin and run `bundle exec rake plugin:spec[discourse-donations]` in the discourse root directory.
* To run qunit tests: `MODULE='Acceptance: Discourse Donations' bundle exec rake qunit:test[20000]`.
* To run Component tests: `MODULE='component:stripe-card' bundle exec rake qunit:test[20000]`.
**Note:**
* If you're using a zsh shell, then you probably get this error: `zsh: no matches found ...` and you'll need to escape the square brackets with backslashes.
## TODO
* Handle custom fields
* Acceptance test in RSpec not qunit.
## Warranty
This software comes with no warranty of any kind.
For more information, please see: https://meta.discourse.org/t/discourse-subscriptions-plugin/140818
+11
View File
@@ -0,0 +1,11 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Group
extend ActiveSupport::Concern
def plan_group(plan)
::Group.find_by_name(plan[:metadata][:group_name])
end
end
end
+18
View File
@@ -0,0 +1,18 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Stripe
extend ActiveSupport::Concern
AUTH_PROBLEM_IDENTIFIER = "#{DiscourseSubscriptions::PLUGIN_NAME}.stripe_auth_error"
def set_api_key
::Stripe.api_key = SiteSetting.discourse_subscriptions_secret_key
end
def is_stripe_configured?
SiteSetting.discourse_subscriptions_public_key.present? &&
SiteSetting.discourse_subscriptions_secret_key.present?
end
end
end
@@ -1,93 +0,0 @@
require_dependency 'discourse'
module DiscourseDonations
class ChargesController < ActionController::Base
include CurrentUser
skip_before_filter :verify_authenticity_token, only: [:create]
def create
params.permit(:name, :username, :email, :password, :stripeToken, :amount, :create_account)
output = { 'messages' => [], 'rewards' => [] }
if create_account
if !email.present? || !params[:username].present?
output['messages'] << I18n.t('login.missing_user_field')
end
if params[:password] && params[:password].length > User.max_password_length
output['messages'] << I18n.t('login.password_too_long')
end
if params[:username] && ::User.reserved_username?(params[:username])
output['messages'] << I18n.t('login.reserved_username')
end
end
if output['messages'].present?
render(:json => output.merge(success: false)) and return
end
payment = DiscourseDonations::Stripe.new(secret_key, stripe_options)
begin
charge = payment.charge(email, params)
rescue ::Stripe::CardError => e
err = e.json_body[:error]
output['messages'] << "There was an error (#{err[:type]})."
#output['messages'] << "Error code: #{err[:code]}" if err[:code]
#output['messages'] << "Decline code: #{err[:decline_code]}" if err[:decline_code]
output['messages'] << "Message: #{err[:message]}" if err[:message]
render(:json => output) and return
end
if charge['paid'] == true
output['messages'] << I18n.t('donations.payment.success')
output['rewards'] << { type: :group, name: group_name } if group_name
output['rewards'] << { type: :badge, name: badge_name } if badge_name
if create_account && email.present?
args = params.slice(:email, :username, :password, :name).merge(rewards: output['rewards'])
Jobs.enqueue(:donation_user, args)
end
end
render :json => output
end
private
def create_account
params[:create_account] == 'true' && SiteSetting.discourse_donations_enable_create_accounts
end
def reward?(payment)
payment.present? && payment.successful?
end
def group_name
SiteSetting.discourse_donations_reward_group_name
end
def badge_name
SiteSetting.discourse_donations_reward_badge_name
end
def secret_key
SiteSetting.discourse_donations_secret_key
end
def stripe_options
{
description: SiteSetting.discourse_donations_description,
currency: SiteSetting.discourse_donations_currency
}
end
def email
params[:email] || current_user.try(:email)
end
end
end
@@ -1,11 +0,0 @@
module DiscourseDonations
class PaymentsController < ApplicationController
def index
render json: {}
end
def show
render json: {}
end
end
end
@@ -0,0 +1,68 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Admin
class CouponsController < ::Admin::AdminController
include DiscourseSubscriptions::Stripe
include DiscourseSubscriptions::Group
before_action :set_api_key
def index
begin
promo_codes = ::Stripe::PromotionCode.list({ limit: 100 })[:data]
promo_codes = promo_codes.select { |code| code[:coupon][:valid] == true }
render_json_dump promo_codes
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def create
params.require(%i[promo discount_type discount active])
begin
coupon_params = { duration: "forever" }
case params[:discount_type]
when "amount"
coupon_params[:amount_off] = params[:discount].to_i * 100
coupon_params[:currency] = SiteSetting.discourse_subscriptions_currency
when "percent"
coupon_params[:percent_off] = params[:discount]
end
coupon = ::Stripe::Coupon.create(coupon_params)
promo_code =
::Stripe::PromotionCode.create(
{ coupon: coupon[:id], code: params[:promo] },
) if coupon.present?
render_json_dump promo_code
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def update
params.require(%i[id active])
begin
promo_code = ::Stripe::PromotionCode.update(params[:id], { active: params[:active] })
render_json_dump promo_code
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def destroy
params.require(:coupon_id)
begin
coupon = ::Stripe::Coupon.delete(params[:coupon_id])
render_json_dump coupon
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
end
end
end
@@ -0,0 +1,96 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Admin
class PlansController < ::Admin::AdminController
include DiscourseSubscriptions::Stripe
before_action :set_api_key
def index
begin
plans = ::Stripe::Price.list(product_params)
render_json_dump plans.data
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def create
begin
price_object = {
nickname: params[:nickname],
unit_amount: params[:amount],
product: params[:product],
currency: params[:currency],
active: params[:active],
metadata: {
group_name: params[:metadata][:group_name],
trial_period_days: params[:trial_period_days],
},
}
price_object[:recurring] = { interval: params[:interval] } if params[:type] == "recurring"
plan = ::Stripe::Price.create(price_object)
render_json_dump plan
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def show
begin
plan = ::Stripe::Price.retrieve(params[:id])
if plan[:metadata] && plan[:metadata][:trial_period_days]
trial_days = plan[:metadata][:trial_period_days]
elsif plan[:recurring] && plan[:recurring][:trial_period_days]
trial_days = plan[:recurring][:trial_period_days]
end
interval = nil
interval = plan[:recurring][:interval] if plan[:recurring] && plan[:recurring][:interval]
serialized =
plan.to_h.merge(
trial_period_days: trial_days,
currency: plan[:currency].upcase,
interval: interval,
)
render_json_dump serialized
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def update
begin
plan =
::Stripe::Price.update(
params[:id],
nickname: params[:nickname],
active: params[:active],
metadata: {
group_name: params[:metadata][:group_name],
trial_period_days: params[:trial_period_days],
},
)
render_json_dump plan
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
private
def product_params
{ product: params[:product_id] } if params[:product_id]
end
end
end
end
@@ -0,0 +1,93 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Admin
class ProductsController < ::Admin::AdminController
include DiscourseSubscriptions::Stripe
before_action :set_api_key
def index
begin
product_ids = Product.all.pluck(:external_id)
products = []
if product_ids.present? && is_stripe_configured?
products = ::Stripe::Product.list({ ids: product_ids, limit: 100 })
products = products[:data]
elsif !is_stripe_configured?
products = nil
end
render_json_dump products
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def create
begin
create_params = product_params.merge!(type: "service")
create_params.except!(:statement_descriptor) if params[:statement_descriptor].blank?
product = ::Stripe::Product.create(create_params)
Product.create(external_id: product[:id])
render_json_dump product
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def show
begin
product = ::Stripe::Product.retrieve(params[:id])
render_json_dump product
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def update
begin
product = ::Stripe::Product.update(params[:id], product_params)
render_json_dump product
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def destroy
begin
product = ::Stripe::Product.delete(params[:id])
Product.delete_by(external_id: params[:id])
render_json_dump product
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
private
def product_params
params.permit!
{
name: params[:name],
active: params[:active],
statement_descriptor: params[:statement_descriptor],
metadata: {
description: params.dig(:metadata, :description),
repurchaseable: params.dig(:metadata, :repurchaseable),
},
}
end
end
end
end
@@ -0,0 +1,103 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module Admin
class SubscriptionsController < ::Admin::AdminController
include DiscourseSubscriptions::Stripe
include DiscourseSubscriptions::Group
before_action :set_api_key
PAGE_LIMIT = 10
def index
begin
subscription_ids = Subscription.all.pluck(:external_id)
subscriptions = {
has_more: false,
data: [],
length: 0,
last_record: params[:last_record],
}
if subscription_ids.present? && is_stripe_configured?
while subscriptions[:length] < PAGE_LIMIT
current_set = get_subscriptions(subscriptions[:last_record])
until valid_subscriptions =
find_valid_subscriptions(current_set[:data], subscription_ids)
current_set = get_subscriptions(current_set[:data].last)
break if current_set[:has_more] == false
end
subscriptions[:data] = subscriptions[:data].concat(valid_subscriptions.to_a)
subscriptions[:last_record] = current_set[:data].last[:id] if current_set[
:data
].present?
subscriptions[:length] = subscriptions[:data].length
subscriptions[:has_more] = current_set[:has_more]
break if subscriptions[:has_more] == false
end
elsif !is_stripe_configured?
subscriptions = nil
end
render_json_dump subscriptions
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def destroy
params.require(:id)
begin
refund_subscription(params[:id]) if params[:refund]
subscription = ::Stripe::Subscription.delete(params[:id])
customer =
Customer.find_by(
product_id: subscription[:plan][:product],
customer_id: subscription[:customer],
)
Subscription.delete_by(external_id: params[:id])
if customer
user = ::User.find(customer.user_id)
customer.delete
group = plan_group(subscription[:plan])
group.remove(user) if group
end
render_json_dump subscription
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
private
def get_subscriptions(start)
::Stripe::Subscription.list(
expand: ["data.plan.product"],
limit: PAGE_LIMIT,
starting_after: start,
)
end
def find_valid_subscriptions(data, ids)
valid = data.select { |sub| ids.include?(sub[:id]) }
valid.empty? ? nil : valid
end
# this will only refund the most recent subscription payment
def refund_subscription(subscription_id)
subscription = ::Stripe::Subscription.retrieve(subscription_id)
invoice = ::Stripe::Invoice.retrieve(subscription[:latest_invoice]) if subscription[
:latest_invoice
]
payment_intent = invoice[:payment_intent] if invoice[:payment_intent]
refund = ::Stripe::Refund.create({ payment_intent: payment_intent })
end
end
end
end
@@ -0,0 +1,23 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class AdminController < ::Admin::AdminController
def index
head 200
end
def refresh_campaign
Jobs.enqueue(:manually_update_campaign_data)
render json: success_json
end
def create_campaign
begin
DiscourseSubscriptions::Campaign.new.create_campaign
render json: success_json
rescue => e
render_json_error e.message
end
end
end
end
@@ -0,0 +1,72 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class HooksController < ::ApplicationController
include DiscourseSubscriptions::Group
include DiscourseSubscriptions::Stripe
layout false
skip_before_action :check_xhr
skip_before_action :redirect_to_login_if_required
skip_before_action :verify_authenticity_token, only: [:create]
def create
begin
payload = request.body.read
sig_header = request.env["HTTP_STRIPE_SIGNATURE"]
webhook_secret = SiteSetting.discourse_subscriptions_webhook_secret
event = ::Stripe::Webhook.construct_event(payload, sig_header, webhook_secret)
rescue JSON::ParserError => e
return render_json_error e.message
rescue ::Stripe::SignatureVerificationError => e
return render_json_error e.message
end
case event[:type]
when "customer.subscription.created"
when "customer.subscription.updated"
customer =
Customer.find_by(
customer_id: event[:data][:object][:customer],
product_id: event[:data][:object][:plan][:product],
)
return render_json_error "customer not found" if !customer
return head 200 if event[:data][:object][:status] != "complete"
user = ::User.find_by(id: customer.user_id)
return render_json_error "user not found" if !user
if group = plan_group(event[:data][:object][:plan])
group.add(user)
end
when "customer.subscription.deleted"
customer =
Customer.find_by(
customer_id: event[:data][:object][:customer],
product_id: event[:data][:object][:plan][:product],
)
return render_json_error "customer not found" if !customer
Subscription.find_by(
customer_id: customer.id,
external_id: event[:data][:object][:id],
)&.destroy!
user = ::User.find(customer.user_id)
return render_json_error "user not found" if !user
if group = plan_group(event[:data][:object][:plan])
group.remove(user)
end
customer.destroy!
end
head 200
end
end
end
@@ -0,0 +1,233 @@
# frozen_string_literal: true
module DiscourseSubscriptions
class SubscribeController < ::ApplicationController
include DiscourseSubscriptions::Stripe
include DiscourseSubscriptions::Group
before_action :set_api_key
requires_login except: %i[index contributors show]
def index
begin
product_ids = Product.all.pluck(:external_id)
products = []
if product_ids.present? && is_stripe_configured?
response = ::Stripe::Product.list({ ids: product_ids, active: true })
products = response[:data].map { |p| serialize_product(p) }
end
render_json_dump products
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def contributors
return unless SiteSetting.discourse_subscriptions_campaign_show_contributors
contributor_ids = Set.new
campaign_product = SiteSetting.discourse_subscriptions_campaign_product
if campaign_product.present?
contributor_ids.merge(Customer.where(product_id: campaign_product).last(5).pluck(:user_id))
else
contributor_ids.merge(Customer.last(5).pluck(:user_id))
end
contributors = ::User.where(id: contributor_ids)
render_serialized(contributors, UserSerializer)
end
def show
params.require(:id)
begin
product = ::Stripe::Product.retrieve(params[:id])
plans = ::Stripe::Price.list(active: true, product: params[:id])
response = { product: serialize_product(product), plans: serialize_plans(plans) }
render_json_dump response
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def create
params.require(%i[source plan])
begin
customer =
find_or_create_customer(
params[:source],
params[:cardholder_name],
params[:cardholder_address],
)
plan = ::Stripe::Price.retrieve(params[:plan])
if params[:promo].present?
promo_code = ::Stripe::PromotionCode.list({ code: params[:promo] })
promo_code = promo_code[:data][0] # we assume promo codes have a unique name
if promo_code.blank?
return render_json_error I18n.t("js.discourse_subscriptions.subscribe.invalid_coupon")
end
end
recurring_plan = plan[:type] == "recurring"
if recurring_plan
trial_days = plan[:metadata][:trial_period_days] if plan[:metadata] &&
plan[:metadata][:trial_period_days]
promo_code_id = promo_code[:id] if promo_code
transaction =
::Stripe::Subscription.create(
customer: customer[:id],
items: [{ price: params[:plan] }],
metadata: metadata_user,
trial_period_days: trial_days,
promotion_code: promo_code_id,
)
payment_intent = retrieve_payment_intent(transaction[:latest_invoice]) if transaction[
:status
] == "incomplete"
else
coupon_id = promo_code[:coupon][:id] if promo_code && promo_code[:coupon] &&
promo_code[:coupon][:id]
invoice_item =
::Stripe::InvoiceItem.create(
customer: customer[:id],
price: params[:plan],
discounts: [{ coupon: coupon_id }],
)
invoice = ::Stripe::Invoice.create(customer: customer[:id])
transaction = ::Stripe::Invoice.finalize_invoice(invoice[:id])
payment_intent = retrieve_payment_intent(transaction[:id]) if transaction[:status] ==
"open"
transaction = ::Stripe::Invoice.pay(invoice[:id]) if payment_intent[:status] ==
"successful"
end
finalize_transaction(transaction, plan) if transaction_ok(transaction)
transaction = transaction.to_h.merge(transaction, payment_intent: payment_intent)
render_json_dump transaction
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def finalize
params.require(%i[plan transaction])
begin
price = ::Stripe::Price.retrieve(params[:plan])
transaction = retrieve_transaction(params[:transaction])
finalize_transaction(transaction, price) if transaction_ok(transaction)
render_json_dump params[:transaction]
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def finalize_transaction(transaction, plan)
group = plan_group(plan)
group.add(current_user) if group
customer =
Customer.create(
user_id: current_user.id,
customer_id: transaction[:customer],
product_id: plan[:product],
)
if transaction[:object] == "subscription"
Subscription.create(customer_id: customer.id, external_id: transaction[:id])
end
end
private
def serialize_product(product)
{
id: product[:id],
name: product[:name],
description: PrettyText.cook(product[:metadata][:description]),
subscribed: current_user_products.include?(product[:id]),
repurchaseable: product[:metadata][:repurchaseable],
}
end
def current_user_products
return [] if current_user.nil?
Customer.select(:product_id).where(user_id: current_user.id).map { |c| c.product_id }.compact
end
def serialize_plans(plans)
plans[:data]
.map { |plan| plan.to_h.slice(:id, :unit_amount, :currency, :type, :recurring) }
.sort_by { |plan| plan[:amount] }
end
def find_or_create_customer(source, cardholder_name = nil, cardholder_address = nil)
customer = Customer.find_by_user_id(current_user.id)
cardholder_address =
(
if cardholder_address.present?
{
line1: cardholder_address[:line1],
city: cardholder_address[:city],
state: cardholder_address[:state],
country: cardholder_address[:country],
postal_code: cardholder_address[:postalCode],
}
else
nil
end
)
if customer.present?
::Stripe::Customer.retrieve(customer.customer_id)
else
::Stripe::Customer.create(
email: current_user.email,
source: source,
name: cardholder_name,
address: cardholder_address,
)
end
end
def retrieve_payment_intent(invoice_id)
invoice = ::Stripe::Invoice.retrieve(invoice_id)
::Stripe::PaymentIntent.retrieve(invoice[:payment_intent])
end
def retrieve_transaction(transaction)
begin
case transaction
when /^sub_/
::Stripe::Subscription.retrieve(transaction)
when /^in_/
::Stripe::Invoice.retrieve(transaction)
end
rescue ::Stripe::InvalidRequestError => e
e.message
end
end
def metadata_user
{ user_id: current_user.id, username: current_user.username_lower }
end
def transaction_ok(transaction)
%w[active trialing paid].include?(transaction[:status])
end
end
end
@@ -0,0 +1,59 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module User
class PaymentsController < ::ApplicationController
include DiscourseSubscriptions::Stripe
before_action :set_api_key
requires_login
def index
begin
customer = Customer.where(user_id: current_user.id)
customer_ids = customer.map { |c| c.customer_id } if customer
product_ids = Product.all.pluck(:external_id)
data = []
if customer_ids.present? && product_ids.present?
customer_ids.each do |customer_id|
# lots of matching because the Stripe API doesn't make it easy to match products => payments except from invoices
all_invoices = ::Stripe::Invoice.list(customer: customer_id)
invoices_with_products = parse_invoices(all_invoices, product_ids)
invoice_ids = invoices_with_products.map { |invoice| invoice[:id] }
payments = ::Stripe::PaymentIntent.list(customer: customer_id)
payments_from_invoices =
payments[:data].select { |payment| invoice_ids.include?(payment[:invoice]) }
data = data | payments_from_invoices
end
end
data = data.sort_by { |pmt| pmt[:created] }.reverse
render_json_dump data
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
private
def parse_invoices(all_invoices, product_ids)
invoices_with_products =
all_invoices[:data].select do |invoice|
invoice_lines = invoice[:lines][:data][0] if invoice[:lines] && invoice[:lines][:data]
invoice_product_id = parse_invoice_lines(invoice_lines)
product_ids.include?(invoice_product_id)
end
end
def parse_invoice_lines(invoice_lines)
invoice_product_id = invoice_lines[:price][:product] if invoice_lines[:price] &&
invoice_lines[:price][:product]
invoice_product_id = invoice_lines[:plan][:product] if invoice_lines[:plan] &&
invoice_lines[:plan][:product]
invoice_product_id
end
end
end
end
@@ -0,0 +1,87 @@
# frozen_string_literal: true
module DiscourseSubscriptions
module User
class SubscriptionsController < ::ApplicationController
include DiscourseSubscriptions::Stripe
include DiscourseSubscriptions::Group
before_action :set_api_key
requires_login
def index
begin
customer = Customer.where(user_id: current_user.id)
customer_ids = customer.map { |c| c.id } if customer
subscription_ids =
Subscription.where("customer_id in (?)", customer_ids).pluck(
:external_id,
) if customer_ids
subscriptions = []
if subscription_ids
plans = ::Stripe::Price.list(expand: ["data.product"], limit: 100)
customers =
::Stripe::Customer.list(email: current_user.email, expand: ["data.subscriptions"])
subscriptions =
customers[:data].map { |sub_customer| sub_customer[:subscriptions][:data] }.flatten(1)
subscriptions = subscriptions.select { |sub| subscription_ids.include?(sub[:id]) }
subscriptions.map! do |subscription|
plan = plans[:data].find { |p| p[:id] == subscription[:items][:data][0][:price][:id] }
subscription.to_h.except!(:plan)
subscription.to_h.merge(plan: plan, product: plan[:product].to_h.slice(:id, :name))
end
end
render_json_dump subscriptions
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def destroy
# we cancel but don't remove until the end of the period
# full removal is done via webhooks
begin
subscription = ::Stripe::Subscription.update(params[:id], { cancel_at_period_end: true })
if subscription
render_json_dump subscription
else
render_json_error I18n.t("discourse_subscriptions.customer_not_found")
end
rescue ::Stripe::InvalidRequestError => e
render_json_error e.message
end
end
def update
params.require(:payment_method)
subscription = Subscription.where(external_id: params[:id]).first
begin
attach_method_to_customer(subscription.customer_id, params[:payment_method])
subscription =
::Stripe::Subscription.update(
params[:id],
{ default_payment_method: params[:payment_method] },
)
render json: success_json
rescue ::Stripe::InvalidRequestError
render_json_error I18n.t("discourse_subscriptions.card.invalid")
end
end
private
def attach_method_to_customer(customer_id, method)
customer = Customer.find(customer_id)
::Stripe::PaymentMethod.attach(method, { customer: customer.customer_id })
end
end
end
end
@@ -1,5 +0,0 @@
module DiscourseDonations
module ApplicationHelper
end
end
-1
View File
@@ -1 +0,0 @@
load File.expand_path('../regular/donation_user.rb', __FILE__)
-18
View File
@@ -1,18 +0,0 @@
module Jobs
class DonationUser < ::Jobs::Base
def execute(args)
user = User.create!(args.slice(:username, :password, :name, :email))
return unless user.persisted?
Jobs.enqueue(
:critical_user_email,
type: :signup, user_id: user.id, email_token: user.email_tokens.first.token
)
rewards = DiscourseDonations::Rewards.new(user)
args[:rewards].to_a.each do |reward|
rewards.grant_badge(reward[:name]) if reward[:type] == 'badge'
rewards.add_to_group(reward[:name]) if reward[:type] == 'group'
end
end
end
end
@@ -0,0 +1,10 @@
# frozen_string_literal: true
module ::Jobs
class ManuallyUpdateCampaignData < ::Jobs::Base
def execute(args)
return unless SiteSetting.discourse_subscriptions_campaign_enabled
DiscourseSubscriptions::Campaign.new.refresh_data
end
end
end

Some files were not shown because too many files have changed in this diff Show More