Hele koden ser således ud, men det er lidt træls med dem, at de har et forum for deres webshop men ikke for deres betalings system.
<?
$bDebug = true; // Skal sættes til false ved normal brug. Hvis den er true. Bruges kun i testmode.
// Link til EDankort logo
$sLogoURI = "
http://www.mit.dk/Images/edan-xs.gif"; //Læg Deres eDankort logo i f.eks. /images på Deres webhotel.
// Evt. stylesheet ( $sStylesheet = "/styles.css";)
$sPurchaseDate = date("ymd H:i:s");
// Setup order-specific details
// Sætter session for ordrenummer og beløb
session_start();
//session_register( "Orderid", "Amountp" );
$HTTP_SESSION_VARS["OrderID"] = $HTTP_SESSION_VARS["Orderid"];
$HTTP_SESSION_VARS["Amount"] = $HTTP_SESSION_VARS["Amountp"]; //Decimal separator, brug "," f.eks. 1,00
$sInputType = "hidden"; // Standard input felter sættes "hidden"
if($bDebug) {
$sInputType = "text"; // Text felter sættes til "Text" ved test
}
// Output page head
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include_once ("../head.php");
?>
<!--
<title>
eDankort
</title>
<!-- <link rel="stylesheet" type="text/css" href="<?= $sStylesheet ?>" /> -->
</head>
<body> -->
<?
if ( isset( $_REQUEST["MerchantContinue"] ) && $_REQUEST["MerchantContinue"] > '0' ) {
// Tager højde for "l" og "L" i AuthlifeCycle
if (isset($HTTP_POST_VARS["AuthlifeCycle"])) $AuthLifeCycle = $HTTP_POST_VARS["AuthlifeCycle"];
if (isset($HTTP_POST_VARS["AuthLifeCycle"])) $AuthLifeCycle = $HTTP_POST_VARS["AuthLifeCycle"];
?>
<form method="POST" action="
https://pay.dandomain.dk/securecapture.asp" name="Form1">
<input type="<?= $sInputType ?>" name="MerchantNumber" title="MerchantNumber" value="1234567" > <!-- Indsæt forretningsnummer -->
<input type="<?= $sInputType ?>" name="OrderID" title="OrderID" value="<?= $HTTP_POST_VARS[OrderNo]; ?>" >
<input type="<?= $sInputType ?>" name="Amount" title="Amount" value="<?= $HTTP_SESSION_VARS["Amount"]; ?>" >
<input type="<?= $sInputType ?>" name="CardNumber" title="CardNumber" value="<?= $HTTP_POST_VARS["PAN"]; ?>" >
<input type="<?= $sInputType ?>" name="CurrencyID" title="CurrencyID" value="208" >
<input type="<?= $sInputType ?>" name="OKURL" title="OKURL" value="
http://www.mit.dk/Shop_test/dankort_ok.php" > <!-- Returnere hvis indbetalingen gik godt -->
<input type="<?= $sInputType ?>" name="FAILURL" title="FAILURL" value="
http://www.mit.dk/Shop_test/fail.php" > <!-- Returnere hvis inbetalingen fejlede -->
<input type="<?= $sInputType ?>" name="ExpireMonth" value="00" >
<input type="<?= $sInputType ?>" name="ExpireYear" title="ExpireYear" value="00" >
<input type="<?= $sInputType ?>" name="PostingID" title="PostingID" value="<?= $HTTP_POST_VARS["PostingID"]; ?>" >
<input type="<?= $sInputType ?>" name="KeyLabel" title="KeyLabel" value="<?= $HTTP_POST_VARS["KeyLabel"]; ?>" >
<input type="<?= $sInputType ?>" name="SigISO9796" title="SigISO9796" value="<?= $HTTP_POST_VARS["SignatureISO9796"]; ?>" >
<input type="<?= $sInputType ?>" name="AuthlifeCycle" title="AuthlifeCycle" value="<?= $AuthLifeCycle; ?>" >
<input type="<?= $sInputType ?>" name="PayType" title="PayType" value="1" >
<input type="submit" value="send" />
</form>
<script type="text/javascript">
document.Form1.submit();
</script>
<?
exit();
?>
<?
}
if (!isset($_REQUEST["MerchantContinue"]) || isset($_REQUEST["MerchantDecline"])) {
?>
<script type="text/javascript">
function eDankortRouter(form) {
var oHeight = 0;
var oWidth = 0;
var iHeight = 300;
var iWidth = 350;
var iLeft = 0
var iTop = 0;
oHeight = top.window.screen.availHeight;
oWidth = top.window.screen.availWidth;
if(oHeight > 3*iHeight) iHeight = oHeight/3;
if(oWidth > 3*iWidth) iWidth = oWidth/3;
if(oWidth > iWidth) iLeft = (oWidth - iWidth)/2;
if(oHeight > iHeight) iTop = (oHeight - iHeight)/2;
var oWindow = window.open('','router','scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=no,status=yes,width=' + iWidth + ',height=' + iHeight + ',left='+ iLeft + ',top=' +iTop +'dependent=yes');
form.target = 'router';
form.submit();
oWindow.focus();
}
</script>
<form method="POST" action="
https://www.authentication-router.pbs.dk/RouterWebApp/servlet/EDKTransfer" name="Form1" target="_top">
<input type="<?= $sInputType ?>" name="MerchantContinueURL" title="MerchantContinueURL" value="
http://www.mit.dk/Shop_test/dankort_ok.php".getenv("SERVER_NAME")."/edankort2.php?MerchantContinue=1" >
<input type="<?= $sInputType ?>" name="MerchantDeclineURL" title="MerchantDeclineURL" value="
http://www.mit.dk/Shop_test/fail.php".getenv("SERVER_NAME")."/edankort2.php?MerchantDecline=1" >
<input type="<?= $sInputType ?>" name="MerchantTitle" title="MerchantTitle" value="mit" /> <!-- Indtast Deres Firmanavn her -->
<input type="<?= $sInputType ?>" name="OrderNo" title="OrderNo" value="<?= $HTTP_SESSION_VARS["OrderID"]; ?>" >
<input type="<?= $sInputType ?>" name="MerchantAccount" title="MerhcantAccount" value="1234567" > <!-- Indsæt forretningsnummer -->
<input type="<?= $sInputType ?>" name="AmountTrn" title="AmountTrn" value="<?= FormatTrn($HTTP_SESSION_VARS["Amount"]); ?>" >
<input type="<?= $sInputType ?>" name="CurrencyTrn" title="CurrencyTrn" value="DKK" >
<input type="<?= $sInputType ?>" name="TestFlg" title="TestFlg" value="P" >
<input type="<?= $sInputType ?>" name="MerchantCountry" title="MerchantCountry" value="208" >
<input type="<?= $sInputType ?>" name="MerchantUrl" title="MerchantUrl" value="
http://www.ent4you.dk" > <!-- Indsæt Deres www adresse -->
<input type="<?= $sInputType ?>" name="MerchantGmtOffset" title="MerchantGmtOffset" value="1" >
<input type="<?= $sInputType ?>" name="MerchantBrands" title="MerchantBrands" value="" >
<input type="<?= $sInputType ?>" name="PurchaseDate" title="PurchaseDate" value="<?= $sPurchaseDate; ?>" >
<input type="<?= $sInputType ?>" name="PurchaseAmount" title="PurchaseAmount" value="DKK <?= $HTTP_SESSION_VARS["Amount"];?>" >
<input type="<?= $sInputType ?>" name="AuthLifeCycle" title="AuthLifeCycle" value="114" >
</form>
<p>
<a href="java script:return false;" onClick="eDankortRouter(document.Form1);" >
<img src="<?= $sLogoURI ?>" title="Forsøg eDankort-betaling igen" border="0" /></a>
</p>
<p>
E-dankort betalingsvinduet åbnes i et nyt browser vindue.
Hvis De ikke kan se dette vindue kan de trykke på E-dankort logoet.
</p>
<p>
Bemærk! Hvis De benytter en pop-up stopper skal De holde CTRL-tasten nede mens De trykker på logoet.
</p>
<? if (isset($_REQUEST["MerchantDecline"])) { ?>
<p>
<b>FEJL! E-Dankort transaktionen blev ikke godkendt eller annulleret!</b>
</p>
<p>
<a href="java script:return false;" onClick="eDankortRouter(document.Form1);" >
Tryk her for at forsøge igen</a>.
</p>
<? } else { ?>
<script type="text/javascript">
eDankortRouter(document.Form1);
</script>
<? }
}
?>
<!-- </body>
</html> -->
<?
include_once ("../footer.php");
/**
* @return string
* @param string $sAmount
* @desc Format amount as twelve digits, with the last two being decimals (no decimal separator)
*/
function FormatTrn($sAmount) {
$tempAmount = str_pad(str_replace(".", "", $sAmount), 12, "0", STR_PAD_LEFT);
$tempAmount = str_pad(str_replace(",", "", $tempAmount), 12, "0", STR_PAD_LEFT);
return $tempAmount;
}
?>