Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balanced::BankAccount#debit undefined method `account' #137

Open
ginter opened this issue Jan 17, 2014 · 1 comment
Open

Balanced::BankAccount#debit undefined method `account' #137

ginter opened this issue Jan 17, 2014 · 1 comment

Comments

@ginter
Copy link

ginter commented Jan 17, 2014

I get an undefined method account when trying to debit a bank account.

From looking through the library, BankAccount#debit forwards to account.debit, but the API doesn't seem to include an account resource in the response, only a customer resource, so the method is never dynamically created.

The card resource, on the other hand, does include both an account and a customer resource, so that works fine.

The docs mirror this as well -
https://docs.balancedpayments.com/current/api.html?language=ruby#retrieve-a-bank-account
https://docs.balancedpayments.com/current/api.html?language=ruby#retrieve-a-card

@mjallday
Copy link
Contributor

Chris, is the bank account associated to a customer? If not that will be the issue. This is a bug within the ruby client library. It should use its own debits_uri to create the debit, not the account. We'll get that fixed.

As a work around you should be able to use the following code:

bank_account = Balanced::BankAccount.find('....')
debit = Balanced::Debit.new(
    :uri => bank_account.debits_uri,
    :amount => 100,
    :appears_on_statement_as => 'foo',
    :description => 'bar',
).save

We a similar issue in the python client. Probably a lesson to be learnt here...

@remear remear added the 1.0 label Apr 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants