phcdevworks_accounts_stripe 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) 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/{plan_controller.rb → product_controller.rb} +3 -3
  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 +33 -7
  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 +24 -5
  21. data/app/controllers/phcdevworks_accounts_stripe/admin/plans_controller.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f12e594c041a36456acf3867cc40d7a300f729c1428adc1a79bcfcd95311804
4
- data.tar.gz: 47442a896c70be0d4ee86db165972e56eaf4166c8d49eda7c3e4e3e9ff99157a
3
+ metadata.gz: 6906062cfd9ea75500dad58f0d9a305c79f6e3a842aff5fca60f484a99f17783
4
+ data.tar.gz: b3d87d270e59fbb7b3b18c7a2b77dfe61002b1b7ae3a98f730ad3a3f2b49d368
5
5
  SHA512:
6
- metadata.gz: 4ca0a15c41713be47b0d14a84ff6128847d1db905896dc6a7da11865f2f663486c74558b14fdce781868c7be8c8f8da68814760c3d03ef449aad9055118d574d
7
- data.tar.gz: f928488ed371ec0f7e8daae0e99e75f8a1e8a37ef60ddc569196fc48759d16ac2ea6cea27ef42de21563120bf336825f9e4ad76d8c2270d9138cf74f4c6d4011
6
+ metadata.gz: c041e998ca1f55f95387cb28bf1a087ac613ebd54ad7504af7919e17b94fee95ae44cc1b6cafb0bef170bdc4663091c03fde1e90cff798b2bcad822f5e9e1013
7
+ data.tar.gz: b65503dc7ff44add48602c083326d5e95ee16ac16bb6d1c20b41ed9386331b923807c21e2ebe6a7a1cbbd152bdbb8f94c43a2251d83b71cce419f5cb3aada9b2
@@ -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
@@ -3,10 +3,10 @@ require_dependency "phcdevworks_accounts_stripe/application_controller"
3
3
  module PhcdevworksAccountsStripe
4
4
  class User::PlanController < ApplicationController
5
5
 
6
- def user_plan_list
7
- end
6
+ # Security Filters
7
+ before_action :authenticate_user!
8
8
 
9
- def user_plan_switch
9
+ def user_product_list
10
10
  end
11
11
 
12
12
  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,9 +277,9 @@
277
277
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Core Modules -->
278
278
  <% end %>
279
279
 
280
+ <li class="nav-header">Administration</li>
280
281
  <% if defined?phcdevworks_accounts_stripe && current_user && current_user.admin %>
281
282
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
282
- <li class="nav-header">Stripe Admin</li>
283
283
  <li class="has-sub">
284
284
  <a href="javascript:;">
285
285
  <b class="caret"></b>
@@ -287,7 +287,7 @@
287
287
  <span>Subscriptions</span>
288
288
  </a>
289
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>
290
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Subscription Index", phcdevworks_accounts_stripe.admin_subscriptions_path) %></li>
291
291
  </ul>
292
292
  </li>
293
293
  <li class="has-sub">
@@ -297,7 +297,7 @@
297
297
  <span>Plans</span>
298
298
  </a>
299
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>
300
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_products_list") %>"><%= link_to("Product List", phcdevworks_accounts_stripe.admin_products_path) %></li>
301
301
  </ul>
302
302
  </li>
303
303
  <li class="has-sub">
@@ -307,7 +307,7 @@
307
307
  <span>Customers</span>
308
308
  </a>
309
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>
310
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/customers#admin_customer_list") %>"><%= link_to("Customer List", phcdevworks_accounts_stripe.admin_customers_path) %></li>
311
311
  </ul>
312
312
  </li>
313
313
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
@@ -315,12 +315,11 @@
315
315
 
316
316
  <% if current_user && current_user.admin? %>
317
317
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
318
- <li class="nav-header">User Administration</li>
319
318
  <li class="has-sub">
320
319
  <a href="javascript:;">
321
320
  <b class="caret"></b>
322
321
  <i class="fad fa-user"></i>
