Skip to content

Commit

Permalink
Create account.reject method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Sabo committed Mar 14, 2016
1 parent b17cf0b commit 2c0f6bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/stripe/account.rb
Expand Up @@ -28,6 +28,12 @@ def self.retrieve(id=ARGUMENT_NOT_PROVIDED, opts={})
super(id, opts)
end

def reject(params={}, opts={})
opts = Util.normalize_opts(opts)
response, opts = request(:post, resource_url + '/reject', params, opts)
initialize_from(response, opts)
end

# Somewhat unfortunately, we attempt to do a special encoding trick when
# serializing `additional_owners` under an account: when updating a value,
# we actually send the update parameters up as an integer-indexed hash
Expand Down
16 changes: 16 additions & 0 deletions test/stripe/account_test.rb
Expand Up @@ -52,6 +52,22 @@ class AccountTest < Test::Unit::TestCase
assert_equal 'secret-key', account.keys.secret
end

should "be rejectable" do
account_data = {:id => 'acct_foo'}
@mock.expects(:get).
once.
with('https://api.stripe.com/v1/accounts/acct_foo', nil, nil).
returns(make_response(account_data))

@mock.expects(:post).
once.
with("https://api.stripe.com/v1/accounts/acct_foo/reject", nil, 'reason=fraud').
returns(make_response(account_data))

account = Stripe::Account.retrieve('acct_foo')
account.reject(:reason => 'fraud')
end

should "be updatable" do
resp = {
:id => 'acct_foo',
Expand Down

0 comments on commit 2c0f6bc

Please sign in to comment.