mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-03 00:01:21 -04:00
66 lines
1.9 KiB
Ruby
66 lines
1.9 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
# `Refund` objects allow you to refund a charge that has previously been created
|
|
# but not yet refunded. Funds will be refunded to the credit or debit card that
|
|
# was originally charged.
|
|
#
|
|
# Stripe Tax users with recurring payments and invoices can create [Credit Notes](https://stripe.com/docs/api/credit_notes),
|
|
# which reduce overall tax liability because tax is correctly recalculated and
|
|
# apportioned to the related invoice.
|
|
#
|
|
# Related guide: [Refunds](https://stripe.com/docs/refunds).
|
|
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 = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def test_helpers
|
|
TestHelpers.new(self)
|
|
end
|
|
|
|
class TestHelpers < APIResourceTestHelpers
|
|
RESOURCE_CLASS = Refund
|
|
|
|
def self.expire(refund, params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(refund) }),
|
|
params: params,
|
|
opts: 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
|