phcdevworks_accounts_stripe 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/phcdevworks_accounts_stripe/admin/customers_controller.rb +6 -3
  3. data/app/controllers/phcdevworks_accounts_stripe/admin/products_controller.rb +16 -0
  4. data/app/controllers/phcdevworks_accounts_stripe/admin/subscriptions_controller.rb +5 -0
  5. data/app/controllers/phcdevworks_accounts_stripe/user/invoices_controller.rb +7 -1
  6. data/app/controllers/phcdevworks_accounts_stripe/user/product_controller.rb +13 -0
  7. data/app/controllers/phcdevworks_accounts_stripe/user/subscription_controller.rb +7 -2
  8. data/app/helpers/phcdevworks_accounts_stripe/application_helper.rb +16 -2
  9. data/app/views/layouts/phcdevworks_accounts_stripe/components/backend/navigation/_top_menu.html.erb +1 -1
  10. data/app/views/layouts/phcdevworks_accounts_stripe/components/backend/sidebars/_side_menu.html.erb +3 -39
  11. data/app/views/phcdevworks_accounts_stripe/admin/{plans/admin_plan_list.html.erb → products/admin_products_list.html.erb} +9 -13
  12. data/app/views/phcdevworks_accounts_stripe/admin/subscriptions/admin_subscription_list.html.erb +5 -3
  13. data/app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_item.html.erb +0 -0
  14. data/app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_list.html.erb +89 -0
  15. data/app/views/phcdevworks_accounts_stripe/user/products/user_product_list.html.erb +67 -0
  16. data/app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_cancel.html.erb +67 -0
  17. data/app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_item.html.erb +71 -0
  18. data/config/routes.rb +12 -3
  19. data/lib/phcdevworks_accounts_stripe/version.rb +1 -1
  20. metadata +12 -7
  21. data/app/controllers/phcdevworks_accounts_stripe/admin/plans_controller.rb +0 -11
  22. data/app/controllers/phcdevworks_accounts_stripe/user/plan_controller.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f12e594c041a36456acf3867cc40d7a300f729c1428adc1a79bcfcd95311804
4
- data.tar.gz: 47442a896c70be0d4ee86db165972e56eaf4166c8d49eda7c3e4e3e9ff99157a
3
+ metadata.gz: 4d712843541988e1cf6d5662452ce468800d5b2c9ed9b0042aaa604229abc33b
4
+ data.tar.gz: 8ddbe4ee2dcfcce7116cc3434f92cf89befa1d4e19934035bb1c8f2e39032218
5
5
  SHA512:
6
- metadata.gz: 4ca0a15c41713be47b0d14a84ff6128847d1db905896dc6a7da11865f2f663486c74558b14fdce781868c7be8c8f8da68814760c3d03ef449aad9055118d574d
7
- data.tar.gz: f928488ed371ec0f7e8daae0e99e75f8a1e8a37ef60ddc569196fc48759d16ac2ea6cea27ef42de21563120bf336825f9e4ad76d8c2270d9138cf74f4c6d4011
6
+ metadata.gz: 6d7a66c0ac3a7eb6d4baaa92651c61b56aa55811ad1455e484014dc518222038eeadb8174b6d8af687e929a0be6144d3f89037056676d682c5e712a12b60dccb
7
+ data.tar.gz: 9ff61ec8fa79f3267122594467eb637a32138c1868ed1dd0efcf238559ec38c1ef67dd1adeceb9b8ab5bc70d4b53a1ac704c8e64f55349f6050dc771446b8fbe
@@ -3,12 +3,15 @@ require_dependency "phcdevworks_accounts_stripe/application_controller"
3
3
  module PhcdevworksAccountsStripe
4
4
  class Admin::CustomersController < ApplicationController
5
5
 
6
+ # Filters
7
+ before_action :authenticate_user!
8
+ include PhcdevworksCore::PhcdevworksPluginsHelper
9
+ before_action :phcdevworks_accounts_admin_only
10
+
6
11
  # Customers - List
7
12
  def admin_customer_list
8
13
  @admin_customer_list = Stripe::Customer.list({limit: 100})
