diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index f56df25..b6d3f07 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -21,6 +21,8 @@ module DiscoursePatrons group.add(current_user) end + DiscoursePatrons::Customer.create(user_id: current_user.id, customer_id: params[:customer]) + render_json_dump @subscription rescue ::Stripe::InvalidRequestError => e diff --git a/assets/javascripts/discourse/discourse-patrons-user-route-map.js.es6 b/assets/javascripts/discourse/discourse-patrons-user-route-map.js.es6 index 3024a30..f94ffbb 100644 --- a/assets/javascripts/discourse/discourse-patrons-user-route-map.js.es6 +++ b/assets/javascripts/discourse/discourse-patrons-user-route-map.js.es6 @@ -3,5 +3,6 @@ export default { path: "users/:username", map() { this.route("billing"); + this.route("subscriptions"); } }; diff --git a/assets/javascripts/discourse/routes/user-subscriptions.js.es6 b/assets/javascripts/discourse/routes/user-subscriptions.js.es6 new file mode 100644 index 0000000..e69de29 diff --git a/assets/javascripts/discourse/templates/user/billing.hbs b/assets/javascripts/discourse/templates/user/billing.hbs index d1ea854..e73da42 100644 --- a/assets/javascripts/discourse/templates/user/billing.hbs +++ b/assets/javascripts/discourse/templates/user/billing.hbs @@ -2,6 +2,13 @@
+ {{#link-to 'user.subscriptions' class="btn btn-primary"}} + {{d-icon "credit-card"}} + {{i18n 'discourse_patrons.user.subscriptions.title'}} + {{/link-to}} +
+{{i18n 'discourse_patrons.user.billing.invoices.amount'}} | diff --git a/assets/javascripts/discourse/templates/user/subscriptions.hbs b/assets/javascripts/discourse/templates/user/subscriptions.hbs new file mode 100644 index 0000000..843ddd4 --- /dev/null +++ b/assets/javascripts/discourse/templates/user/subscriptions.hbs @@ -0,0 +1,2 @@ + +
---|