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-4.12.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.11.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.10.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.9.1 test/stripe/transfer_reversals_operations_test.rb
stripe-4.9.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.8.1 test/stripe/transfer_reversals_operations_test.rb
stripe-4.8.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.7.1 test/stripe/transfer_reversals_operations_test.rb
stripe-4.7.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.6.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.5.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.4.1 test/stripe/transfer_reversals_operations_test.rb
stripe-4.4.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.3.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.2.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.1.0 test/stripe/transfer_reversals_operations_test.rb
stripe-4.0.3 test/stripe/transfer_reversals_operations_test.rb
stripe-4.0.2 test/stripe/transfer_reversals_operations_test.rb
stripe-4.0.1 test/stripe/transfer_reversals_operations_test.rb
stripe-4.0.0 test/stripe/transfer_reversals_operations_test.rb