Merge pull request #409 from stripe/br-charge-outcomes

add test for handling of charge.outcome subfield
This commit is contained in:
Brandur 2016-04-11 15:23:43 -07:00
commit 2663e9ff85
2 changed files with 13 additions and 1 deletions

View File

@ -72,6 +72,12 @@ module Stripe
assert c.card.kind_of?(Stripe::StripeObject) && c.card.object == 'card'
end
should "charges should have Outcome objects associated with their outcome property" do
@mock.expects(:get).once.returns(make_response(make_charge))
c = Stripe::Charge.retrieve("test_charge")
assert c.outcome.kind_of?(Stripe::StripeObject) && c.outcome.type == 'authorized'
end
should "execute should return a new, fully executed charge when passed correct `card` parameters" do
@mock.expects(:post).with do |url, api_key, params|
url == "#{Stripe.api_base}/v1/charges" && api_key.nil? && CGI.parse(params) == {

View File

@ -152,7 +152,13 @@ module Stripe
:object => "charge",
:created => 1304114826,
:refunds => make_refund_array(id),
:metadata => {}
:metadata => {},
:outcome => {
type: 'authorized',
reason: nil,
seller_message: 'Payment complete.',
network_status: 'approved_by_network',
},
}.merge(params)
end