Initial import: Carteasy Shop (Dev-Stand)

This commit is contained in:
Thomas Bartelt
2026-04-20 01:03:43 +02:00
commit d504f8a05d
3845 changed files with 761050 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
// File : decrypt.php
// Description : decrypting utility for internal test use
// required constants
include('./includes/function.inc.php');
$filetitle = "decrypt.php";
// obtain input values (for form method="POST")
$Data = $HTTP_POST_VARS["Data"];
$Len = $HTTP_POST_VARS["Len"];
$sURL = $HTTP_POST_VARS["PayType"];
// decrypt the data string
$myPayGate = new ctPayGate;
$plaintext = $myPayGate->ctDecrypt($Data, $Len, $Password);
// prepare information string
$a = ""; $a = split ('&', $plaintext);
$info = $myPayGate->ctSplit($a, '=');
// html output
$realstatus = $sPayType[0];
require('./includes/html.inc.php');
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
// File: error.php
$filetitle = "error.php";
include('result.php');
?>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+18
View File
@@ -0,0 +1,18 @@
<html>
<head>
<title><?php echo $filetitle; ?></title>
</head>
<body>
<center>
<p>&nbsp;<p>
<h2><?php echo $realstatus; ?></h2>
<table border=1><tr><td>
<table border=0 cellpadding=4>
<tr><th colspan="2"><u><?php echo $sthInfo; ?></u></th></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
<?php echo $info; ?>
</table>
</td></tr></table>
</center>
</body>
</html>
+87
View File
@@ -0,0 +1,87 @@
<?php
// File: ini.inc.php
// !!! security !!! these values are normally extracted from a database.
$MerchantID = "ta_edvtest"; // via e-mail from computop support
$Password = "Xk3[4Y=a_2xT5P(f"; // via phone from computop support
// initialize input.php
$iAmount = 11;
$sCurrency = "EUR";
$sURLSuccess = "http://localhost/ctPayGate/ok.php";
$sURLFailure = "http://localhost/ctPayGate/error.php";
$sURLNotify = "http://localhost/ctPayGate/notify.php";
$sOrderDesc = "your order";
$sUserData = "your data";
$sthPayGate = "PHP - PayGate";
$stdTransID = "TransID";
$stdAmount = "Amount";
$stdCurrency = "Currency";
$stdSuccess = "Success-URL";
$stdFailure = "Failure-URL";
$stdNotify = "Notify-URL";
$stdOrder = "Order description";
$stdUserdata = "Userdata";
$stdInpSend = "Send Request";
// initialize payment.php
$stdPayType = "PayType";
$defPayType = 1; // preselected PayType
$sPayType[0] = "Decryption/Check Page";
$sPayType[1] = "Creditcard payment with SET wallet";
$sPayType[2] = "Creditcard payment with 128 bit SSL";
$sPayType[3] = "GeldKarte";
$sPayType[4] = "Mobile payment with PayBox";
$sPayType[5] = "Electronic Direct Debit";
$sPayType[6] = "Notify/Check Page";
$sURL[0] = "decrypt.php";
$sURL[1] = "https://www.netkauf.de/paygate/payset.aspx";
$sURL[2] = "https://www.netkauf.de/paygate/payssl.aspx";
$sURL[3] = "https://www.netkauf.de/paygate/paygks.aspx";
$sURL[4] = "https://www.netkauf.de/paygate/paypaybox.aspx";
$sURL[5] = "https://www.netkauf.de/paygate/payelv.aspx";
$sURL[6] = "notify.php";
$stdInpCheck = " SubmitCheck ";
$checkText = "Data that is to be transmitted to the CompuTop PayGate: ";
$checkURL = "https://www.netkauf.de/paygate/encrypt.asp";
$checkLink = "Check";
// initialize notify.php
$filename = "./notifylog/urlnotify.log";
// logfile example - database preferred.
// initialize html.inc.php
$sthInfo = "Information";
// realstatus strings ok.php, notify.php, error.php
$text['nodata'] = "No data found!";
// No data. Tried to open directly (e.g. with a browser)? (*.php)
$text['paymentfailed'] = "Payment failed!";
// Payment failed. Correct response. (notify.php, error.php)
$text['paymentsuccessful'] = "Payment successful!";
// Payment succeeded. Correct response. (notify.php, ok.php)
$text['unknownstatus'] = "Unknown status!";
// Unknown status (notify.php)
?>
+34
View File
@@ -0,0 +1,34 @@
<?php
// required constants
include('./includes/ini.inc.php');
mt_srand((double)microtime()*1000000);
$sTransID = (string)mt_rand();
$sTransID .= date("yzGis");
?>
<html>
<head>
<title>input.php</title>
</head>
<body>
<form method=post action="payment.php">
<table border=0 cellspacing=0 cellpadding=5>
<tr><th colspan=2> <?php echo $sthPayGate; ?> </th></tr>
<tr><td align=right><?php echo $stdTransID; ?> </td><td><input type=text name=TransID value="<?php echo $sTransID; ?>" size=30></td></tr>
<tr><td align=right><?php echo $stdAmount; ?> </td><td><input type=text name=Amount value="<?php echo $iAmount; ?>" size=10></td></tr>
<tr><td align=right><?php echo $stdCurrency; ?> </td><td><input type=text name=Currency value="<?php echo $sCurrency; ?>" size=3> </td></tr>
<tr><td align=right><?php echo $stdSuccess; ?> </td><td><input type=text name=URLSuccess value="<?php echo $sURLSuccess; ?>" size=50></td></tr>
<tr><td align=right><?php echo $stdFailure; ?> </td><td><input type=text name=URLFailure value="<?php echo $sURLFailure; ?>" size=50></td></tr>
<tr><td align=right><?php echo $stdNotify; ?> </td><td><input type=text name=URLNotify value="<?php echo $sURLNotify; ?>" size=50></td></tr>
<tr><td align=right><?php echo $stdOrder; ?> </td><td><input type=text name=OrderDesc value="<?php echo $sOrderDesc; ?>" size=50></td></tr>
<tr><td align=right><?php echo $stdUserdata; ?> </td><td><input type=text name=UserData value="<?php echo $sUserData; ?>" size=50></td></tr>
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td>&nbsp; </td><td><input type=submit value=" <?php echo $stdInpSend; ?> "></td></tr>
</table>
</form>
</body>
</html>
+96
View File
@@ -0,0 +1,96 @@
<?php
// File : notify.php
// Description: see CompuTop PayGate documentation and result.php
// Important note: the NOTIFY is always performed with a POST-Request and blowfish-encrypted data!
// required constants
include('./includes/function.inc.php');
$filetitle = "notify.php";
$filename = "./notifylog/urlnotify.log"; // this is an example. Database preferred.
$dat = date("d.m.Y H:i:s");
$row = "\n\n-------------- ".$dat." --------------\n";
// obtain input values (for form method="POST")
$Data = $HTTP_POST_VARS["Data"];
$Len = $HTTP_POST_VARS["Len"];
// decrypt the data string
$myPayGate = new ctPayGate;
$plaintext = $myPayGate->ctDecrypt($Data, $Len, $Password);
// prepare notify log
$a = ""; $a = split ('&', $plaintext);
$info = $myPayGate->ctSplit($a, '=');
$TransID = $myPayGate->ctSplit($a, '=', 'TransID');
$Status = $myPayGate->ctSplit($a, '=', 'Status');
$PayID = $myPayGate->ctSplit($a, '=', 'PayID');
$Type = $myPayGate->ctSplit($a, '=', 'Type');
$UserData = $myPayGate->ctSplit($a, '=', 'UserData');
$row .= "\nTransID:\t".$TransID;
$row .= "\nStatus:\t\t".$Status;
$row .= "\nPayID:\t\t".$PayID;
$row .= "\nType:\t\t".$Type;
$row .= "\nUserData:\t".$UserData;
// check transmitted decrypted status
$realstatus = $myPayGate->ctRealstatus($Status);
// example: writing into a logfile instead of using a database
if(!file_exists($filename)){
$fp=fopen($filename, "w");
fclose($fp);
}
$fpn=@fopen($filename.".tmp", "w");
if($fpn <= 0){
$realstatus .= "\nerror writing logfile $filename.tmp\n";
}
$row .= "\nRealstatus:\t".$realstatus;
fputs($fpn, $row);
$fp = @fopen($filename, "r");
if($fp <= 0){
$realstatus .= "\nerror reading logfile $filename\n";
}
while(!feof($fp)){
$zeile = fgets($fp, 32000);
fputs($fpn, $zeile);
}
fclose($fp);
fclose($fpn);
unlink($filename);
rename($filename.".tmp", $filename);
// response
echo "ok";
// html output - test only
/*if(!(($realstatus == $text['paymentsucessful']) || ($realstatus == $text['paymentfailed']))){
require('./includes/html.inc.php');
} else {
echo "<html><title>$filetitle</title>$realstatus</html>";
} */
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
// File: ok.php
$filetitle = "ok.php";
include('result.php');
?>
+121
View File
@@ -0,0 +1,121 @@
<?php
// required constants
include('./includes/function.inc.php');
// read data (for form method="POST")
$TransID = $HTTP_POST_VARS["TransID"];
$Amount = $HTTP_POST_VARS["Amount"];
$Currency = $HTTP_POST_VARS["Currency"];
$OrderDesc = $HTTP_POST_VARS["OrderDesc"];
$URLSuccess = $HTTP_POST_VARS["URLSuccess"];
$URLFailure = $HTTP_POST_VARS["URLFailure"];
$URLNotify = $HTTP_POST_VARS["URLNotify"];
$UserData = $HTTP_POST_VARS["UserData"];
// optional values
$Response = "&Response=encrypt";
$Currency = trim($Currency);
if($Currency == ""){
$Currency = "&Currency=$sCurrency";
} else {
$Currency = "&Currency=".$Currency;
}
$UserData = "&UserData=".$UserData;
//$Capture = "&Capture=AUTO";
// format data which is to be transmitted - required
$TransID = "&TransID=" .$TransID;
$Amount = "&Amount=" .$Amount;
$URLSuccess = "&URLSuccess=" .$URLSuccess;
$URLFailure = "&URLFailure=" .$URLFailure;
$OrderDesc = "&OrderDesc=" .$OrderDesc;
$URLNotify = "&URLNotify=" .$URLNotify;
// building the string MerchantID, Len and Data (encrypted)
$plaintext = "MerchantID=".$MerchantID.$TransID.$Amount.$Currency.$URLSuccess.$URLFailure.$URLNotify.$UserData.$OrderDesc.$Response.$Capture;
$Len = strlen($plaintext); // Length of the plain text string
echo $plaintext;
// encryption
$BlowFish = new ctBlowfish;
$Data = $BlowFish->ctEncrypt($plaintext, $Len, $Password);
// prepare javascript array
$jsURL = implode(';', $sURL);
?>
<html>
<head>
<title>payment.php</title>
<script language="JavaScript">
function pay_submit(arrURL){
sURL = arrURL.split(";");
for(var i = 0; i < sURL.length; i++){
if(document.ctForm.PayType.options[document.ctForm.PayType.selectedIndex].value==i){
document.ctForm.action=sURL[i];
}
}
document.ctForm.submit();
}
</script>
</head>
<body>
<form method=post action=decrypt.php name=ctForm>
<input type=hidden name=MerchantID value="<?php echo $MerchantID; ?>">
<input type=hidden name=Data value="<?php echo $Data; ?>">
<input type=hidden name=Len value="<?php echo $Len; ?>">
<table border=0 cellspacing=0 cellpadding=5>
<tr>
<td><?php echo $stdPayType ?></td>
<td>
<select name=PayType>
<?php
$i = 0;
foreach($sPayType as $selPayType){
if($i == $defPayType){
echo "<option value=\"$i\" selected>$selPayType</option>";
} else {
echo "<option value=\"$i\">$selPayType</option>";
}
$i++;
}
?>
</select>
</td>
</tr>
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td colspan=2><input type=button onclick=pay_submit('<?php echo $jsURL; ?>'); value="<?php echo $stdInpCheck; ?>"></td></tr>
</table>
</form><p>
<?php echo $checkText; ?><a href=<?php echo "$checkURL?MerchantID=$MerchantID&Len=$Len&Data=$Data"; ?>><?php echo $checkLink; ?></a>
</body>
</html>
+47
View File
@@ -0,0 +1,47 @@
<?php
// File: result.php
// Description: This file explains how to work with an encrypted message transmitted by the CompuTop PayGate
// - use 'Notify' for Server2Server communication (The PayGate informs the Shop-Server via 'Notify' about the payment result before URLOk or URLFailure is envoked)
// - Possible-Status values: "FAILED", "AUTHORIZED" or "OK"
// - failed , SET/SSL or GeldKarte, EDD (German: Lastschrift/ELV)
// - TransID - your shop`s payment ID (please use a unique TransID for each payment)
// - PaymentID (PayID) - unique CompuTop ID for the payment
// - Type - Payment type (SSL, GK, EDD, PayBox...)
// Important note: This page requires the use of "response=encrypt" in the payment request
// required constants
include('./includes/function.inc.php');
// obtain input values (method="GET")
$Data = $HTTP_GET_VARS["Data"];
$Len = $HTTP_GET_VARS["Len"];
// decrypt the data string
$myPayGate = new ctPayGate;
$plaintext = $myPayGate->ctDecrypt($Data, $Len, $Password);
// prepare information string
$a = ""; $a = split ('&', $plaintext);
$info = $myPayGate->ctSplit($a, '=');
$Status = $myPayGate->ctSplit($a, '=', 'Status');
// check transmitted decrypted status
$realstatus = $myPayGate->ctRealstatus($Status);
// html output
require('./includes/html.inc.php');
?>