mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-22 00:05:58 -05:00
Add cancel support for topups
This commit is contained in:
parent
7e914bc9cb
commit
d698bd6fc7
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user