-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirmacion.php
49 lines (38 loc) · 1.42 KB
/
confirmacion.php
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
<?php
include 'config.php';
$referenceCode = $_REQUEST['reference_sale'];
$txtValue = $_REQUEST['value'];
$newValue = number_format($txtValue, 1, '.', '');
$currency = $_REQUEST['currency'];
$statePol = $_REQUEST['state_pol'];
$sign = $_REQUEST['sign'];
$estadoTxt = 'Firma no concuerda';
$firma = "$ApiKey~$merchantId~$referenceCode~$newValue~$currency~$statePol";
$firmaMd5 = md5($firma);
// Si la firma concuerda
if ($firmaMd5 === $sign) {
switch ($statePol) {
case 4:
$estadoTxt = "Transacción aprobada";
break;
case 6:
$estadoTxt = "Transacción rechazada";
break;
case 7:
$estadoTxt = "Transacción pendiente";
break;
case 104:
$estadoTxt = "Error";
break;
default:
$estadoTxt = $_REQUEST['mensaje'];
}
}
$msg = "<b>Estado:</b> $estadoTxt <br>";
$msg .= "<b>Apikey:</b>$ApiKey - <b>merchantId:</b>$merchantId - <b>referenceCode:</b>$referenceCode - <b>newValue:</b>$newValue - <b>currency:</b>$currency - <b>statePol:</b>$statePol";
$msg .= "<b>Firma MD5:</b> $firmaMd5 <br>";
$msg .= "<br><hr><br><b>REQUEST EN JSON<br>";
$msg .= json_encode($_REQUEST);
$headers = 'MIME-Version: 1.0' . "\r\n"; // set mime version
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // set content-type as html
//mail($confirmacionEmail, 'Formulario página web', $msg, $headers);