Skip to content

Commit 99cef12

Browse files
committed
Show account balance/credit
1 parent b5eb89a commit 99cef12

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

app/views/subscriptions/information.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if @selected_plan.nil? %>
22
<% cents_due_now = 0 %>
3-
<div class="card teal lighten-1 white-text" style="padding: 20px;">
3+
<div class="card light-blue white-text" style="padding: 20px;">
44
Saving a payment method allows you to freely switch between Notebook.ai subscription plans with ease. Your information is stored securely in our payment processing provider, Stripe, and will not be shared with any other parties.
55
</div>
66
<% else %>

app/views/subscriptions/new.html.erb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,17 @@
277277
but since we don't store it locally, you cannot edit it. You can choose to add a new one (replacing the old),
278278
or delete the existing one.
279279
</p>
280-
<p>
281-
<%= link_to "Add new payment method", payment_info_path, class: 'btn white black-text' %>
282-
</p>
283-
<p>
284-
<%= link_to "Delete existing payment method", delete_payment_method_path, class: 'btn white black-text' %>
285-
</p>
286280
<% end %>
287281
</div>
288282
</div>
289283
</div>
284+
<% if @stripe_customer.sources.total_count > 0 %>
285+
<div class="card-action">
286+
<%= link_to "Add new payment method", payment_info_path %>
287+
<%= link_to "Delete existing payment method", delete_payment_method_path %>
288+
289+
</div>
290+
<% end %>
290291
</div>
291292
</div>
292293
</div>
@@ -318,7 +319,13 @@
318319

319320
<div class="card">
320321
<div class="card-content">
321-
<div class="card-title">Billing history</div>
322+
<div class="card-title">
323+
<div class="right">
324+
<% account_balance = @stripe_customer.account_balance %>
325+
<%= 'Outstanding balance:' if account_balance > 0 %> <%= number_to_currency(account_balance.abs / 100.0) if account_balance != 0 %> <%= 'credit' if account_balance < 0 %>
326+
</div>
327+
Billing history
328+
</div>
322329
<table class="bordered">
323330
<thead>
324331
<tr>

0 commit comments

Comments
 (0)