mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-07 00:05:33 -04:00
parent
a85e2277d6
commit
9a82f7d1ba
@ -5,13 +5,12 @@ module Stripe
|
|||||||
include Stripe::APIOperations::Create
|
include Stripe::APIOperations::Create
|
||||||
|
|
||||||
def self.upcoming(params, opts={})
|
def self.upcoming(params, opts={})
|
||||||
opts = Util.normalize_opts(opts)
|
response, opts = request(:get, upcoming_url, params, opts)
|
||||||
response, api_key = Stripe.request(:get, upcoming_url, opts, params)
|
|
||||||
Util.convert_to_stripe_object(response, opts)
|
Util.convert_to_stripe_object(response, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pay
|
def pay(opts={})
|
||||||
response, opts = Stripe.request(:post, pay_url, @opts, {})
|
response, opts = request(:post, pay_url, {}, opts)
|
||||||
refresh_from(response, opts)
|
refresh_from(response, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,5 +22,19 @@ module Stripe
|
|||||||
i.pay
|
i.pay
|
||||||
assert_equal nil, i.next_payment_attempt
|
assert_equal nil, i.next_payment_attempt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "pay with extra opts should pay an invoice" do
|
||||||
|
@mock.expects(:get).once.returns(test_response(test_invoice))
|
||||||
|
i = Stripe::Invoice.retrieve('in_test_invoice', {api_key: 'foobar'})
|
||||||
|
|
||||||
|
Stripe.expects(:execute_request).with do |opts|
|
||||||
|
opts[:url] == "#{Stripe.api_base}/v1/invoices/in_test_invoice/pay" &&
|
||||||
|
opts[:method] == :post &&
|
||||||
|
opts[:headers][:authorization] == 'Bearer foobar'
|
||||||
|
end.returns(test_response(test_paid_invoice))
|
||||||
|
|
||||||
|
i.pay
|
||||||
|
assert_equal nil, i.next_payment_attempt
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user