323
- <span>Admin</span>
322
+ <span>User Auth</span>
324
323
  </a>
325
324
  <ul class="sub-menu">
326
325
  <li class="<%= phc_menu_active_controller("phcdevworks_accounts/admin/users") %>"><%= link_to "User List", phcdevworks_accounts.admin_users_all_path %></li>
@@ -329,9 +328,36 @@
329
328
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
330
329
  <% end %>
331
330
 
331
+ <li class="nav-header">Your Account</li>
332
+ <% if defined?phcdevworks_accounts_stripe && current_user %>
333
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
334
+ <li class="has-sub">
335
+ <a href="javascript:;">
336
+ <b class="caret"></b>
337
+ <i class="fad fa-money-check-alt"></i>
338
+ <span>Plan Settings</span>
339
+ </a>
340
+ <ul class="sub-menu">
341
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Your Subscription", phcdevworks_accounts_stripe.user_subscription_path) %></li>
342
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_product_list") %>"><%= link_to("Switch Subscriptions", phcdevworks_accounts_stripe.user_subscription_path) %></li>
343
+ </ul>
344
+ </li>
345
+ <li class="has-sub">
346
+ <a href="javascript:;">
347
+ <b class="caret"></b>
348
+ <i class="fad fa-file-invoice"></i>
349
+ <span>Invoices</span>
350
+ </a>
351
+ <ul class="sub-menu">
352
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Current Invoice", phcdevworks_accounts_stripe.user_invoices_path) %></li>
353
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Past Invoices", phcdevworks_accounts_stripe.admin_customers_path) %></li>
354
+ </ul>
355
+ </li>
356
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
357
+ <% end %>
358
+
332
359
  <% if current_user %>
333
360
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts User Options -->
334
- <li class="nav-header">Your Account</li>
335
361
  <li class="has-sub">
336
362
  <a href="javascript:;">
337
363
  <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.1'
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.1
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-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: phcdevworks_core_modules
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '7.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '7.1'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: wicked
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -337,11 +351,11 @@ files:
337
351
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/plan.css
338
352
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/subscription.css
339
353
  - app/controllers/phcdevworks_accounts_stripe/admin/customers_controller.rb
340
- - app/controllers/phcdevworks_accounts_stripe/admin/plans_controller.rb
354
+ - app/controllers/phcdevworks_accounts_stripe/admin/products_controller.rb
341
355
  - app/controllers/phcdevworks_accounts_stripe/admin/subscriptions_controller.rb
342
356
  - app/controllers/phcdevworks_accounts_stripe/application_controller.rb
343
357
  - app/controllers/phcdevworks_accounts_stripe/user/invoices_controller.rb
344
- - app/controllers/phcdevworks_accounts_stripe/user/plan_controller.rb
358
+ - app/controllers/phcdevworks_accounts_stripe/user/product_controller.rb
345
359
  - app/controllers/phcdevworks_accounts_stripe/user/subscription_controller.rb
346
360
  - app/helpers/phcdevworks_accounts_stripe/admin/customers_helper.rb
347
361
  - app/helpers/phcdevworks_accounts_stripe/admin/plans_helper.rb
@@ -358,8 +372,13 @@ files:
358
372
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/navigation/_top_menu.html.erb
359
373
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/sidebars/_side_menu.html.erb
360
374
  - 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
375
+ - app/views/phcdevworks_accounts_stripe/admin/products/admin_products_list.html.erb
362
376
  - app/views/phcdevworks_accounts_stripe/admin/subscriptions/admin_subscription_list.html.erb
377
+ - app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_item.html.erb
378
+ - app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_list.html.erb
379
+ - app/views/phcdevworks_accounts_stripe/user/products/user_product_list.html.erb
380
+ - app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_cancel.html.erb
381
+ - app/views/phcdevworks_accounts_stripe/user/subscription/user_subscription_item.html.erb
363
382
  - config/initializers/stripe.rb
364
383
  - config/routes.rb
365
384
  - 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