| Current Path : /home/h/a/p/happyrenas/old/huissier-express.fr/old/ |
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/h/a/p/happyrenas/old/huissier-express.fr/old/pre_auth.php |
<?
session_start();
error_reporting(E_ALL);
$_SESSION['cart_id'] = "";
$_SESSION['amount'] = "";
$_SESSION['currency'] = "";
ini_set('display_errors','On');
include("config.php");
$page="pre_auth.php";
////////////////////////////////////////////
require_once 'administration/panel/mangopay/vendor/autoload.php';
$Api = new \MangoPay\MangoPayApi();
$Api->Config->ClientId = 'ofyc2017';
$Api->Config->ClientPassword = 'iqkhQK591cWzu3Ept5Z4niNiaCaw8Ctpa9ixa68ZvXrP9BEpbJ';
$Api->Config->TemporaryFolder = 'temp';
$Api->Config->BaseUrl = 'https://api.sandbox.mangopay.com';
////////////////////////////////////////////
///////////////////////////////////////////
//CREATE CLIENT
///////////////////////////////////////////
/*
try
{
$UserNatural = new MangoPay\UserNatural();
$UserNatural->Tag = "custom meta";
$UserNatural->FirstName = "Joe";
$UserNatural->LastName = "Blogs";
$UserNatural->Address = new \MangoPay\Address();
$UserNatural->Address->AddressLine1 = "1 Mangopay Street";
$UserNatural->Address->AddressLine2 = "The Loop";
$UserNatural->Address->City = "Paris";
$UserNatural->Address->Region = "Ile de France";
$UserNatural->Address->PostalCode = "75001";
$UserNatural->Address->Country = "FR";
$UserNatural->Birthday = 1463496101;
$UserNatural->Nationality = "GB";
$UserNatural->CountryOfResidence = "FR";
$UserNatural->Occupation = "Carpenter";
$UserNatural->IncomeRange = 2;
$UserNatural->Email = "support@mangopay.com";
$Result = $Api->Users->Create($UserNatural);
echo "<pre>";print_r ($UserNatural);echo "</pre>";
$user_id = $Result->Id;
echo "User ID : ".$user_id;
}
catch(MangoPay\Libraries\ResponseException $e)
{
echo $e->GetCode();
echo $e->GetMessage();
echo $e->GetErrorDetails();
}
catch(MangoPay\Libraries\Exception $e)
{
echo $e->GetMessage();
}
*/
///////////////////////////////////////////
//CREATE CART REGISTRARION
///////////////////////////////////////////
$user_id=19056567;
$_SESSION['amount'] = "150";
$_SESSION['currency'] = "EUR";
try {
$CardRegistration = new \MangoPay\CardRegistration();
$CardRegistration->Tag = "custom meta";
$CardRegistration->UserId = $user_id;
$CardRegistration->Currency = "EUR";
$CardRegistration->CardType = "CB_VISA_MASTERCARD";
$Result = $Api->CardRegistrations->Create($CardRegistration);
echo "<pre>";print_r ($Result);echo "</pre>";
$_SESSION['cart_id'] = $Result->Id;
echo "Cart ID : ".$_SESSION['cart_id'];
}
catch(MangoPay\Libraries\ResponseException $e)
{
echo $e->GetCode();
echo $e->GetMessage();
echo $e->GetErrorDetails();
}
catch(MangoPay\Libraries\Exception $e)
{
echo $e->GetMessage();
}
$returnUrl = 'http' . ( isset($_SERVER['HTTPS']) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];
$returnUrl .= substr($_SERVER['REQUEST_URI'], 0, strripos($_SERVER['REQUEST_URI'], '/') + 1);
$returnUrl .= 'pre_auth1.php';
//ERROR CODE : https://docs.mangopay.com/guide/errors
//CB DE TEST : https://docs.mangopay.com/guide/testing-payments
//3569990000000157
//1018
//123
?>
<form id="form-paiement" action="<?php print $Result->CardRegistrationURL; ?>" method="post">
<input type="hidden" name="data" value="<?php print $Result->PreregistrationData; ?>" />
<input type="hidden" name="accessKeyRef" value="<?php print $Result->AccessKey; ?>" />
<input type="hidden" name="returnURL" value="<?php print $returnUrl; ?>" />
<input type="hidden" name="cart_id" value="<?php print $_SESSION['cart_id']; ?>" />
<table width=100% border=1>
<tr>
<td width="100%"><p class="a3_style" style="text-align:center;">Montant :</p></td>
</tr>
<tr>
<td><p class="a3_style" style="text-align:center;"><?php echo $_SESSION['amount'] . ' ' . $_SESSION['currency']; ?></p></td>
</tr>
<tr>
<td width="100%"><p class="a3_style" style="text-align:center;">Numéro de carte :</p></td>
</tr>
<tr>
<td style="text-align:center;"><input type="text" value="" name="cardNumber" /></td>
</tr>
<tr>
<td width="100%"><p class="a3_style" style="text-align:center;">Date d'expiration <small>(MMAA)</small> :</p></td>
</tr>
<tr>
<td style="width:100%; text-align:center;"><input type="text" placeholder="Ex : 0117" min="0" name="cardExpirationDate" /></td>
</tr>
<tr>
<td width="100%"><p class="a3_style" style="text-align:center;">Cryptogramme :</p></td>
</tr>
<tr>
<td style="text-align:center;"><input type="text" value="" name="cardCvx" /></td>
</tr>
<tr>
<td width="100%"><p class="a3_style" style="text-align:center;"></p></td>
</tr>
<tr>
<td style="text-align:center;">
<button name="insertion" type="submit" class="subscribe_btn pix_text" style="width:220px;">
<span class="editContent">ENREGISTRER CARTE</span>
</button>
</td>
</tr>
</table>
</form>
</body>
</html>