Skip to content

Commit

Permalink
Ogone: add tests for scrubbing
Browse files Browse the repository at this point in the history
Five remote tests fail, two involving extended options for purchases,
two on storing, and one on credits. None of these are impacted by this
patch series, and fixing them is beyond the scope of this series. (The
errors appears to be some sort of transient issue with their test card
processing.)

Unit:
48 tests, 206 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
27 tests, 91 assertions, 5 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
77.7778% passed
  • Loading branch information
bpollack committed Jan 8, 2018
1 parent 109a070 commit 5e32e5f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/remote/gateways/remote_ogone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,15 @@ def test_invalid_login
assert response = gateway.purchase(@amount, @credit_card, @options)
assert_failure response
end

def test_transcript_scrubbing
transcript = capture_transcript(@gateway) do
@gateway.purchase(@amount, @credit_card, @options)
end
transcript = @gateway.scrub(transcript)

assert_scrubbed(@credit_card.number, transcript)
assert_scrubbed(@credit_card.verification_value, transcript)
assert_scrubbed(@gateway.options[:password], transcript)
end
end
53 changes: 53 additions & 0 deletions test/unit/gateways/ogone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ def test_response_params_is_hash
assert_instance_of Hash, response.params
end

def test_transcript_scrubbing
assert @gateway.supports_scrubbing?
assert_equal @gateway.scrub(pre_scrub), post_scrub
end

private

def string_to_digest
Expand Down Expand Up @@ -754,4 +759,52 @@ def failed_authorization_response
END
end

def pre_scrub
%q{
opening connection to secure.ogone.com:443...
opened
starting SSL for secure.ogone.com:443...
SSL established
<- "POST /ncol/test/orderdirect.asp HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: secure.ogone.com\r\nContent-Length: 455\r\n\r\n"
<- "CARDNO=4000100011112224&CN=Longbob+Longsen&COM=Store+Purchase&CVC=123&ECI=7&ED=0919&Operation=SAL&OwnerZip=K1C2N6&Owneraddress=456+My+Street&PSPID=spreedlyinc&PSWD=spreedly1test&SHASign=A67038AB141C6E54C51315F993DC83F5C28A9E585C6C8A79346F802E6557C0C8EE233A5FF1352AAD3C6AA5D476CF49F2B0DF512C63BA624F0583B72C1DCABCEF&USERID=spreedlytest&amount=100&currency=EUR&orderID=7de271d36c1c36999a6039d99179b2&ownercty=CA&ownertelno=%28555%29555-5555&ownertown=Ottawa"
-> "HTTP/1.1 200 OK\r\n"
-> "Cache-Control: private, max-age=0\r\n"
-> "Content-Length: 152\r\n"
-> "Content-Type: text/XML; Charset=iso-8859-1\r\n"
-> "Expires: Mon, 08 Jan 2018 18:13:04 GMT\r\n"
-> "Strict-Transport-Security: max-age=31536000;includeSubdomains\r\n"
-> "Date: Mon, 08 Jan 2018 18:14:05 GMT\r\n"
-> "Connection: close\r\n"
-> "\r\n"
reading 152 bytes...
-> "<?xml version=\"1.0\"?><ncresponse\r\norderID=\"7de271d36c1c36999a6039d99179b2\"\r\nPAYID=\"3029762647\"\r\nNCERROR=\"0\"\r\nSTATUS=\"9\"\r\nNCERRORPLUS=\"!\">\r\n</ncresponse>"
read 152 bytes
Conn close
}
end

def post_scrub
%q{
opening connection to secure.ogone.com:443...
opened
starting SSL for secure.ogone.com:443...
SSL established
<- "POST /ncol/test/orderdirect.asp HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nConnection: close\r\nHost: secure.ogone.com\r\nContent-Length: 455\r\n\r\n"
<- "CARDNO=[FILTERED]&CN=Longbob+Longsen&COM=Store+Purchase&CVC=[FILTERED]&ECI=7&ED=0919&Operation=SAL&OwnerZip=K1C2N6&Owneraddress=456+My+Street&PSPID=spreedlyinc&PSWD=[FILTERED]&SHASign=A67038AB141C6E54C51315F993DC83F5C28A9E585C6C8A79346F802E6557C0C8EE233A5FF1352AAD3C6AA5D476CF49F2B0DF512C63BA624F0583B72C1DCABCEF&USERID=spreedlytest&amount=100&currency=EUR&orderID=7de271d36c1c36999a6039d99179b2&ownercty=CA&ownertelno=%28555%29555-5555&ownertown=Ottawa"
-> "HTTP/1.1 200 OK\r\n"
-> "Cache-Control: private, max-age=0\r\n"
-> "Content-Length: 152\r\n"
-> "Content-Type: text/XML; Charset=iso-8859-1\r\n"
-> "Expires: Mon, 08 Jan 2018 18:13:04 GMT\r\n"
-> "Strict-Transport-Security: max-age=31536000;includeSubdomains\r\n"
-> "Date: Mon, 08 Jan 2018 18:14:05 GMT\r\n"
-> "Connection: close\r\n"
-> "\r\n"
reading 152 bytes...
-> "<?xml version=\"1.0\"?><ncresponse\r\norderID=\"7de271d36c1c36999a6039d99179b2\"\r\nPAYID=\"3029762647\"\r\nNCERROR=\"0\"\r\nSTATUS=\"9\"\r\nNCERRORPLUS=\"!\">\r\n</ncresponse>"
read 152 bytes
Conn close
}
end

end

0 comments on commit 5e32e5f

Please sign in to comment.