Sha256: e5dce75550e4bfc440df3001c58cdbe9fb8e68c942e63befcac7faf350ab489f

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe EPayCo::Client do
  let(:public_key){ '111111111111111' }
  let(:private_key){ '222222222222222' }
  let(:client) { EPayCo::Client.new(:public_key => public_key, :private_key => private_key) }

  # TODO: Make tests for erros
  describe ".charge_create" do    
    let(:charge_params) { {
      token_card: "hMsDAjwD7KLsgZQ54",
      customer_id: "6eba2u73ZBh49Po7q",
      plan_id: "cursocarpinteria",
      doc_type: "CC",
      doc_number: "1035851980",
      name: "John",
      last_name: "Doe",
      email: "example@email.com",
      ip: "192.198.2.114",
      bill: "OR-1234",
      description: "Test Payment",
      value: "116000",
      tax: "16000",
      tax_base: "100000",
      currency: "COP",
      dues: "12"
    } }

    before do
      stub_post("recurring/v1/charge/create").
        with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
        to_return(:status => 200, :body => fixture("charge_create.json"), :headers => {:content_type => "application/json;"})
      @response = client.charge_create(charge_params)
    end

    it { expect(a_post("recurring/v1/charge/create")).to have_been_made }
    it { expect(@response).to be_a(Hashie::Mash) }
    it { expect(@response.status).to eq "Creado" }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epayco-0.0.2 spec/epayco/client/charge_spec.rb