show product and plan nickname in admin

This commit is contained in:
Rimian Perkins 2019-11-26 12:55:49 +11:00
parent 7340bf5bc5
commit 3e4fd76891
4 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@
<tr>
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.user'}}</th>
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.customer'}}</th>
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.product'}}</th>
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.plan'}}</th>
<th>{{i18n 'discourse_patrons.admin.subscriptions.subscription.status'}}</th>
<th class="td-right">{{i18n 'discourse_patrons.admin.subscriptions.subscription.created_at'}}</th>
@ -20,7 +21,8 @@
{{/if}}
</td>
<td>{{subscription.customer}}</td>
<td>{{subscription.plan.id}}</td>
<td>{{subscription.plan.product.name}}</td>
<td>{{subscription.plan.nickname}}</td>
<td>{{subscription.status}}</td>
<td class="td-right">{{format-unix-date subscription.created}}</td>
<td class="td-right">

View File

@ -126,6 +126,7 @@ en:
user: User
subscription_id: Subscription ID
customer: Customer
product: Product
plan: Plan
status: Status
created_at: Created

View File

@ -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