9
14
  end
10
-
11
-
12
-
15
+
13
16
  end
14
17
  end
@@ -0,0 +1,16 @@
1
+ require_dependency "phcdevworks_accounts_stripe/application_controller"
2
+
3
+ module PhcdevworksAccountsStripe
4
+ class Admin::ProductsController < ApplicationController
5
+
6
+ # Filters
7
+ before_action :authenticate_user!
8
+ include PhcdevworksCore::PhcdevworksPluginsHelper
9
+ before_action :phcdevworks_accounts_admin_only
10
+
11
+ def admin_products_list
12
+ @admin_products_list = Stripe::Product.list
13
+ end
14
+
15
+ end
16
+ end
@@ -3,6 +3,11 @@ require_dependency "phcdevworks_accounts_stripe/application_controller"
3
3
  module PhcdevworksAccountsStripe
4
4
  class Admin::SubscriptionsController < ApplicationController
5
5
 
6
+ # Filters
7
+ before_action :authenticate_user!
8
+ include PhcdevworksCore::PhcdevworksPluginsHelper
9
+ before_action :phcdevworks_accounts_admin_only
10
+
6
11
  def admin_subscription_list
7
12
  @admin_subscription_list = Stripe::Subscription.list({limit: 100})
8
13
  end
@@ -3,10 +3,16 @@ require_dependency "phcdevworks_accounts_stripe/application_controller"
3
3
  module PhcdevworksAccountsStripe
4
4
  class User::InvoicesController < ApplicationController
5
5
 
6
+ # Security Filters
7
+ before_action :authenticate_user!
8
+
6
9
  def user_invoice_list
10
+ @user_invoice_list = Stripe::Invoice.list({customer: current_user.stripe_customer_id})
7
11
  end
8
12
 
9
- def user_invoice_open
13
+ def user_invoice_item
14
+
15
+
10
16
  end
11
17
 
12
18
  end
@@ -0,0 +1,13 @@
1
+ require_dependency "phcdevworks_accounts_stripe/application_controller"
2
+
3
+ module PhcdevworksAccountsStripe
4
+ class User::ProductController < ApplicationController
5
+
6
+ # Security Filters
7
+ before_action :authenticate_user!
8
+
9
+ def user_product_list
10
+ end
11
+
12
+ end
13
+ end
@@ -3,10 +3,15 @@ require_dependency "phcdevworks_accounts_stripe/application_controller"
3
3
  module PhcdevworksAccountsStripe
4
4
  class User::SubscriptionController < ApplicationController
5
5
 
6
- def user_subscription_list
6
+ # Security Filters
7
+ before_action :authenticate_user!
8
+
9
+ def user_subscription_item
10
+ @user_subscription_item = Stripe::Subscription.list({customer: current_user.stripe_customer_id})
11
+
7
12
  end
8
13
 
9
- def user_subscription_remove
14
+ def user_subscription_cancel
10
15
  end
11
16
 
12
17
  end
@@ -1,4 +1,18 @@
1
1
  module PhcdevworksAccountsStripe
2
- module ApplicationHelper
3
- end
2
+ module ApplicationHelper
3
+
4
+ # PHCAccountsStripe - Invoice Status
5
+ def phcdev_invoice_status(status)
6
+ colors = {
7
+ 'draft' => 'badge badge-secondary',
8
+ 'open' => 'badge-success',
9
+ 'paid' => 'badge-green',
10
+ 'uncollectible' => 'badge-danger',
11
+ 'void' => 'badge-dark'
12
+ }
13
+ content_tag(:span, class: "badge #{colors[status]} badge-square") do
14
+ end
15
+ end
16
+
17
+ end
4
18
  end
@@ -1,7 +1,7 @@
1
1
  <!-- -PHC- Topbar - Navigation Header -->
2
2
  <div class="navbar-header">
3
3
 
4
- <%= link_to phcdevworks_accounts_stripe.admin_plans_index_path, class: "navbar-brand" do %>
4
+ <%= link_to phcdevworks_accounts_stripe.admin_products_path, class: "navbar-brand" do %>
5
5
  <strong>PHCDevworks</strong>Accounts
