Merge pull request #671 from stripe/ob-topup-cancel

Add cancel support for topups
This commit is contained in:
Olivier Bellone 2018-08-03 15:47:34 +02:00 committed by GitHub
commit a24b69caab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -7,5 +7,10 @@ module Stripe
include Stripe::APIOperations::Save
OBJECT_NAME = "topup".freeze
def cancel
resp, api_key = request(:post, resource_url + "/cancel")
initialize_from(resp.data, api_key)
end
end
end

View File

@ -41,5 +41,14 @@ module Stripe
assert_requested :post, "#{Stripe.api_base}/v1/topups/tu_123"
assert topup.is_a?(Stripe::Topup)
end
context "#cancel" do
should "cancel the topup" do
topup = Stripe::Topup.retrieve("tu_123")
topup = topup.cancel
assert_requested :post, "#{Stripe.api_base}/v1/topups/#{topup.id}/cancel"
assert topup.is_a?(Stripe::Topup)
end
end
end
end