Class: BraintreeTransparentRedirectSlice::Payments

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/payments.rb

Instance Method Summary collapse

Methods included from Merb::BraintreeTransparentRedirectSlice::CreditCardsHelper

#braintree_date_reformatter, #fetch_credit_card

Instance Method Details

#new(credit_card_id) ⇒ Object



2
3
4
5
6
7
# File 'app/controllers/payments.rb', line 2

def new(credit_card_id)
  fetch_credit_card(credit_card_id)

  @gateway_request = Braintree::GatewayRequest.new(:amount => '10.00')
  render
end

#new_response(credit_card_id) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/controllers/payments.rb', line 9

def new_response(credit_card_id)
  @gateway_response = Braintree::GatewayResponse.validate(params)
  if error = @gateway_response.error
    redirect(slice_url(:new_credit_card_payment), :message => {:notice => error})
  else
    redirect(slice_url(:credit_card, credit_card_id), :message => {:notice => 'Successfully charged your Credit Card.'})
  end
end