6
6
  <% end %>
7
7
 
@@ -277,50 +277,14 @@
277
277
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Core Modules -->
278
278
  <% end %>
279
279
 
280
- <% if defined?phcdevworks_accounts_stripe && current_user && current_user.admin %>
281
- <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
282
- <li class="nav-header">Stripe Admin</li>
283
- <li class="has-sub">
284
- <a href="javascript:;">
285
- <b class="caret"></b>
286
- <i class="fab fa-cc-stripe"></i>
287
- <span>Subscriptions</span>
288
- </a>
289
- <ul class="sub-menu">
290
- <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Subscription Index", phcdevworks_accounts_stripe.admin_subscriptions_index_path) %></li>
291
- </ul>
292
- </li>
293
- <li class="has-sub">
294
- <a href="javascript:;">
295
- <b class="caret"></b>
296
- <i class="fad fa-money-check-alt"></i>
297
- <span>Plans</span>
298
- </a>
299
- <ul class="sub-menu">
300
- <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/plans#admin_plan_list") %>"><%= link_to("Plan List", phcdevworks_accounts_stripe.admin_plans_index_path) %></li>
301
- </ul>
302
- </li>
303
- <li class="has-sub">
304
- <a href="javascript:;">
305
- <b class="caret"></b>
306
- <i class="fad fa-users"></i>
307
- <span>Customers</span>
308
- </a>
309
- <ul class="sub-menu">
310
- <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/customers#admin_customer_list") %>"><%= link_to("Customer List", phcdevworks_accounts_stripe.admin_customers_index_path) %></li>
311
- </ul>
312
- </li>
313
- <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
314
- <% end %>
315
-
280
+ <li class="nav-header">Administration</li>
316
281
  <% if current_user && current_user.admin? %>
317
282
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
318
- <li class="nav-header">User Administration</li>
319
283
  <li class="has-sub">
320
284
  <a href="javascript:;">
321
285
  <b class="caret"></b>
322
286
  <i class="fad fa-user"></i>
323
- <span>Admin</span>
287
+ <span>User Auth</span>
324
288
  </a>
325
289
  <ul class="sub-menu">
326
290
  <li class="<%= phc_menu_active_controller("phcdevworks_accounts/admin/users") %>"><%= link_to "User List", phcdevworks_accounts.admin_users_all_path %></li>
@@ -329,9 +293,9 @@
329
293
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
330
294
  <% end %>
331
295
 
296
+ <li class="nav-header">Your Account</li>
332
297
  <% if current_user %>
333
298
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts User Options -->
334
- <li class="nav-header">Your Account</li>
335
299
  <li class="has-sub">
336
300
  <a href="javascript:;">
337
301
  <b class="caret"></b>
@@ -1,6 +1,6 @@
1
1
  <!-- PHCTitleSEO Title Variables -->
2
- <% phc_title "Plan Manager" %>
3
- <% phc_title_tagline "Stripe Plan List" %>
2
+ <% phc_title "Products Manager" %>
3
+ <% phc_title_tagline "Stripe Products List" %>
4
4
  <% phc_breadcrumb_one "Home" %>
5
5
  <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
6
  <!-- PHCTitleSEO Title Variables -->
@@ -38,22 +38,18 @@
38
38
 
39
39
  <thead>
40
40
  <tr>
41
- <th>Plan Name</th>
42
- <th>Plan Product Code</th>
43
- <th>Plan Amount ($)</th>
44
- <th>Plan Currency</th>
45
- <th>Plan Interval</th>
41
+ <th>Name</th>
42
+ <th>Amount Monthly</th>
43
+ <th>Amount Anually</th>
46
44
  </tr>
47
45
  </thead>
48
46
 
49
47
  <tbody>
50
- <% @admin_plan_list.each do |plan| %>
48
+ <% @admin_products_list.each do |product| %>
51
49
  <tr>
