From 570ef2fbb47460064767d98a645047d3558916b5 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Fri, 25 Oct 2019 13:55:57 +1100 Subject: [PATCH] use the billing page --- app/controllers/patrons_controller.rb | 12 ------------ .../discourse/controllers/patrons-show.js.es6 | 9 --------- .../discourse/patrons-route-map.js.es6 | 5 +---- .../discourse/routes/patrons-show.js.es6 | 7 ------- .../discourse/templates/patrons/show.hbs | 19 ------------------- config/routes.rb | 1 - 6 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 assets/javascripts/discourse/controllers/patrons-show.js.es6 delete mode 100644 assets/javascripts/discourse/routes/patrons-show.js.es6 delete mode 100644 assets/javascripts/discourse/templates/patrons/show.hbs diff --git a/app/controllers/patrons_controller.rb b/app/controllers/patrons_controller.rb index 0f2f42a..03e5890 100644 --- a/app/controllers/patrons_controller.rb +++ b/app/controllers/patrons_controller.rb @@ -17,18 +17,6 @@ module DiscoursePatrons render json: result end - def show - payment_intent = ::Stripe::PaymentIntent.retrieve(params[:pid]) - - if current_user && (current_user.admin || payment_intent[:customer] == current_user.id) - result = payment_intent - else - result = { error: 'Not found' } - end - - render json: result - end - def create begin diff --git a/assets/javascripts/discourse/controllers/patrons-show.js.es6 b/assets/javascripts/discourse/controllers/patrons-show.js.es6 deleted file mode 100644 index f75f4a7..0000000 --- a/assets/javascripts/discourse/controllers/patrons-show.js.es6 +++ /dev/null @@ -1,9 +0,0 @@ -import DiscourseURL from "discourse/lib/url"; - -export default Ember.Controller.extend({ - actions: { - goBack() { - return DiscourseURL.redirectTo("/patrons"); - } - } -}); diff --git a/assets/javascripts/discourse/patrons-route-map.js.es6 b/assets/javascripts/discourse/patrons-route-map.js.es6 index 160d1b8..2969cda 100644 --- a/assets/javascripts/discourse/patrons-route-map.js.es6 +++ b/assets/javascripts/discourse/patrons-route-map.js.es6 @@ -1,8 +1,5 @@ export default function() { this.route("patrons", function() { - this.route("subscribe", function() { - this.route("product", { path: ":product_id" }) - }); - this.route("show", { path: ":pid" }); + this.route("subscribe"); }); } diff --git a/assets/javascripts/discourse/routes/patrons-show.js.es6 b/assets/javascripts/discourse/routes/patrons-show.js.es6 deleted file mode 100644 index 36794bb..0000000 --- a/assets/javascripts/discourse/routes/patrons-show.js.es6 +++ /dev/null @@ -1,7 +0,0 @@ -import { ajax } from "discourse/lib/ajax"; - -export default Discourse.Route.extend({ - model(params) { - return ajax(`/patrons/${params.pid}`, { method: "get" }); - } -}); diff --git a/assets/javascripts/discourse/templates/patrons/show.hbs b/assets/javascripts/discourse/templates/patrons/show.hbs deleted file mode 100644 index 96632be..0000000 --- a/assets/javascripts/discourse/templates/patrons/show.hbs +++ /dev/null @@ -1,19 +0,0 @@ - -{{#unless model.error}} -

{{i18n 'discourse_patrons.heading.success' site_name=siteSettings.title}}

- -

- {{cook-text siteSettings.discourse_patrons_success_page}} -

- - - - - - - - - - -
{{i18n 'discourse_patrons.payment_intent_id'}}{{model.id}}
{{i18n 'discourse_patrons.amount'}}{{model.amount}}
-{{/unless}} diff --git a/config/routes.rb b/config/routes.rb index 2b543d5..59692a5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,5 +19,4 @@ DiscoursePatrons::Engine.routes.draw do resources :patrons, only: [:index, :create] get '/' => 'patrons#index' - get '/:pid' => 'patrons#show' end