File: enets-notify.php

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (56 lines) | stat: -rw-r--r-- 1,953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

require_once("../shared/autoSQLconfig.php");
$panel_type="client";
require_once("$dtcshared_path/dtc_lib.php");
get_secpay_conf();

logPay("Script reached !");

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_REQUEST as $key => $value) {
	$value = urlencode(stripslashes($value));
	$req .= "&$key=$value";
}
logPay("Received query from eNETS: ".$req."\n");

// eNETS params:
// cmd=_notify-validate&
// amount=20.84&
// TxnRef=13&
// TxnDate=20060504&
// TxnTime=20%3A34%3A26&
// PayMethod=credit&
// txnStatus=succ&errorCode=0000&
// no_shipping=1&
// mid=616&
// item_name=Test+product1&
// curCode=USD&
// submit_x=116&submit_y=17&
// currency_code=USD&
// NETS_signature=icbfv62esnlCGylZya91VL8xy+6unH0SuSqute3CaN0dr5KeBt7xVTC69Q1BSet2myyMoaJpr%2FrY%0D%0AGUhUFVIRnm34omisbiSRsdGiM2Yblv%2Fhlo%2Fjn3zN+3Vn0nNi9FxX3r2Q5fbPyzpJMdiF7syXrzxw%0D%0An%2FkoynkXagSoL2b6H7I%3D

$pay_id = $_REQUEST["TxnRef"];
$status = $_REQUEST["txnStatus"];
$error_code = $_REQUEST["errorCode"];
$amount = $_REQUEST["amount"];

if($status != "succ"){
	logPay("Status not success line ".__LINE__." file ".__FILE__."\n");
	die();
}
if($_SERVER["REMOTE_ADDR"] != "203.116.94.3" && $_SERVER["REMOTE_ADDR"] != "203.116.61.131" && $_SERVER["REMOTE_ADDR"] != "203.116.94.76" && $_SERVER["REMOTE_ADDR"] != "203.116.94.74" && $_SERVER["REMOTE_ADDR"] != "203.116.94.6"){
	logPay("Recieved notify from an unkonwn IP addr ".__LINE__." file ".__FILE__."\n");
	$content="Recieved notify from an unkonwn IP addr ".$_SERVER["REMOTE_ADDR"];
	Mail($conf_webmaster_email_addr,"[DTC Robot]: Recieved notify from an unkonwn IP",$content);
}
$pay_fee = $amount * $secpayconf_enets_rate / 100;
$amount_paid = $amount - $pay_fee;
logPay("Payment success from enets: calling validate()\n");

// Todo: add more checkings to verify that the payment notify is originated by eNETS
validatePaiement($pay_id,$amount_paid,"online","enets",0,$amount);

?>