52
- <td><%= plan.nickname %></td>
53
- <td><%= plan.product %></td>
54
- <td><%= '%.2f' % BigDecimal(plan.amount/100).to_i %></td>
55
- <td><%= plan.currency.upcase %></td>
56
- <td><%= plan.interval.capitalize %></td>
50
+ <td><%= product.name %></td>
51
+ <td><%= number_to_currency(Stripe::Price.list(product: product.id, recurring: {interval: "month"}).data[0].unit_amount/100) %></td>
52
+ <td><%= number_to_currency(Stripe::Price.list(product: product.id, recurring: {interval: "year"}).data[0].unit_amount/100) %></td>
57
53
  </tr>
58
54
  <% end %>
59
55
  </tbody>
@@ -1,6 +1,6 @@
1
1
  <!-- PHCTitleSEO Title Variables -->
2
2
  <% phc_title "Subscription Manager" %>
3
- <% phc_title_tagline "Stripe Subscription List" %>
3
+ <% phc_title_tagline "Stripe Subscriptions List" %>
4
4
  <% phc_breadcrumb_one "Home" %>
5
5
  <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
6
  <!-- PHCTitleSEO Title Variables -->
@@ -43,6 +43,7 @@
43
43
  <th>Customer Email</th>
44
44
  <th>Next Payment Date</th>
45
45
  <th>Date Created</th>
46
+ <th>Amount Due</th>
46
47
  </tr>
47
48
  </thead>
48
49
 
@@ -52,8 +53,9 @@
52
53
  <td><%= subscription.status.capitalize %></td>
53
54
  <td><%= Stripe::Customer.retrieve(subscription.customer).name %></td>
54
55
  <td><%= Stripe::Customer.retrieve(subscription.customer).email %></td>
55
- <td><%= Time.at(subscription.created).to_datetime.strftime("%m/%d/%Y") %></td>
56
- <td><%= Time.at(subscription.current_period_end).to_datetime.strftime("%m/%d/%Y") %></td>
56
+ <td><%= Time.at(subscription.created).to_datetime.strftime("%B %d, %Y") %></td>
57
+ <td><%= Time.at(subscription.current_period_end).to_datetime.strftime("%B %d, %Y") %></td>
58
+ <td><%= number_to_currency(subscription.plan.amount/100) %></td>
57
59
  </tr>
58
60
  <% end %>
59
61
  </tbody>
