LivotovLabs/3DSView

Certain bank cards don't work with this library

sandyscoffable opened this issue · 1 comments

A few of our customers have ran into the following error:

We have a 3-D Secure success rate of 91-92% on Android, and on our other platforms they are all solidly around 95% (this is on a volume of around 20,000 transactions since I made the change in the Android app).

It seems to be an issue confined to certain banks. The cards affected seem to be Co-op and perhaps Clydesdale Bank and Capital One 🙀

Here are a few IINs that seem to be affected: 498824, 557351

Update - reproduced issue

I've been able to reproduce the issue here. When the library loads it seems to fairly quickly show the above Google page in the screenshot (without any sort of intervention required).

The code that extracts the PaRes from the HTML doesn't appear to be called (as I had debug code to spit out the HTML if that was hit). There are the following cryptic log lines though which might offer a clue:

2019-01-11 12:55:07.033 10790-12869/com.scoffable W/chromium: [WARNING:spdy_session.cc(2876)] Received RST for invalid stream1
2019-01-11 12:55:07.079 10790-10790/com.scoffable I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'innerHTML' of undefined", source: https://www.google.com/ (1)

The above error points to an issue with this line of code:

view.loadUrl(String.format("javascript:window.%s.processHTML(document.getElementsByTagName('html')[0].innerHTML);", JavaScriptNS));

So, still not 100% sure why this is happening, but it's definitely an issue. The employee who has an affected card is off today, so I can't reproduce again until they are back in the office.

After a world of pain this afternoon even getting the HTML to spit out, I captured the following HTML:

