Skip to content

Commit

Permalink
Merge pull request #235 from brentmc79/master
Browse files Browse the repository at this point in the history
Don't pass testmode to Quickpay if transaction is specified (closes #324).
  • Loading branch information
ntalbott committed Feb 28, 2012
2 parents c37dc1d + 54ce542 commit d848cac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/active_merchant/billing/gateways/quickpay.rb
Expand Up @@ -215,6 +215,7 @@ def add_description(post, options)
end

def add_testmode(post)
return if post[:transaction].present?
post[:testmode] = test? ? '1' : '0'
end

Expand Down
12 changes: 12 additions & 0 deletions test/unit/gateways/quickpay_test.rb
Expand Up @@ -87,6 +87,18 @@ def test_supported_countries
def test_supported_card_types
assert_equal [ :dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro ], QuickpayGateway.supported_cardtypes
end

def test_add_testmode_does_not_add_testmode_if_transaction_id_present
post_hash = {:transaction => "12345"}
@gateway.send(:add_testmode, post_hash)
assert_equal nil, post_hash[:testmode]
end

def test_add_testmode_adds_a_testmode_param_if_transaction_id_not_present
post_hash = {}
@gateway.send(:add_testmode, post_hash)
assert_equal '1', post_hash[:testmode]
end

private

Expand Down

0 comments on commit d848cac

Please sign in to comment.