Sha256: c974c4d74684152a8d20692d011110884b8fc731fa81b4e739119e926d7229e1

Contents?: true

Size: 1.69 KB

Versions: 18

Compression:

Stored size: 1.69 KB

Contents

# 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.
  #
  # 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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
stripe-9.4.0.pre.beta.2 lib/stripe/resources/refund.rb
stripe-9.4.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-9.3.0 lib/stripe/resources/refund.rb
stripe-9.3.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-9.2.0 lib/stripe/resources/refund.rb
stripe-9.2.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-9.1.0 lib/stripe/resources/refund.rb
stripe-9.0.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-9.0.0 lib/stripe/resources/refund.rb
stripe-8.8.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-8.7.0 lib/stripe/resources/refund.rb
stripe-8.7.0.pre.beta.3 lib/stripe/resources/refund.rb
stripe-8.7.0.pre.beta.2 lib/stripe/resources/refund.rb
stripe-8.7.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-8.6.0 lib/stripe/resources/refund.rb
stripe-8.6.0.pre.beta.6 lib/stripe/resources/refund.rb
stripe-8.6.0.pre.beta.5 lib/stripe/resources/refund.rb
stripe-8.6.0.pre.beta.4 lib/stripe/resources/refund.rb