@@ -0,0 +1,89 @@
1
+ <!-- PHCTitleSEO Title Variables -->
2
+ <% phc_title "Invoice Manager" %>
3
+ <% phc_title_tagline "Stripe Invoice List" %>
4
+ <% phc_breadcrumb_one "Home" %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- PHCTitleSEO Title Variables -->
7
+
8
+ <!-- Page Bradcrumbs -->
9
+ <ol class="breadcrumb pull-right">
10
+ <li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
11
+ <li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
12
+ </ol>
13
+ <!-- Page Bradcrumbs -->
14
+
15
+ <!-- Page Header -->
16
+ <h2 class="page-header"><%= yield(:phc_title) %></h2>
17
+ <!-- Page Header -->
18
+
19
+ <!-- Page Content -->
20
+ <div class="row">
21
+ <div class="col-lg-12">
22
+
23
+ <!-- Panel -->
24
+ <div class="panel panel-inverse">
25
+
26
+ <!-- Panel - Heading -->
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
29
+ </div>
30
+ <!-- Panel - Heading -->
31
+
32
+ <!-- Panel - Body -->
33
+ <div class="panel-body">
34
+
35
+ <!-- Index - Table -->
36
+ <div class="table-responsive">
37
+ <table class="table table-striped table-bordered">
38
+
39
+ <thead>
40
+ <tr>
41
+ <th>Status</th>
42
+ <th>Account Name</th>
43
+ <th>Invoice Amount</th>
44
+ <th>Invoice Paid</th>
45
+ <th>Invoice Due</th>
46
+ <th>Due Date</th>
47
+ <th>Invoice PDF Download</th>
48
+ <th>Invoice Link</th>
49
+ </tr>
50
+ </thead>
51
+
52
+ <tbody>
53
+ <% @user_invoice_list.each do |user_invoice| %>
54
+ <tr>
55
+ <td><%= user_invoice.status.capitalize %></td>
56
+ <td><%= user_invoice.account_name %></td>
57
+ <td><%= number_to_currency(user_invoice.amount_due/100) %></td>
58
+ <td><%= number_to_currency(user_invoice.amount_paid/100) %></td>
59
+ <td><%= number_to_currency(user_invoice.amount_remaining/100) %></td>
60
+ <td><%= Time.at(user_invoice.due_date).to_datetime.strftime("%B %d, %Y") %></td>
61
+ <td>
62
+ <i class="fad fa-external-link"></i>
63
+ <%= link_to user_invoice.invoice_pdf, target: "_blank" do %>
64
+ Invoice #: <%= user_invoice.number %>
65
+ <% end %>
66
+ </td>
67
+ <td>
68
+ <i class="fad fa-external-link"></i>
69
+ <%= link_to user_invoice.hosted_invoice_url, target: "_blank" do %>
70
+ Invoice #: <%= user_invoice.number %>
71
+ <% end %>
72
+ </td>
73
+ </tr>
74
+ <% end %>
75
+ </tbody>
76
+
77
+ </table>
78
+ </div>
79
+ <!-- Index - Table -->
80
+
81
+ </div>
82
+ <!-- Panel - Body -->
83
+
84
+ </div>
85
+ <!-- Panel -->
86
+
87
+ </div>
88
+ </div>
89
+ <!-- Page Content -->
@@ -0,0 +1,67 @@
1
+ <!-- PHCTitleSEO Title Variables -->
2
+ <% phc_title "Customer Manager" %>
3
+ <% phc_title_tagline "Stripe Customer List" %>
4
+ <% phc_breadcrumb_one "Home" %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- PHCTitleSEO Title Variables -->
7
+
8
+ <!-- Page Bradcrumbs -->
9
+ <ol class="breadcrumb pull-right">
10
+ <li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
11
+ <li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
12
+ </ol>
13
+ <!-- Page Bradcrumbs -->
14
+
15
+ <!-- Page Header -->
16
+ <h2 class="page-header"><%= yield(:phc_title) %></h2>
17
+ <!-- Page Header -->
18
+
19
+ <!-- Page Content -->
20
+ <div class="row">
21
+ <div class="col-lg-12">
22
+
23
+ <!-- Panel -->
24
+ <div class="panel panel-inverse">
25
+
26
+ <!-- Panel - Heading -->
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
29
+ </div>
30
+ <!-- Panel - Heading -->
31
+
32
+ <!-- Panel - Body -->
33
+ <div class="panel-body">
34
+
35
+ <!-- Index - Table -->
36
+ <div class="table-responsive">
37
+ <table class="table table-striped table-bordered">
38
+
39
+ <thead>
40
+ <tr>
41
+ <th>Customer Name</th>
42
+ <th>Customer Email</th>
43
+ </tr>
44
+ </thead>
45
+
46
+ <tbody>
47
+ <% @admin_customer_list.each do |customers| %>
48
+ <tr>
49
+ <td><%= customers.name %></td>
50
+ <td><%= customers.email %></td>
51
+ </tr>
52
+ <% end %>
53
+ </tbody>
54
+
55
+ </table>
56
+ </div>
57
+ <!-- Index - Table -->
58
+
59
+ </div>
60
+ <!-- Panel - Body -->
61
+
62
+ </div>
63
+ <!-- Panel -->
64
+
65
+ </div>
66
+ </div>
67
+ <!-- Page Content -->
@@ -0,0 +1,67 @@
1
+ <!-- PHCTitleSEO Title Variables -->
2
+ <% phc_title "Customer Manager" %>
3
+ <% phc_title_tagline "Stripe Customer List" %>
4
+ <% phc_breadcrumb_one "Home" %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- PHCTitleSEO Title Variables -->
7
+
8
+ <!-- Page Bradcrumbs -->
9
+ <ol class="breadcrumb pull-right">
10
+ <li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
11
+ <li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
12
+ </ol>
13
+ <!-- Page Bradcrumbs -->
14
+
15
+ <!-- Page Header -->
16
+ <h2 class="page-header"><%= yield(:phc_title) %></h2>
17
+ <!-- Page Header -->
18
+
19
+ <!-- Page Content -->
20
+ <div class="row">
21
+ <div class="col-lg-12">
22
+
23
+ <!-- Panel -->
24
+ <div class="panel panel-inverse">
25
+
26
+ <!-- Panel - Heading -->
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
29
+ </div>
30
+ <!-- Panel - Heading -->
31
+
32
+ <!-- Panel - Body -->
33
+ <div class="panel-body">
34
+
35
+ <!-- Index - Table -->
36
+ <div class="table-responsive">
37
+ <table class="table table-striped table-bordered">
38
+
39
+ <thead>
40
+ <tr>
41
+ <th>Customer Name</th>
42
+ <th>Customer Email</th>
43
+ </tr>
44
+ </thead>
45
+
46
+ <tbody>
47
+ <% @admin_customer_list.each do |customers| %>
48
+ <tr>
49
+ <td><%= customers.name %></td>
50
+ <td><%= customers.email %></td>
51
+ </tr>
52
+ <% end %>
53
+ </tbody>
54
+
55
+ </table>
56
+ </div>
57
+ <!-- Index - Table -->
58
+
59
+ </div>
60
+ <!-- Panel - Body -->
61
+
62
+ </div>
63
+ <!-- Panel -->
64
+
65
+ </div>
66
+ </div>
67
+ <!-- Page Content -->
@@ -0,0 +1,71 @@
1
+ <!-- PHCTitleSEO Title Variables -->
2
+ <% phc_title "Current Subscription" %>
3
+ <% phc_title_tagline "Information on Your Subscription" %>
4
+ <% phc_breadcrumb_one "Home" %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- PHCTitleSEO Title Variables -->
7
+
8
+ <!-- Page Bradcrumbs -->
9
+ <ol class="breadcrumb pull-right">
10
+ <li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
11
+ <li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
12
+ </ol>
13
+ <!-- Page Bradcrumbs -->
14
+
15
+ <!-- Page Header -->
16
+ <h2 class="page-header"><%= yield(:phc_title) %></h2>
17
+ <!-- Page Header -->
18
+
19
+ <!-- Page Content -->
20
+ <div class="row">
21
+ <div class="col-lg-12">
22
+
23
+ <!-- Panel -->
24
+ <div class="panel panel-inverse">
25
+
26
+ <!-- Panel - Heading -->
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
29
+ </div>
30
+ <!-- Panel - Heading -->
31
+
32
+ <!-- Panel - Body -->
33
+ <div class="panel-body">
34
+
35
+ <!-- Index - Table -->
36
+ <div class="table-responsive">
37
+ <table class="table table-striped table-bordered">
38
+
39
+ <thead>
40
+ <tr>
41
+ <th>Status</th>
42
+ <th>Start Date</th>
43
+ <th>Next Charge Date</th>
44
+ <th>Amount Due ($)</th>
45
+ </tr>
46
+ </thead>
47
+
48
+ <tbody>
49
+ <% @user_subscription_item.each do |subscription_item| %>
50
+ <tr>
51
+ <td><%= subscription_item.status.capitalize %></td>
52
+ <td><%= Time.at(subscription_item.created).to_datetime.strftime("%B %d, %Y") %></td>
53
+ <td><%= Time.at(subscription_item.current_period_end).to_datetime.strftime("%B %d, %Y") %></td>
54
+ <td><%= '%.2f' % BigDecimal(subscription_item.plan.amount/100).to_i + ' ' + subscription_item.plan.currency.upcase %></td>
55
+ </tr>
56
+ <% end %>
57
+ </tbody>
58
+
59
+ </table>
60
+ </div>
61
+ <!-- Index - Table -->
62
+
63
+ </div>
64
+ <!-- Panel - Body -->
65
+
66
+ </div>
67
+ <!-- Panel -->
68
+
69
+ </div>
70
+ </div>
71
+ <!-- Page Content -->
data/config/routes.rb CHANGED
@@ -1,7 +1,16 @@
1
1
  PhcdevworksAccountsStripe::Engine.routes.draw do
