mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-27 00:03:06 -05:00
Fix payment intent methods to take extra parameters and remove delete
This commit is contained in:
parent
3a8f1d7172
commit
0632afb5be
@ -3,25 +3,24 @@
|
||||
module Stripe
|
||||
class PaymentIntent < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "payment_intent".freeze
|
||||
|
||||
def cancel
|
||||
resp, api_key = request(:post, resource_url + "/cancel")
|
||||
initialize_from(resp.data, api_key)
|
||||
def cancel(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/cancel", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
|
||||
def capture
|
||||
resp, api_key = request(:post, resource_url + "/capture")
|
||||
initialize_from(resp.data, api_key)
|
||||
def capture(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/capture", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
|
||||
def confirm
|
||||
resp, api_key = request(:post, resource_url + "/confirm")
|
||||
initialize_from(resp.data, api_key)
|
||||
def confirm(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/confirm", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -56,7 +56,9 @@ module Stripe
|
||||
context "#capture" do
|
||||
should "capture a payment_intent" do
|
||||
payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent")
|
||||
payment_intent = payment_intent.capture
|
||||
payment_intent = payment_intent.capture(
|
||||
amount_to_capture: 1234
|
||||
)
|
||||
|
||||
assert_requested :post, "#{Stripe.api_base}/v1/payment_intents/pi_123/capture"
|
||||
assert payment_intent.is_a?(Stripe::PaymentIntent)
|
||||
@ -66,7 +68,9 @@ module Stripe
|
||||
context "#confirm" do
|
||||
should "confirm a payment_intent" do
|
||||
payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent")
|
||||
payment_intent = payment_intent.confirm
|
||||
payment_intent = payment_intent.confirm(
|
||||
source: "src_123"
|
||||
)
|
||||
|
||||
assert_requested :post, "#{Stripe.api_base}/v1/payment_intents/pi_123/confirm"
|
||||
assert payment_intent.is_a?(Stripe::PaymentIntent)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user