Add cancel support for topups

This commit is contained in:
Olivier Bellone 2018-08-03 12:50:39 +02:00
parent 7e914bc9cb
commit d698bd6fc7
No known key found for this signature in database
GPG Key ID: 11E77E3AA0C40303
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