Sha256: 11ae30d2dec9d2454f5c3089d38c78c450e412d2733e13e8bd1005fdf0059fba

Contents?: true

Size: 1.79 KB

Versions: 11

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe Sisow::Api::TransactionRequest do

  it "should raise an error if API response has been forged" do
    response = Hashie::Mash.new
    response.transactionrequest = {
      :signature => {
        :sha1 => 'this_is_not_a_correct_sha1_hash'
      },
      :transaction => {
        :trxid => '123',
        :issuerurl => 'http://example.com'
      }
    }

    payment = Sisow::IdealPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    lambda{ request.clean(response) }.should raise_error(Sisow::Exception, "This response has been forged")

  end

  it "should not remove issuerid when it is an iDEAL payment" do
    payment = Sisow::IdealPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    request.params.keys.should include(:issuerid)
  end

  it "should remove issuerid from params for Bancontact" do
    Sisow.configuration.stub!(:test_mode_enabled?).and_return(false)
    payment = Sisow::BancontactPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    request.params.keys.should_not include(:issuerid)
  end

  it "should force issuerid to '99' for Bancontact in test mode" do
    payment = Sisow::BancontactPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    request.params[:issuerid].should == '99'
  end

  it "should remove issuerid from params for Sofort" do
    Sisow.configuration.stub!(:test_mode_enabled?).and_return(false)
    payment = Sisow::SofortPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    request.params.keys.should_not include(:issuerid)
  end

  it "should force issuerid to '99' for Sofort in test mode" do
    payment = Sisow::SofortPayment.new
    request = Sisow::Api::TransactionRequest.new(payment)

    request.params[:issuerid].should == '99'
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sisow-1.7 spec/models/transaction_request_spec.rb
sisow-1.6 spec/models/transaction_request_spec.rb
sisow-1.5 spec/models/transaction_request_spec.rb
sisow-1.4 spec/models/transaction_request_spec.rb
sisow-1.3 spec/models/transaction_request_spec.rb
sisow-1.2 spec/models/transaction_request_spec.rb
sisow-1.1.1 spec/models/transaction_request_spec.rb
sisow-1.1.0 spec/models/transaction_request_spec.rb
sisow-1.0.1 spec/models/transaction_request_spec.rb
sisow-1.0.0 spec/models/transaction_request_spec.rb
sisow-0.9.9 spec/models/transaction_request_spec.rb