2
2
 
3
- match "/admin/customers/index", to: "admin/customers#admin_customer_list", via: "get"
4
- match "/admin/plans/index", to: "admin/plans#admin_plan_list", via: "get"
5
- match "/admin/subscriptions/index", to: "admin/subscriptions#admin_subscription_list", via: "get"
3
+ # User Routes
4
+ match "/user/subscription", to: "user/subscription#user_subscription_item", via: "get"
5
+ match "/user/plan", to: "user/plans#user_plan_list", via: "get"
6
+ match "/user/invoices", to: "user/invoices#user_invoice_list", via: "get"
7
+
8
+ # Admin Routes
9
+ match "/admin/customers", to: "admin/customers#admin_customer_list", via: "get"
10
+ match "/admin/products", to: "admin/products#admin_products_list", via: "get"
11
+ match "/admin/subscriptions", to: "admin/subscriptions#admin_subscription_list", via: "get"
12
+
13
+ # Mount Routes
14
+ mount PhcdevworksAccounts::Engine, :at => '/'
6
15
 
7
16
  end
@@ -1,3 +1,3 @@
1
1
  module PhcdevworksAccountsStripe
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phcdevworks_accounts_stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - PHCDevworks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-02 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '3.0'
243
+ version: '3.1'
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '3.0'
250
+ version: '3.1'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: factory_bot_rails
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -337,11 +337,11 @@ files:
337
337
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/plan.css
338
338
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/subscription.css
339
339
  - app/controllers/phcdevworks_accounts_stripe/admin/customers_controller.rb
