Sha256: 7fbf8218d5c008ed219d6c640bd280d6d3647f3a842412478311799b2877abe1

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

describe Spree::PaymentMethod::SisowBilling::Sofort, type: :model do
  let(:order) { double("Spree::Order") }
  let(:payment){ double("Spree::Payment") }

  let(:options) {
    {
        return_url: 'http://www.example.com',
        cancel_url: 'http://www.example.com',
        notify_url: 'http://www.example.com',
        issuer_id: 99
    }
  }

  before do
    allow(Spree::PaymentMethod).to receive(:find_by!).with(type: subject.class.to_s).and_return(subject)
  end

  it "should return a payment URL to the Sisow API" do
    stub_request(:get, "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/TransactionRequest?amount=300&callbackurl=&cancelurl=http://www.example.com&description=Spree%20Demo%20Site%20-%20Order:%20O12345678&entrancecode=R12345678&issuerid=99&merchantid=2537407799&notifyurl=http://www.example.com&payment=sofort&purchaseid=O12345678&returnurl=http://www.example.com&sha1=876b2c3c20b56f34cad4a9108bd42dd16885baeb&shop_id=&test=true").
      to_return(stored_response("sofort_redirect_url_output"))
    allow(payment).to receive(:number) { "R12345678" }
    allow(order).to receive(:total) { 3 }
    allow(order).to receive(:number) { "O12345678" }
    allow(order).to receive_message_chain(:payments, :create).and_return(payment)
    allow(Spree::Store).to receive(:current).and_return double(Spree::Store, name: "Spree Demo Site")

    #payment.should_receive(:started_processing!)
    #payment.should_receive(:pend!)

    expect(subject.redirect_url(order, options)).to match(/https:\/\/www\.sisow\.nl\/Sisow\/iDeal\/Simulator\.aspx/)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_billing_sisow-0.9.2 spec/models/spree/payment_method/sisow_billing/sofort_spec.rb
spree_billing_sisow-0.9.1 spec/models/spree/payment_method/sisow_billing/sofort_spec.rb