<html><head>
<title>Verified by Visa</title>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="Cache-Control" content="no cache">
<meta http-equiv="Pragma" content="no cache">
<meta http-equiv="Expires" content="0">
<link rel="stylesheet" href="en_GB_Coop_Smile_Debit/style.css" type="text/css">
<script language="javascript" src="en_GB_Coop_Smile_Debit/pwdcookies.js"></script>
<script language="Javascript">
<!--
var isAA = false;
var cookievalForAA = getCookie("AAFlag");
if(cookievalForAA != null)
{
	if(cookievalForAA == "true")
	{
		isAA = true;
	}
}
var failpage = false;
var cookieval = getCookie("ArcotCertegyAE_TrnStatus");
var closing = true;
var bankid = "coopsmile.gif";
setCookie("BANKID",bankid);
function OnPageInit()
{
	document.downloadForm.submitval.disabled = false;
}
function onBeforeUnloadHandler(object)
{
	if ( closing )
	{
		if (isAA)
		{
			event.returnValue = "Your activation has not completed!\nTo complete your activation click 'Continue'.";
		}
		else
		{
			event.returnValue = "Your purchase has not completed!\nTo complete your purchase click 'Continue'.";
		}
	}
}
if(cookieval != null)
{
    //alert("cookieval="+cookieval);
	if(cookieval == "fail")
	{
		failpage = true;
		setCookie("ArcotCertegyAE_TrnStatus","pass");
	}
	else if(cookieval == "createpwd")
	{
		if (!isAA)
		{
		var newwin = window.open('en_GB_Coop_Smile_Debit/postauthWelcome.htm','postAuthWelcome',
				'left=100000,top=100000,screenX=100000,screenY=100000,height=550,width=390,resizable=yes,scrollbars=yes');
			newwin.blur();
			window.focus();
			newwin.moveTo(100, 100);
			window.opener.focus();
		}
		delCookie("ArcotCertegyAE_TrnStatus");
	}
}
function download()
{
	closing=false;
	var CustData ="";
	if (2000 == 1001)
	{
		TheNewWin =window.open("en_GB_Coop_Smile_Debit/submitToES.htm",'TheNewpop',"height=420,width=390,scrollbars=yes,resizable=no,screenX=550,screenY=150,left=550,top=150");
		TheNewWin.blur();
		setTimeout("submitForm()",1000);
	}
	else
	{
		document.downloadForm.submit();
	}
}
function submitForm()
{
	closing=false;
	document.downloadForm.submit();
}
function OnSubmitHandler()
{
	closing=false;
	delCookie("AAFlag");
	document.downloadForm.submitval.disabled = true;
	document.downloadForm.submit();
	return false;
}
//-->
</script>
<script language="Javascript">
if(failpage)
{
	document.writeln ('<body TEXT="#51392B" LINK="#cc9966" VLINK="#FF0000" ALINK="#00FF00" onbeforeunload="onBeforeUnloadHandler(this);">');
	document.writeln ('<form name="downloadForm" action="https://www.google.com" method="POST" onload="OnPageInit()">');
	setTimeout("OnSubmitHandler()", 20000);
}
else
{
		document.writeln ('<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf8">');
		document.writeln ('<body TEXT="#51392B" LINK="#cc9966" VLINK="#FF0000" ALINK="#00FF00" onload="download();">');
		document.writeln ('<form name="downloadForm" action="https://www.google.com" method="POST">');
		document.writeln ('<center><b>Processing<big>&nbsp;&nbsp;.&nbsp;.&nbsp;.&nbsp;.</b></big></center>');
}
</script><meta http-equiv="content-type" content="text/html; charset=utf8"></head>
<body text="#51392B" link="#cc9966" vlink="#FF0000" alink="#00FF00" onload="download();">
<form name="downloadForm" action="https://www.google.com" method="POST">
<center><b>Processing<big>&nbsp;&nbsp;.&nbsp;.&nbsp;.&nbsp;.</big></b></center>
id=10347(u0_a347) com.scoffable identical 3 lines
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<!--<TR><TD COLSPAN="3"><IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="1" HEIGHT="20" BORDER=0 ALT=""><BR></TD></TR>--><!-- Top 20 pixels of white space -->
	<tbody><tr>
		<td><img src="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" width="20" height="1" border="0" alt=""><br></td><!-- Left 20 pixels of white space -->
		<td align="center">
			<!-- Content area -->
			<table width="330" height="340" cellpadding="0" cellspacing="0" border="0">
				<tbody><tr>
					<script language="javascript">
					if(failpage)
					{
						document.writeln ('<TD VALIGN="top" WIDTH="89" HEIGHT="51"><IMG name="vpasLogo" SRC="en_GB_Coop_Smile_Debit/images/vpas_logo.gif"  BORDER=0 ALT="Verified by Visa"><BR></TD><TD ALIGN="right" VALIGN="top" WIDTH="301" HEIGHT="51"><IMG name="memberLogo" src="en_GB_Coop_Smile_Debit/images/coopsmile.gif"  BORDER=0 ALT="memberLogo"><BR></TD>');
					}
					</script>
				</tr>
				<tr>
					<td colspan="2" valign="top" height="100">
						<!-- Text area -->
						<script language="javascript">
						if(failpage)
						{
							if (isAA)
							{
								document.writeln ('<IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="1" HEIGHT="20" BORDER=0 ALT=""><BR>',
								'<IMG SRC="en_GB_Coop_Smile_Debit/images/hdr_password_failed.gif"  BORDER=0 ALT="Authentication Failed"><BR>',
								'<IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="1" HEIGHT="30" BORDER=0 ALT=""><BR>',
								'<font Class="TextBlack">For your protection, we\'re unable to activate your card at this time.<BR>For more information contact Customer service.</font>');
							}
							else
							{
								document.writeln ('<IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="1" HEIGHT="20" BORDER=0 ALT=""><BR>',
								'<IMG SRC="en_GB_Coop_Smile_Debit/images/hdr_password_failed.gif"  BORDER=0 ALT="Authentication Failed"><BR>',
								'<IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="1" HEIGHT="5" BORDER=0 ALT=""><BR>',
								'<font Class="TextBlack">The authentication information you provided does not match our records for this Visa card. To ensure the highest level of security, this Visa card cannot be used to complete this purchase. You will be automatically returned to the online store so that you may enter another form of payment, or click Continue to proceed now.<BR><BR>Contact the Bank on 0870 843 2265.<BR><BR></font>');
							}
						}
						</script>
						<!-- Issuer speciffic info -->
						<br><br>
					<!-- Start of the continue button -->
						<div align="center">
							<img src="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" width="1" height="4"><br>
							<script language="javascript">
							if(failpage)
							{
								document.writeln ('<INPUT TYPE="button" NAME="submitval" VALUE="Continue" onclick="OnSubmitHandler();">');
							}
							</script>
							<noscript>
							<INPUT TYPE="Submit" VALUE="Continue">
							</noscript>
						</div>
					<!-- End of the continue button -->
					</td>
				</tr>
				<tr>
				<td colspan="2">
				<!-- end copyright notice table-->
				</td>
				</tr>
			</tbody></table>
			<!-- End of content area -->
		</td>
		<!--<TD><IMG SRC="en_GB_Coop_Smile_Debit/images/spacer_clear.gif" WIDTH="20" HEIGHT="1" BORDER=0 ALT=""><BR></TD>--><!-- Right 20 pixels of white space -->
	</tr>
