mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-06 00:00:29 -05:00
Add parameters when calling pay on an invoice
This commit is contained in:
parent
94f6f4c809
commit
78cd1d4f3d
@ -11,8 +11,8 @@ module Stripe
|
|||||||
Util.convert_to_stripe_object(resp.data, opts)
|
Util.convert_to_stripe_object(resp.data, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pay(opts={})
|
def pay(params={}, opts={})
|
||||||
resp, opts = request(:post, pay_url, {}, opts)
|
resp, opts = request(:post, pay_url, params, opts)
|
||||||
initialize_from(resp.data, opts)
|
initialize_from(resp.data, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,19 @@ module Stripe
|
|||||||
"#{Stripe.api_base}/v1/invoices/#{FIXTURE[:id]}/pay"
|
"#{Stripe.api_base}/v1/invoices/#{FIXTURE[:id]}/pay"
|
||||||
assert invoice.kind_of?(Stripe::Invoice)
|
assert invoice.kind_of?(Stripe::Invoice)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "pay invoice with a specific source" do
|
||||||
|
invoice = Stripe::Invoice.retrieve(FIXTURE[:id])
|
||||||
|
invoice = invoice.pay(
|
||||||
|
source: API_FIXTURES[:customer][:sources][:data][0][:id]
|
||||||
|
)
|
||||||
|
assert_requested :post,
|
||||||
|
"#{Stripe.api_base}/v1/invoices/#{FIXTURE[:id]}/pay",
|
||||||
|
body: {
|
||||||
|
source: API_FIXTURES[:customer][:sources][:data][0][:id]
|
||||||
|
}
|
||||||
|
assert invoice.kind_of?(Stripe::Invoice)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#upcoming" do
|
context "#upcoming" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user