alpha_full/pages/panier/stripe/modePaie.formStripe.php
2026-04-06 22:58:51 +02:00

90 lines
4.9 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// https://dashboard.stripe.com/test/apikeys
// Payment succeeds
// 4242 4242 4242 4242
// Payment requires authentication
// 4000 0025 0000 3155
// Payment is declined
// 4000 0000 0000 9995
// Pour utiliser ces cartes, vous pouvez renseigner n'importe quel cryptogramme (CVV) à 3 chiffres et n'importe quelle date dans le futur.
// ---------------------------------------------------
// Recup des credentials
// ---------------------------------------------------
include ('reqSelectStripe.php');
// ---------------------------------------------------
// Recup des valeurs nécessaires
// ---------------------------------------------------
for($j=0; $j<count($tabIdPays) ; $j++) {
if ($tabIdPays[$j]==$idPaysFact) {
$paysFacLib=strtoupper($tabLibPays[$j]);
$codeIsoPaysFac=strtoupper($tabCodeIsoPays[$j]);
}
if ($tabIdPays[$j]==$idPaysLiv) {
$paysLivLib=strtoupper($tabLibPays[$j]);
$codeIsoPaysLib=strtoupper($tabCodeIsoPays[$j]);
}
}
$montant = ($totalCde);
$montant = str_replace( ",",".",$totalCde);
$montant = str_replace( " ","",$montant);
$montant = ($montant) * 100;
if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug(1, ['paysFacLib' => $paysFacLib, 'montant' => $montant, 'totalCde' => $totalCde, 'SESSION[server]' => $_SESSION['server'] ], 'modePaie.formStripe.php'); }
$_SESSION['montant'] = $montant;
if ($idMail=='' && !empty($_SESSION['idMail']) && isset($_SESSION['idMail'])) $idMail=$_SESSION['idMail'];
$nomSite=$_SESSION['nomSiteAff'];
if ($lg=="FRA") $_SESSION['locale']='fr';
if ($lg=="ENG") $_SESSION['locale']='en';
if ($lg=="ITA") $_SESSION['locale']='it';
if ($lg=="ESP") $_SESSION['locale']='es';
if ($lg=="DEU") $_SESSION['locale']='de';
// ---------------------------------------------------
// Bouton payer ou valider
// ---------------------------------------------------
$test=strtolower(substr($boutonImgPt[16],-3));
if ($test!='') {
if ($test=='jpg' || $test=='peg' || $test=='gif' || $test=='svg' || $test=='ico' || $test=='png' || $test=='bmp') {
$theIcoPaie = '&#160;';
$theIcoPaie .= '<img style="vertical-align: middle; width:40%;" src="' .$boutonImgPt[16]. '" alt="' .$boutonAlt[16]. '" />';
$theIcoPaie .= '&#160;';
}
else {
$theIcoPaie = '&#160;';
$theIcoPaie .= '<i class="' .$boutonImgPt[16]. ' icones" ></i>';
$theIcoPaie .= '&#160;';
}
}
else $theIcoPaie ='';
if ($codeOpe==="upCommentaire") {
if ($_SESSION['isAgencement']) echo '<form action="./pages/panier/stripe/stripeCheckout.appel.php" method="POST" target="_blank" style="text-align:center; margin-bottom:10px; flex:1; " >';
else echo '<form action="./pages/panier/stripe/stripeCheckout.appel.php" method="POST" style="text-align:center; margin-bottom:10px; flex:1; " >';
echo '<div style="flex:1; margin:5px;" ><button class="boutons" type="submit" data-tooltip="Stripe paiement" >' .$theIcoPaie. '' .$boutonMsg[16]. '</button></div>';
echo '<input type="hidden" name="nomSite" id="nomSite" value="' .$nomSite. '" >';
echo '<input type="hidden" name="montant" id="montant" value="' .$montant. '" >';
echo '<input type="hidden" name="idMail" id="idMail" value="' .$idMail. '" >';
echo '<input type="hidden" name="privateSecretStripe" id="privateSecretStripe" value="' .$privateSecretStripe. '" >';
echo '<input type="hidden" name="pubSecretPayStripe" id="pubSecretPayStripe" value="' .$pubSecretPayStripe. '" >';
echo '<input type="hidden" name="server" id="server" value="' .$_SESSION['server']. '" >';
echo '<input type="hidden" name="locale" id="locale" value="' .$_SESSION['locale']. '" >';
echo '<input type="hidden" name="bdd" id="bdd" value="' .$bdd. '" >';
if ($_SESSION['isAgencement']) echo '<input type="hidden" name="success_url" id="success_url" value="https://' .$server. '/admin/frmAdmin.php?affAdmin=2&lg=FRA&carrousselTheme=css_default&agencementOnglet=3&numeroMenuPrpal=12&numeroSousMenu=136&textesAffSection=4&idLanguenav=&nomCss=tablePanier&theVoletCss=Panier&theIdPage=9&previewObject=2&isEspace=0" > ';
else echo '<input type="hidden" name="success_url" id="success_url" value="https://' .$server. '/recap-paiement-faireMajRecap-1" > ';
if ($_SESSION['isAgencement']) echo '<input type="hidden" name="cancel_url" id="cancel_url" value="https://' .$server. '/admin/frmAdmin.php?affAdmin=2&lg=FRA&carrousselTheme=css_default&agencementOnglet=3&numeroMenuPrpal=12&numeroSousMenu=137&textesAffSection=4&idLanguenav=&nomCss=tablePanier&theVoletCss=Panier&theIdPage=9&previewObject=2&isEspace=0" > ';
else echo '<input type="hidden" name="cancel_url" id="cancel_url" value="https://' .$server. '/recap-paiement-faireMajRecap-0" > ';
echo '</form>';
}
else {
dynamiqItemImage (0, 0, 'boutons', 'div', 'onClick="upCommentaire();"', 'bouton', 6, 'icones', '-textClass-', 'margin:auto; margin-bottom:10px;margin-top:10px;');
}
?>