Sha256: 835f33a1d84264ab3bb3cbf3e5f13c285b2b1581d7f07d3e44f10ec0bd398d7e

Contents?: true

Size: 1.59 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
moip2-1.0.0 spec/moip2/multi_payment_api_spec.rb