Skip to content

Commit

Permalink
Merge pull request #4590 from fjordllc/feature/billing_portal
Browse files Browse the repository at this point in the history
お支払い情報ページを追加
  • Loading branch information
komagata authored Apr 11, 2022
2 parents b265c77 + 1c30120 commit a55ba9f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
10 changes: 10 additions & 0 deletions app/controllers/billing_portal_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

class BillingPortalController < ApplicationController
before_action :require_login

def create
session = Stripe::BillingPortal::Session.create(customer: current_user.customer_id)
redirect_to session.url
end
end
2 changes: 2 additions & 0 deletions app/views/application/_user_menu.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
| 登録情報変更
- if !current_user.adviser? && !current_user.mentor? && !current_user.trainee?
- if current_user.card?
li.header-dropdown__item
= link_to 'お支払い情報', billing_portal_path, method: :post, class: 'header-dropdown__item-link'
li.header-dropdown__item
= link_to 'クレジットカード情報', card_path, class: 'header-dropdown__item-link'
li.header-dropdown__item
Expand Down
19 changes: 9 additions & 10 deletions app/views/card/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
header.page-header
.container
.page-header__inner
h2.page-header__title = title
h2.page-header__title
= title

.page-body
.container
.auth-form.is-sign-up.a-card.is-in-app
.a-card
header.auth-form__header
h1.auth-form__title
| クレジットカード変更
.auth-form__body
= render 'form', action: :edit
= render 'notice'
.auth-form.is-sign-up.a-card.is-in-app
header.auth-form__header
h1.auth-form__title
| クレジットカード変更
.auth-form__body
= render 'form', action: :edit
= render 'notice'
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
resources :products, only: %i(index), controller: "companies/products"
end
resources :generations, only: %i(show index)
resource :billing_portal, only: :create, controller: "billing_portal"
get "articles/tags/:tag", to: "articles#index", as: :tag, tag: /.+/
get "pages/tags/:tag", to: "pages#index", as: :pages_tag, tag: /.+/, format: "html"
get "questions/tags/:tag", to: "questions#index", as: :questions_tag, tag: /.+/, format: "html"
Expand Down

0 comments on commit a55ba9f

Please sign in to comment.