340
- - app/controllers/phcdevworks_accounts_stripe/admin/plans_controller.rb
340
+ - app/controllers/phcdevworks_accounts_stripe/admin/products_controller.rb
341
341
  - app/controllers/phcdevworks_accounts_stripe/admin/subscriptions_controller.rb
342
342
  - app/controllers/phcdevworks_accounts_stripe/application_controller.rb
343
343
  - app/controllers/phcdevworks_accounts_stripe/user/invoices_controller.rb
344
- - app/controllers/phcdevworks_accounts_stripe/user/plan_controller.rb
344
+ - app/controllers/phcdevworks_accounts_stripe/user/product_controller.rb
345
345
  - app/controllers/phcdevworks_accounts_stripe/user/subscription_controller.rb
346
346
  - app/helpers/phcdevworks_accounts_stripe/admin/customers_helper.rb
347
347
  - app/helpers/phcdevworks_accounts_stripe/admin/plans_helper.rb
@@ -358,8 +358,13 @@ files:
358
358
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/navigation/_top_menu.html.erb
359
359
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/sidebars/_side_menu.html.erb
360
360
  - app/views/phcdevworks_accounts_stripe/admin/customers/admin_customer_list.html.erb
361
- - app/views/phcdevworks_accounts_stripe/admin/plans/admin_plan_list.html.erb
361
+ - app/views/phcdevworks_accounts_stripe/admin/products/admin_products_list.html.erb
362
362
  - app/views/phcdevworks_accounts_stripe/admin/subscriptions/admin_subscription_list.html.erb
363
+ - app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_item.html.erb
364
+ - app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_list.html.erb
365
+ - app/views/phcdevworks_accounts_stripe/user/products/user_product_list.html.erb
366
+ - app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_cancel.html.erb
367
+ - app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_item.html.erb
363
368
  - config/initializers/stripe.rb
364
369
  - config/routes.rb
365
370
  - lib/phcdevworks_accounts_stripe.rb
@@ -1,11 +0,0 @@
1
- require_dependency "phcdevworks_accounts_stripe/application_controller"
2
-
3
- module PhcdevworksAccountsStripe
4
- class Admin::PlansController < ApplicationController
5
-
6
- def admin_plan_list
7
- @admin_plan_list = Stripe::Plan.list({limit: 100})
8
- end
9
-
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- require_dependency "phcdevworks_accounts_stripe/application_controller"
2
-
3
- module PhcdevworksAccountsStripe
4
- class User::PlanController < ApplicationController
5
-
6
- def user_plan_list
7
- end
8
-
9
- def user_plan_switch
10
- end
11
-
12
- end
13
- end