Sha256: da774923b3eaf5ef4bbffd0ebacf233d65596d6a517d5a777da17215636889ee

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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

3 entries across 3 versions & 1 rubygems

Version Path
moip2-0.1.4 spec/moip2/refund_api_spec.rb
moip2-0.1.3 spec/moip2/refund_api_spec.rb
moip2-0.1.1 spec/moip2/refund_api_spec.rb