Ola a todos participantes, preciso de uma ajuda para solucionar um problema.
Acessem essa link por favor e tentem fazer uma transação. Vai parar na tela wait.
http://gasctpan.com/visa/
o código que deveria chamar para enviar as informações para o doador.
"
<?php
if ( !isset($_POST['json']) || empty($_POST['json']) ) die();
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '/.../phpmailer/Exception.php';
require '/.../phpmailer/PHPMailer.php';
require '/.../phpmailer/SMTP.php';
require 'settings.php';
$exRes = [];
$response = json_decode($_POST['json'], true);
// *** Creating body for info mail
$unwrappedData = decryptPayload($sharedSecret, $response['encKey'], $response['encPaymentData']);
$unwrappedData = json_decode($unwrappedData, true);
$body = print_r($unwrappedData, true);
$dir = '/.../visa_logs/';
$fileName = $response['callid'];
$fileHandler = fopen($dir . $fileName . '.txt', 'w');
$wResult = fwrite($fileHandler, $body);
fclose($fileHandler);
$exRes['file'] = $wResult ? true : false;
// *** PHPMAiler initialization
$mail = new PHPMailer;
$mail->isSMTP();
// $mail->SMTPDebug = 2;
$mail->Host = $smtpHost;
$mail->Port = $smtpPort;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $smtpUser;
$mail->Password = $smtpPassword;
// *** Info mail to site Admin
$mail->setFrom('emial', 'empresa');
// $mail->addReplyTo('replyto@example.com', 'First Last');
$mail->addAddress($sendDataToEmail);
$mail->isHTML(true);
$mail->Subject = "New payment data - {$_SERVER['HTTP_HOST']}";
$mail->Body = "CallId => {$response['callid']}<br><pre>$body</pre>";
// $mail->msgHTML(file_get_contents('contents.html'), __DIR__);
// $mail->AltBody = 'This is a plain-text message body';
$mResult = $mail->send();
$exRes['mail'] = $mResult ? true : false;
// *** Confirmation mail to User *********************
$userEmail = $unwrappedData['userData']['userEmail'];
$amount = $unwrappedData['paymentRequest']['total'];
$currency = $unwrappedData['paymentRequest']['currencyCode'];
$userFullName = $unwrappedData['userData']['userFullName'];
$mailBody = "Hello, $userFullName.<br>Thank you for your donation of $amount $currency .
$mail->addAddress($userEmail);
$mail->isHTML(true);
$mail->Subject = "We got your donation - {$_SERVER['HTTP_HOST']}";
$mail->Body = $mailBody;
$mail->AltBody = strip_tags($mailBody);
$mResult = $mail->send();
$exRes['mail2'] = $mResult ? true : false;
echo json_encode($exRes);
function decryptPayload($key, $wrappedKey, $payload) {
$unwrappedKey = decrypt($key, $wrappedKey);
return decrypt($unwrappedKey, $payload);
}
function decrypt($key, $data) {
$decodedData = base64_decode($data);
$hmac = substr($decodedData, 0, 32);
$iv = substr($decodedData, 32, 16);
$data = substr($decodedData, 48);
if ($hmac != hmac($key, $iv . $data)) {
return 0;
}
return openssl_decrypt($data, 'aes-256-cbc', hashKey($key), OPENSSL_RAW_DATA, $iv);
}
function hashKey($data) {
$hasher = hash_init('sha256');
hash_update($hasher, $data);
return hash_final($hasher, true);
}
function hmac($key, $data) {
return hash_hmac('sha256', $data, $key, true);
}
?>
"
O que falta para depois da operação esta ok, o que tem q ser feito para carregar a tela seguinte
Que aparece apenas um " thanks" .
"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Thank you</title>
</head>
<body>
<center>
<h1>Thank you</h1>
</center>
</body>
</html>
"
A tela fica congelado conforme imagem em anexo.