Sha256: 07010503b408c3079f35d6d04ffd87b50cd4101ae37a8fa4261e1a46e5fa3e43

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

describe Moip2::RefundApi do
  let(:refund_api) { described_class.new(sandbox_client) }

  describe "#create order refund" do
    describe "refund full" do
      let(:order_refunded) do
        VCR.use_cassette("create_full_order_refunded") do
          refund_api.create("ORD-7JOU41NX4M1S")
        end
      end

      it "refunds the entire amount" do
        expect(order_refunded.status).to eq "COMPLETED"
      end
    end

    describe "partial refund" do
      let(:refunded_order) do
        VCR.use_cassette("create_partial_refunded_order") do
          refund_api.create("ORD-6K8XPJD9O2KH", amount: 100)
        end
      end

      it "refunds a partial amount" do
        expect(refunded_order.status).to eq "COMPLETED"
        expect(refunded_order.type).to eq "PARTIAL"
        expect(refunded_order.id).to eq "REF-QW4T48M7NDFH"
      end
    end
  end

  describe "#show" do
    let(:refunded_order) do
      VCR.use_cassette("show_refund") do
        refund_api.show("REF-QW4T48M7NDFH")
      end
    end

    it "shows a refund" do
      expect(refunded_order.status).to eq "COMPLETED"
      expect(refunded_order.type).to eq "PARTIAL"
      expect(refunded_order.id).to eq "REF-QW4T48M7NDFH"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moip2-1.3.1 spec/moip2/refund_api_spec.rb
moip2-1.2.1 spec/moip2/refund_api_spec.rb
moip2-1.2.0 spec/moip2/refund_api_spec.rb
moip2-1.1.0 spec/moip2/refund_api_spec.rb
moip2-1.0.0 spec/moip2/refund_api_spec.rb