diff --git a/app/controllers/admin/subscriptions_controller.rb b/app/controllers/admin/subscriptions_controller.rb
index c3ff1e4..88046cd 100644
--- a/app/controllers/admin/subscriptions_controller.rb
+++ b/app/controllers/admin/subscriptions_controller.rb
@@ -9,7 +9,7 @@ module DiscoursePatrons
def index
begin
- subscriptions = ::Stripe::Subscription.list
+ subscriptions = ::Stripe::Subscription.list(expand: ['data.plan.product'])
render_json_dump subscriptions
rescue ::Stripe::InvalidRequestError => e
diff --git a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-subscriptions.hbs b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-subscriptions.hbs
index 8a1b26d..d955732 100644
--- a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-subscriptions.hbs
+++ b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-subscriptions.hbs
@@ -4,6 +4,7 @@
{{i18n 'discourse_patrons.admin.subscriptions.subscription.user'}} |
{{i18n 'discourse_patrons.admin.subscriptions.subscription.customer'}} |
+ {{i18n 'discourse_patrons.admin.subscriptions.subscription.product'}} |
{{i18n 'discourse_patrons.admin.subscriptions.subscription.plan'}} |
{{i18n 'discourse_patrons.admin.subscriptions.subscription.status'}} |
{{i18n 'discourse_patrons.admin.subscriptions.subscription.created_at'}} |
@@ -20,7 +21,8 @@
{{/if}}
{{subscription.customer}} |
- {{subscription.plan.id}} |
+ {{subscription.plan.product.name}} |
+ {{subscription.plan.nickname}} |
{{subscription.status}} |
{{format-unix-date subscription.created}} |
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 7c00fd7..8f030a3 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -126,6 +126,7 @@ en:
user: User
subscription_id: Subscription ID
customer: Customer
+ product: Product
plan: Plan
status: Status
created_at: Created
diff --git a/spec/requests/admin/subscriptions_controller_spec.rb b/spec/requests/admin/subscriptions_controller_spec.rb
index 2f14649..2fb5aaf 100644
--- a/spec/requests/admin/subscriptions_controller_spec.rb
+++ b/spec/requests/admin/subscriptions_controller_spec.rb
@@ -27,8 +27,8 @@ module DiscoursePatrons
before { sign_in(admin) }
describe "index" do
- it "gets the subscriptions" do
- ::Stripe::Subscription.expects(:list)
+ it "gets the subscriptions and products" do
+ ::Stripe::Subscription.expects(:list).with(expand: ['data.plan.product'])
get "/patrons/admin/subscriptions.json"
expect(response.status).to eq(200)
end
|