</tbody></table>
<input type="hidden" name="PaRes" value="eJzNWdnOo1iSvs+nKFVfWlXsBkrOX2IHYzD7dse+mMUGDJinH2xnZv1dnTPT3RqN2pIFxIkTJ05sXxw4WEWfpqyZ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HPYPcXdvkNHLsDva3OvVEM5uAds7+4Ke2rFReCYCTrfjxW1tJ93NEruVJLrbStNQMQwVov8AWbxVsuxKDBpCreIACUCeKtKZ9WY8nrn8M2Tl8wa5NPDMLfb/uJw+42D+DoWb/IqhgZWCO9bMlc6fQ9EA/yc4O0EvaGR191MsOht8I/obHtlHfr5RaFEFP2A12TQ5NfU9+UeIr+Jmnl5QZ6v0G2ahDe7UDbLIKWGw5/ic+2Ge++ftzwhZs1x877U//qdtg9WtZ/Yy+TD6HUJr/dlGuM7jCZlvucukOa88/XehFvBhZ2t3ny3sE1YdM/CCbc137lpCvSYsdX75TSdoKiO2PlbZcs+fRf1l+zNN+xyvAqxc2/cTKO3TC5NcbixiIK1Xoan838MeTfo7niTHQqTOxRJ0emyRTMR0rcOMUYMUbp3BLX1s76GedtmYnGV3rED/bFW4Zofy2c3mOApMkd4jvdKcSqfBg5vktIm7TDRtnCArzqM5zNn2lFO9rshi68N3Qc+0itsqH9W2buofs2QXG0en28uIgdKRLqy8KYZwCYf9Hui8VVIf4UJ5SSeAKLPCGqg1ewjZCua14h9+WZsAulXAFLIuwCQOVsvPfH0hNxedCKegw32FglkY8ndgn5UtTsjd9ULuczGhJBUaIwqCVbXp8UiHrvYAtrJYr
<input type="hidden" name="MD" value="20154774081651667349">
<input type="hidden" name="PaReq" value="eJxVUsFygjAQvfcrHD/AJIgBnSWO1qo40xaKh/YYQ1SmAkqg6N83Uag2p30vm7ebtwvjc3ro/MhCJXnmdUkPd8fsCdb7QspZJEVVSAavUim+k50k9roWJgPbcWzsEjoglDp9e9hlEEw+5IlBI8S0Ts8C1EKtUIg9z0oGXJym/huzbdqnA0ANhFQW/oxZBGN76LrUweYAutGQ8VSySOTbLd8cJAF0JUDkVVYWF+ZaFFALoCoObF+WxxFCdV33VPusJ/IUkLkFdO8nqEyktNo5iRlf9zer6EV97+P153K3FnO8CnZ+RH3lATIZEPNSMu3CEBPidAgdYTwiDqArDzw1bTBi6+abGI6mxOTh4pEAbXEhM9H+okUgz8c8kzpD+/gXQyyVYJEZRsAvndfA14UNBej+keelsVmU2rnpInyPBvNLuEj7+KjS3E1O9SScT8Mvz5h/TTKlEu2cdv9WywBARgY1c0XNCujo32r8ArB5u0o=">
</form>
</body></html>

The end of the PaRes line is truncated due to it hitting the log line length on Android, so I can assume that's well formed ...

So, the library isn't calling the processHTML method, and I reckon it's due to the initialPageLoadCompleted stuff that I added in to improve the loading time of the form behind the scenes 🤦‍♂️

Now that I have a good idea why this isn't working, I'll have a crack at fixing it.