Sha256: 6db3f04545472ad7c213527b637ef3b4e94cf0ccd940738279e53d4c458ad65a

Contents?: true

Size: 1.68 KB

Versions: 30

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

require ::File.expand_path("../../test_helper", __FILE__)

module Stripe
  class TransferReversalsOperationsTest < Test::Unit::TestCase
    setup do
      @transfer_id = "tr_123"
      @reversal_id = "trr_123"
    end

    context "#create_reversal" do
      should "create a reversal" do
        reversal = Stripe::Transfer.create_reversal(
          @transfer_id,
          amount: 100
        )
        assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
        assert reversal.is_a?(Stripe::Reversal)
      end
    end

    context "#retrieve_reversal" do
      should "retrieve a reversal" do
        reversal = Stripe::Transfer.retrieve_reversal(
          @transfer_id,
          @reversal_id
        )
        assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
        assert reversal.is_a?(Stripe::Reversal)
      end
    end

    context "#update_reversal" do
      should "update a reversal" do
        reversal = Stripe::Transfer.update_reversal(
          @transfer_id,
          @reversal_id,
          metadata: { foo: "bar" }
        )
        assert_requested :post, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals/#{@reversal_id}"
        assert reversal.is_a?(Stripe::Reversal)
      end
    end

    context "#list_reversals" do
      should "list the transfer's reversals" do
        reversals = Stripe::Transfer.list_reversals(
          @transfer_id
        )
        assert_requested :get, "#{Stripe.api_base}/v1/transfers/#{@transfer_id}/reversals"
        assert reversals.is_a?(Stripe::ListObject)
        assert reversals.data.is_a?(Array)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
stripe-3.31.1 test/stripe/transfer_reversals_operations_test.rb
stripe-3.31.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.30.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.29.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.28.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.27.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.26.1 test/stripe/transfer_reversals_operations_test.rb
stripe-3.26.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.25.0 test/stripe/transfer_reversals_operations_test.rb
stripe-3.24.0 test/stripe/transfer_reversals_operations_test.rb