Sha256: 741dce9b21e355a488ab9486eeffa1ce236fe170745f59e19c7fc177a5464a1f

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

describe Moip2::MultiPaymentApi do
  let(:multi_payment_api) { described_class.new(sandbox_client) }

  describe "#create" do 
    let(:multi_payment) do
      {
        installmentCount: 1,
        fundingInstrument: {
          method: "CREDIT_CARD",
          creditCard: {
            expirationMonth: 05,
            expirationYear: 18,
            number: "4012001038443335",
            cvc: "123",
            holder: {
              fullname: "Jose Portador da Silva",
              birthdate: "1988-12-30",
              taxDocument: {
                type: "CPF",
                number: "33333333333"
              },
              phone: {
                countryCode: "55",
                areaCode: "11",
                number: "66778899"
              }
            }
          }
        }
      }
    end

    let(:created_multi_payment) do
      VCR.use_cassette("create_multi_payment_success") do
        multi_payment_api.create("MOR-IVKZDU55LXJU", multi_payment)
      end
    end

    it "creates a multiPayment at moip" do
      expect(created_multi_payment.id).to eq "MPY-DSA3I67FOKES"
      expect(created_multi_payment.payments).to_not be_nil
      expect(created_multi_payment.status).to eq "WAITING"
    end

  end

  describe "#show" do
    let(:multi_payment) do
      VCR.use_cassette("show_multi_payment") do
        multi_payment_api.show("MPY-DSA3I67FOKES")
      end
    end

    it "shows a multiPayment" do
      expect(multi_payment.id).to eq "MPY-DSA3I67FOKES"
      expect(multi_payment.payments).to_not be_nil
      expect(multi_payment.status).to eq "AUTHORIZED"
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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