Sha256: 1c9ec7e4cacb6c1625f3401204a6ac1bfffa084b51792a4643363e1023560591

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

# encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe BraspagPagador::Connection do
  it "should generate a billet", :billet_integration => true do
    gateway = BraspagPagador::Connection.new(
      :merchant_id => ENV['BRASPAG_MERCHANT_ID'],
      :environment => :homologation
    )

    billet = BraspagPagador::Billet.new(
      :instructions => 'does not accepted after due date', # (optional)
      :due_date_on  => Date.today + 2
    )

    customer = BraspagPagador::Customer.new(
      :document     => '21473696240', # (OPTIONAL)
      :name   => 'Bob Dela Bobsen',
      :email  => 'bob@mailinator.com' # send email to consumer (OPTIONAL)
    )

    order = BraspagPagador::Order.new(
      :payment_method  => BraspagPagador::PAYMENT_METHOD[:billet_santader],
      :id              => 11,
      :amount          => 10.00, # $10.00 (accepts all amounts as Integer values in cents)
      :customer        => customer
    )

    # Validating the card automatically detects the card type
    if billet.valid?(:generate) && customer.valid?(:generate) && order.valid?(:generate)
      response = gateway.generate_billet(order, billet)
      response.success?.should eq(true)
      puts "Successfully created billet, open in:#{billet.url}"
    else
      fail "Invalid Params"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
braspag-pagador-1.0.1 spec/integration/billet_spec.rb
braspag-pagador-1.0.0 spec/integration/billet_spec.rb
braspag-pagador-0.9.6 spec/integration/billet_spec.rb
braspag-pagador-0.9.5 spec/integration/billet_spec.rb