Created
July 29, 2014 12:00
rails balanced troubleshooting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
undefined local variable or method `card_href' for #<PayController:0x00000105199190> | |
bombing on this line: | |
card = Balanced::Card.fetch(card_href) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PayController < ApplicationController | |
require 'balanced' | |
before_action :authorize_admin, only: [:paytest] | |
def paytest | |
Balanced.configure('ak-test-21bWfAC3dvIUE9uVhZu0u7IGMtVIOzkUV') | |
card = Balanced::Card.new( | |
:name => 'John Doe', | |
:expiration_month => '12', | |
:number => '5105105105105100', | |
:expiration_year => '2020', | |
:security_code => '123' | |
).save | |
# card_href is the stored href for the Card | |
card = Balanced::Card.fetch(card_href) | |
card.debit( | |
:amount => 10, | |
:appears_on_statement_as => 'Statement text', | |
:description => 'Some descriptive text for the debit in the dashboard' | |
) | |
@escrow = Balanced::Marketplace.mine.in_escrow | |
end | |
private | |
def authorize_admin | |
if !current_user.try(:admin?) | |
redirect_to :controller => :'/home', :action => :index | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment