mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-01 00:00:30 -04:00
Merge pull request #446 from stripe/will-add-source-functionality
Add Source functionality
This commit is contained in:
commit
830e2baf42
@ -56,6 +56,7 @@ require 'stripe/order'
|
||||
require 'stripe/order_return'
|
||||
require 'stripe/alipay_account'
|
||||
require 'stripe/three_d_secure'
|
||||
require 'stripe/source'
|
||||
|
||||
# Errors
|
||||
require 'stripe/errors/stripe_error'
|
||||
|
11
lib/stripe/source.rb
Normal file
11
lib/stripe/source.rb
Normal file
@ -0,0 +1,11 @@
|
||||
module Stripe
|
||||
class Source < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
def verify(params={}, opts={})
|
||||
response, opts = request(:post, resource_url + '/verify', params, opts)
|
||||
initialize_from(response, opts)
|
||||
end
|
||||
end
|
||||
end
|
18
test/stripe/source_test.rb
Normal file
18
test/stripe/source_test.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
module Stripe
|
||||
class SourceTest < Test::Unit::TestCase
|
||||
should 'be verifiable' do
|
||||
source = Stripe::Source.construct_from({
|
||||
:id => 'ba_foo',
|
||||
})
|
||||
|
||||
@mock.expects(:post).
|
||||
once.
|
||||
with('https://api.stripe.com/v1/sources/ba_foo/verify', nil, 'amounts[]=1&amounts[]=2').
|
||||
returns(make_response(:status => 'verified'))
|
||||
|
||||
source.verify(:amounts => [1,2])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user