Class: Payola::CardsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/payola/cards_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/payola/cards_controller.rb', line 6

def create
  if params[:customer_id].present? && params[:stripeToken].present?
    Payola::CreateCard.call(params[:customer_id], params[:stripeToken])
    flash_options = { notice: t('payola.cards.created') }
  else
    flash_options = { alert: t('payola.cards.not_created') }
  end
  redirect_to return_to, flash: flash_options
end

#destroyObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/payola/cards_controller.rb', line 16

def destroy
  if params[:id].present? && params[:customer_id].present?
    Payola::DestroyCard.call(params[:id], params[:customer_id])
    flash_options = { notice: t('payola.cards.destroyed') }
  else
    flash_options = { alert: t('payola.cards.not_destroyed') }
  end
  redirect_to return_to, flash: flash_options
end