Class: Payola::CardsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

[View source]

6
7
8
9
10
11
12
13
# 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])
    redirect_to return_to, notice: "Succesfully created new card"
  else
    redirect_to return_to, alert: "Could not create new card"
  end  
end

#destroyObject

[View source]

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

def destroy
  if params[:id].present? && params[:customer_id].present?
    Payola::DestroyCard.call(params[:id], params[:customer_id])
    redirect_to return_to, notice: "Succesfully removed the card"
  else
    redirect_to return_to, alert: "Could not remove the card"
  end  
end