I'm working from some sample code, provided in PHP - we are using c#, so i'm having to convert it. Basically, it requires that i submit a bunch of data to an API, which returns an xml document as a response.
I then need to redirect to a page, that has the following HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Redirect Test Page</title>
</head>
<body OnLoad="OnLoadEvent();" >
<form name="downloadForm" action="ACS_URL_GOES_HERE" method="POST">
<input type="hidden" name="PaReq" value="PAREQ_GOES_HERE">
<input type="hidden" name="TermUrl" value="TERM_URL_GOES_HERE">
<input type="hidden" name="MD" value="MD_GOES_HERE">
<noscript>
<center>
<h1>Processing your 3-D Secure Transaction</h1>
<h2>JavaScript is currently disabled or is not supported by your browser.</h2><br>
<h3>Please click on the Submit button to continue the processing of your 3-D secure transaction.</h3>
<input type="submit" value="Submit">
</center>
</noscript>
</form>
<script language="Javascript" >
<!--
function OnLoadEvent(){
document.downloadForm.target = "myIframe";
document.downloadForm.submit();
}
//-->
</script>
<hr>
<iframe src="blank.htm" name="myIframe" width="390" height="450" frameborder="0">
</iframe>
<hr>
</body>
</html>
(the Uppercase variables (ending in _GOES_HERE) above are going to be passed in from the response XML document)
This page, once loaded, submits, and puts the result in the iFrame - called "myIframe"
That's basically it!
I'm having great trouble doing something like this in C# - in PHP: they have this:
function RedirectToACSPage ($doc, $data_set) {
// error_log ("Call RedirectToACSPage");
// error_log ($doc->get("Response.CardTxn.ThreeDSecure.pareq_message"));
$pareq = $doc->get("Response.CardTxn.ThreeDSecure.pareq_message");
$acs_url = $doc->get("Response.CardTxn.ThreeDSecure.acs_url");
// $acs_url = "http://staging.datacash.com/ops/cgi/args.php";
// error_log ("PAREQ: " . $pareq);
// error_log ("ACS URL: " . $acs_url);
$term_url = "https://staging.datacash.com/ops/tester/next.php";
$md = $doc->get("Response.datacash_reference") . ":" . $data_set{'vtid'} . ":" . $data_set{'password'} . ":" . $data_set{'tran_type'} . ":" . $data_set{'url'}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Redirect Test Page</title>
</head>
<body OnLoad="OnLoadEvent();" >
<form name="downloadForm" action="<?php echo $acs_url ?>" method="POST">
<input type="hidden" name="PaReq" value="<?php echo $pareq ?>">
<input type="hidden" name="TermUrl" value="<?php echo $term_url ?>">
<input type="hidden" name="MD" value="<?php echo $md ?>">
<noscript>
<center>
<h1>Processing your 3-D Secure Transaction</h1>
<h2>JavaScript is currently disabled or is not supported by your browser. </h2><br>
<h3>Please click on the Submit button to continue the processing of your 3-D secure transaction.</h3>
<input type="submit" value="Submit">
</center>
</noscript>
</form>
<script language="Javascript" >
<!--
function OnLoadEvent(){
document.downloadForm.target = "joe";
document.downloadForm.submit();
}
//-->
</script>