Sha256: b256c5d6e091585f90aa7999f42e5ce31839e8214a13de8d3cb0015068c1802e

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

# 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 = {})
      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

7 entries across 7 versions & 1 rubygems

Version Path
stripe-7.1.0 lib/stripe/resources/refund.rb
stripe-7.1.0.pre.beta.2 lib/stripe/resources/refund.rb
stripe-7.1.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-7.0.0 lib/stripe/resources/refund.rb
stripe-6.6.0.pre.beta.1 lib/stripe/resources/refund.rb
stripe-6.5.0 lib/stripe/resources/refund.rb
stripe-6.4.0 lib/stripe/resources/refund.rb