Sha256: 1d5339a954a77c37dd4e5fe038e4f6e3c42122ee028dab36cb72a28068fc3935

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

class OgoneNotificationTest < Test::Unit::TestCase
  include ActiveMerchant::Billing::Integrations

  Ogone.inbound_signature = '08445a31a78661b5c746feff39a9db6e4e2cc5cf'
  
  SUCCESSFULL_HTTP_RAW_DATA = "orderID=order_342&currency=EUR&amount=50&PM=CreditCard&ACCEPTANCE=test123&STATUS=9&CARDNO=XXXXXXXXXXXX1111&PAYID=2396925&NCERROR=0&BRAND=VISA&IPCTY=BE&CCCTY=US&ECI=7&CVCCheck=NO&AAVCheck=NO&VC=NO&SHASIGN=FE220C6F4492165533488E35F47F231D6BC357FC&IP=82.146.99.233"
  
  FAULTY_HTTP_RAW_DATA = "orderID=order_342&currency=EUR&amount=50&PM=CreditCard&ACCEPTANCE=test123&STATUS=abc&CARDNO=XXXXXXXXXXXX1111&PAYID=2396925&NCERROR=0&BRAND=VISA&IPCTY=BE&CCCTY=US&ECI=7&CVCCheck=NO&AAVCheck=NO&VC=NO&SHASIGN=FE220C6F4492165533488E35F47F231D6BC357FC&IP=82.146.99.233"

  def setup
    @ogone = Ogone::Notification.new(SUCCESSFULL_HTTP_RAW_DATA)
  end

  def test_accessors
    assert @ogone.complete?
    assert_equal "Completed", @ogone.status
    assert_equal "2396925", @ogone.transaction_id
    assert_equal 50.0, @ogone.gross
    assert_equal "EUR", @ogone.currency
  end

  def test_status_completed
    assert_equal "Completed", @ogone.status
  end

  def test_compositions
    assert_equal Money.new(5000, 'EUR'), @ogone.amount
  end

  def test_invalid_status_should_raise_an_error
    assert_raise(ActiveMerchant::OgoneError) do
      Ogone::Notification.new(FAULTY_HTTP_RAW_DATA)
    end
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
simonmenke-active_merchant_ogone-0.1.2 test/active_merchant_ogone/notification_test.rb
active_merchant_ogone-0.1.2 test/active_merchant_ogone/notification_test.rb