mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-27 00:03:06 -05:00
Merge pull request #345 from iloveitaly/verify-bank-account
Adding BankAccount#verify
This commit is contained in:
commit
c1c5b56762
@ -4,6 +4,11 @@ module Stripe
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
def verify(params={}, opts={})
|
||||
response, opts = request(:post, url + '/verify', params, opts)
|
||||
initialize_from(response, opts)
|
||||
end
|
||||
|
||||
def url
|
||||
if respond_to?(:customer)
|
||||
"#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
|
||||
21
test/stripe/bank_account_test.rb
Normal file
21
test/stripe/bank_account_test.rb
Normal file
@ -0,0 +1,21 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
module Stripe
|
||||
class BankAccountTest < Test::Unit::TestCase
|
||||
|
||||
should 'be verifiable' do
|
||||
bank = Stripe::BankAccount.construct_from({
|
||||
:id => 'ba_foo',
|
||||
:customer => 'cus_bar'
|
||||
})
|
||||
|
||||
@mock.expects(:post).
|
||||
once.
|
||||
with('https://api.stripe.com/v1/customers/cus_bar/sources/ba_foo/verify', nil, 'amounts[]=1&amounts[]=2').
|
||||
returns(make_response(:status => 'verified'))
|
||||
|
||||
bank.verify(:amounts => [1,2])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user