mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
API Updates (#1041)
This commit is contained in:
parent
1467630a68
commit
60d51f2c0a
@ -10,6 +10,66 @@ module Stripe
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "terminal.reader"
|
||||
|
||||
custom_method :cancel_action, http_verb: :post
|
||||
custom_method :process_payment_intent, http_verb: :post
|
||||
custom_method :process_setup_intent, http_verb: :post
|
||||
custom_method :set_reader_display, http_verb: :post
|
||||
|
||||
def cancel_action(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url + "/cancel_action",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def process_payment_intent(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url + "/process_payment_intent",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def process_setup_intent(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url + "/process_setup_intent",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def set_reader_display(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url + "/set_reader_display",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def test_helpers
|
||||
TestHelpers.new(self)
|
||||
end
|
||||
|
||||
class TestHelpers < APIResourceTestHelpers
|
||||
RESOURCE_CLASS = Reader
|
||||
|
||||
custom_method :present_payment_method, http_verb: :post
|
||||
|
||||
def present_payment_method(params = {}, opts = {})
|
||||
@resource.request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url + "/present_payment_method",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -57,6 +57,13 @@ module Stripe
|
||||
assert reader.is_a?(Stripe::Terminal::Reader)
|
||||
end
|
||||
end
|
||||
|
||||
should "be able to present a payment method" do
|
||||
reader = Stripe::Terminal::Reader.retrieve("rdr_123")
|
||||
reader = reader.test_helpers.present_payment_method
|
||||
assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/terminal/readers/rdr_123/present_payment_method"
|
||||
assert reader.is_a?(Stripe::Terminal::Reader)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user