| Current Path : /home/happyrenas/old/happy-and-pay.fr/v3/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/happy-and-pay.fr/v3/paiement_simple_verification.php |
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
include("../config.php");
$page="module.php";
////////////////////////////////////////////
////////////////////////////////////////////
require_once '../administration/templates/admin3/mangopay/vendor/autoload.php';
$MangopayApi = new \MangoPay\MangoPayApi();
$MangopayApi->Config->ClientId = 'philippe2015';
$MangopayApi->Config->ClientPassword = 'hK15oQKQig9N2UFEXQpCoirptU4VTeU28p0CTyiprt0fQuwFPP';
$MangopayApi->Config->TemporaryFolder = 'temp';
$MangopayApi->Config->BaseUrl = 'https://api.mangopay.com';
////////////////////////////////////////////
////////////////////////////////////////////
?>
<!doctype html>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Happy And Pay</title>
<meta name='description' content=""/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="icon" href="../images/icone.ico"/>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="../assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/base/css/plugins.css" rel="stylesheet" type="text/css" />
<link href="../assets/base/css/components.css" id="style_components" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="design.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/prefixfree.js"></script>
</head>
<body>
<header>
<div>
<p id="logo"><a href="http://www.happy-and-pay.fr/" title=""><img src="../images/logo-happy-rentals.jpg" alt="Logo Happy Rentals" class="middle"/></a></p>
</div>
</header>
<section id="main-content">
<p id="top"></p>
<div>
<div id="bloc-paiement">
<p class="open-b font18 orange">
<?
$myquery = "SELECT * from client_reservation where id =".$_SESSION['reservation_id'];
$reservation = $db->get_row($myquery);
$reservation_id = $reservation->id;
$proprietaire_id = $reservation->proprietaire_id;
$date1 = $reservation->date_debut; $date1 = date("d-m-Y", strtotime($date1));
$date2 = $reservation->date_fin; $date2 = date("d-m-Y", strtotime($date2));
$proprietaire_mail = $reservation->proprietaire_mail;
$ville = $reservation->ville;
$paiement_type = $reservation->paiement_type;
$myquery = "SELECT * from client where id =".$_SESSION['utilisateur_id'];
$client = $db->get_row($myquery);
$client_nom = $client->nom;
$client_prenom = $client->prenom;
$client_mail = $client->mail;
if (!isset($_SESSION['montant'])) {die('<div style="color:red;">No payment has been started<div>');}
try {
$cardRegister = $MangopayApi->CardRegistrations->Get($_SESSION['cardRegisterId']);
$cardRegister->RegistrationData = isset($_GET['data']) ? 'data=' . $_GET['data'] : 'errorCode=' . $_GET['errorCode'];
$updatedCardRegister = $MangopayApi->CardRegistrations->Update($cardRegister);
if ($updatedCardRegister->Status != 'VALIDATED' || !isset($updatedCardRegister->CardId))
die('<div style="color:red;">Erreur<div>');
$card = $MangopayApi->Cards->Get($updatedCardRegister->CardId);
$wallet = new \MangoPay\Wallet();
$wallet->Owners = array( $updatedCardRegister->UserId );
$wallet->Currency = $_SESSION['currency'];
$wallet->Description = 'Paiement';
$createdWallet = $MangopayApi->Wallets->Create($wallet);
$payIn = new \MangoPay\PayIn();
$payIn->CreditedWalletId = $createdWallet->Id;
$payIn->AuthorId = $updatedCardRegister->UserId;
$payIn->DebitedFunds = new \MangoPay\Money();
$payIn->DebitedFunds->Amount = $_SESSION['montant'];
$payIn->DebitedFunds->Currency = $_SESSION['currency'];
$payIn->Fees = new \MangoPay\Money();
$payIn->Fees->Amount = $_SESSION['commission'];
$payIn->Fees->Currency = $_SESSION['currency'];
$payIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsCard();
$payIn->PaymentDetails->CardType = $card->CardType;
$payIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
$payIn->ExecutionDetails->CardId = $card->Id;
$payIn->ExecutionDetails->SecureModeReturnURL = "https://www.happy-rentals.com/mangopay/paiement_simple_verification_3ds.php";
$payIn->ExecutionDetails->ReturnURL = MangoPayDemo_ReturnURL;
$createdPayIn = $MangopayApi->PayIns->Create($payIn);
if ($createdPayIn->Status == 'SUCCEEDED')
{
echo '<div style="font-size:22px;color:green;">'.
'<b>Votre paiement a été validé.</b><br><br> </div><div style="font-size:15px;color:green;"><b>Votre transaction a bien été enregistrée.</b><br><br>'
.'Référence du paiement : ' . $createdPayIn->Id
//. '<br> Wallet Id = ' . $createdWallet->Id
. ' <br> Référence de la transaction : '.$_SESSION['reservation_id'].'<br><br><a style="color:black" href="http://www.happy-rentals.com/"> Retour au site</a> </div>';
require_once('../includes/class.phpmailer.php');
require_once('../includes/class.smtp.php');
//CLIENT
include('tpl_client.php');
$objet="Votre réservation à ".$ville." du ".$date1." au ".$date2." - paiement enregistré";
$from = "no-reply@happy-and-pay.fr";
$reply = $from;
$mail = new PHPmailer();
$mail->SMTPDebug = 0;
$mail->CharSet = "UTF-8";
$mail->IsHTML(true);
$mail->From=$from;
$mail->AddAddress($client_mail);
$mail->AddBCC("phil_aph@hotmail.com");
$mail->AddBCC("happyendpay@happy-rentals.com");
$mail->AddReplyTo($reply);
$mail->Subject=$objet;
$mail->Body=$message;
if(!$mail->Send())
{echo $mail->ErrorInfo;}
else{echo '';}
unset($mail);
//PROPRIETAIRE
if ($paiement_type==1)
{
include('tpl_proprietaire_acompte.php');
$objet="Client ".$client_prenom." ".$client_nom." du ".$date1." au ".$date2." - Demande de paiement acompte";
}
else
{
include('tpl_proprietaire_solde.php');
$objet="Client ".$client_prenom." ".$client_nom." du ".$date1." au ".$date2." - Demande de paiement solde";
}
$from = "no-reply@happy-and-pay.fr";
$reply = $from;
$mail = new PHPmailer();
$mail->SMTPDebug = 0;
$mail->CharSet = "UTF-8";
$mail->IsHTML(true);
$mail->From=$from;
$mail->AddAddress($proprietaire_mail);
$mail->AddBCC("phil_aph@hotmail.com");
$mail->AddBCC("happyendpay@happy-rentals.com");
$mail->AddReplyTo($reply);
$mail->Subject=$objet;
$mail->Body=$message;
if(!$mail->Send())
{echo $mail->ErrorInfo;}
else{echo '';}
unset($mail);
$payment_id_date = date("Y-m-d H:i:s");
$payment_id_date = date("Y-m-d", strtotime($payment_id_date));
$payment_id_montant = $_SESSION['montant']/100;
$payment_id_commission = $_SESSION['commission']/100;
$requete="UPDATE client_reservation set statut ='4', payment_id='".$createdPayIn->Id."', payment_id_date='".$payment_id_date."', payment_id_montant='".$payment_id_montant."', payment_id_commission='".$payment_id_commission."', createdWallet='".$createdWallet->Id."' where id =".$_SESSION['reservation_id'];
//echo $requete;
$db->query($requete);
}
//AJOUT 3DSECURE
elseif ($createdPayIn->ExecutionDetails->SecureModeNeeded && $createdPayIn->Status!="FAILED")
{
header("Location: ".$createdPayIn->ExecutionDetails->SecureModeRedirectURL);//after the 3DS step, they will be redirected to the $createdPayIn→ExecutionDetails→SecureModeReturnURL whether the 3DS step was successfull or not
//die();
}
//FIN AJOUT 3DSECURE
else {
/* print '<div style="color:red;">'.
'Pay-In has been created with status: '
. $createdPayIn->Status . ' (result code: '
. $createdPayIn->ResultCode . ')'
.'</div>';*/
echo "Une erreur est survenue";
}
} catch (\MangoPay\ResponseException $e) {
/*print '<div style="color: red;">'
.'\MangoPay\ResponseException: Code: '
. $e->getCode() . '<br/>Message: ' . $e->getMessage()
.'<br/><br/>Details: '; print_r($e->GetErrorDetails())
.'</div>';*/
echo "Une erreur est survenue";
}
// clear data in session to protect against double processing
//session_unset();session_destroy();
//$_SESSION['passage'] = $createdPayIn->Id;
?>
</p>
</div>
</div>
</section>
<footer>
<div>
<p>
<br/><br/>
© Copyright 2014 - Happy Rentals - Tous droits réservés - Marque déposée<br/>
Happy R protège les clients des faux propriétaires ou de personnes qui usurpent l'identité de vrai propriétaire.
</p>
</div>
</footer>
</body>
<!-- SCRIPTS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="../js/smoothscroll.js"></script>
<script type="text/javascript">
function inputFocus(input) {
if(input.value==input.defaultValue) {
input.value = '';
}
}
function inputBlur(input) {
if(input.value=='') {
input.value = input.defaultValue;
}
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-89044331-3', 'auto');
ga('send', 'pageview');
</script>
</html>