balanced / balanced-ruby

Balanced API library in ruby.
MIT License
111 stars 47 forks source link

Fetch Balanced::FundInstrument or Allow debiting for Balanced::Customer #178

Closed taylorbrooks closed 10 years ago

taylorbrooks commented 10 years ago

I'm upgrading to v1.1 API, one of the nice things about the prior version was being able to call Balanced::Account.debit and Balanced would figure out the last valid fund instrument and take care of the rest. Now that is not possible.

It would be nice to be able to fetch a funding instrument by passing /cards/:uri or /bank_accounts/:uri and have the proper instrument returned vs. having to figure that out in app code.

Looks like that may already be a thought because this exists? https://github.com/balanced/balanced-ruby/blob/master/lib/balanced/resources/funding_instrument.rb

Or at least bring something back like, Balanced::Customer.debit.

taylorbrooks commented 10 years ago

Another thought would be allowing the Debit resource to pass source_uri as an argument, instead of first having to fetch the instrument.

mjallday commented 10 years ago

you can do that,

Debit.new(
    :source => 'uri here', 
    :amount => 100
).save

I believe that should work.

taylorbrooks commented 10 years ago

Yep, that worked. Didn't see it documented here: https://docs.balancedpayments.com/1.1/api/debits/

mjallday commented 10 years ago

Thanks for bringing it up @taylorbrooks, we've opened an issue to rectify this on the docs repo balanced/balanced-docs#396

mjallday commented 10 years ago

@taylorbrooks we've reverted a change to the docs which accidentally caused the issue. Docs should be clearer now! thanks for letting us know.