mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
59 lines
1.5 KiB
Ruby
59 lines
1.5 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
class Refund < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
extend Stripe::APIOperations::List
|
|
include Stripe::APIOperations::Save
|
|
|
|
OBJECT_NAME = "refund"
|
|
|
|
def cancel(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(self["id"]) }),
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def self.cancel(refund, params = {}, opts = {})
|
|
resp, opts = execute_resource_request(
|
|
:post,
|
|
format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
|
|
params,
|
|
opts
|
|
)
|
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
end
|
|
|
|
def test_helpers
|
|
TestHelpers.new(self)
|
|
end
|
|
|
|
class TestHelpers < APIResourceTestHelpers
|
|
RESOURCE_CLASS = Refund
|
|
|
|
def self.expire(refund, params = {}, opts = {})
|
|
resp, opts = execute_resource_request(
|
|
:post,
|
|
format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(refund) }),
|
|
params,
|
|
opts
|
|
)
|
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
end
|
|
|
|
def expire(params = {}, opts = {})
|
|
@resource.request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(@resource["id"]) }),
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|