Class: Account::Oauth::StripeAccountsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/account/oauth/stripe_accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /account/oauth/stripe_accounts/:id DELETE /account/oauth/stripe_accounts/:id.json



42
43
44
45
46
47
48
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 42

def destroy
  @stripe_account.update(user: nil)
  respond_to do |format|
    format.html { redirect_to [:account, @user, :oauth, :stripe_accounts], notice: I18n.t("oauth/stripe_accounts.notifications.destroyed") }
    format.json { head :no_content }
  end
end

#editObject

GET /account/oauth/stripe_accounts/:id/edit



23
24
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 23

def edit
end

#indexObject

GET /account/users/:user_id/oauth/stripe_accounts GET /account/users/:user_id/oauth/stripe_accounts.json



6
7
8
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 6

def index
  redirect_to [:edit, :account, @user]
end

#newObject

GET /account/users/:user_id/oauth/stripe_accounts/new



19
20
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 19

def new
end

#showObject

GET /account/oauth/stripe_accounts/:id GET /account/oauth/stripe_accounts/:id.json



12
13
14
15
16
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 12

def show
  unless @stripe_account.integrations_stripe_installations.any?
    redirect_to [:edit, :account, @user]
  end
end

#updateObject

PATCH/PUT /account/oauth/stripe_accounts/:id PATCH/PUT /account/oauth/stripe_accounts/:id.json



28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/account/oauth/stripe_accounts_controller.rb', line 28

def update
  respond_to do |format|
    if @stripe_account.update()
      format.html { redirect_to [:account, @stripe_account], notice: I18n.t("oauth/stripe_accounts.notifications.updated") }
      format.json { render :show, status: :ok, location: [:account, @stripe_account] }
    else
      format.html { render :edit, status: :unprocessable_entity }
      format.json { render json: @stripe_account.errors, status: :unprocessable_entity }
    end
  end
end