Sid Gifari From Gifari Industries - BD Cyber Security Team
Home
/
home
/
airmobeuag
/
pro
/
commande
/
✏️
Editing: stripe.confirme.php
<?php session_start();?> <!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> <link rel = "stylesheet" href = "css/airmob.css?<?=time();?>"> <link rel = "stylesheet" href = "css/step.css?<?=time();?>"> <link rel = "stylesheet" href = "css/switch.css?<?=time();?>"> <title>Airmob</title> </head> <body> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet"> <div class="titre">Paiement par Carte</div> <div class="SepCenter"></div> <br> <div class="container"> <div class="row"> <div class="col-md-12"> <?php error_reporting(E_ALL); ini_set("display_errors", 0); include_once ("./lib/commande.lib.php"); $MyCde = new ClassCde(); $token = $_POST['stripeToken']; $email = $_POST['email']; $name = $_POST['name']; $amount = $_POST['amount']; $Customer = $MyCde->APIStripe([ 'action' => 'customers', 'data' => ['source' => $token,'description'=>$name,'email'=>$email]]); // DEBUG : affichage // echo "<pre>"; print_r($Customer); echo "</pre>"; // [KO] erreurs de la banque if( $Customer->error->code ) { $Color = "#d9534f" ; $Msg = "Paiement refusé"; $CodeRefus = $Customer->error->code; $RaisonRefus = $Customer->error->decline_code; } // [OK] Création de customer elseif( $Customer->id ) { // Paiement $Paiement = $MyCde->APIStripe([ 'action' => 'charges', 'data' => ['amount' => $amount,'currency'=>'eur','description'=>$email, 'customer'=>$Customer->id,'metadata'=>['BC###']]]); if ($Paiement->paid==1 && !$Paiement->error) { $Color = "#5cb85c" ; $Msg = "Paiement accepté"; // Email de confirmation vers AIRMOB $idu = $_SESSION['airmob']['macommande']['idunique']; if($idu) include "etatcmd.cron.php"; } else { $Color = "#d9534f" ; $Msg = "Paiement echec"; $CodeRefus = $Paiement->error->code; $RaisonRefus = $Paiement->error->message."<br>".$Paiement->error->type; } } // [KO] echec, deja passé, reload etc... else { $Color = "#d9534f" ; $Msg = "Paiement echec"; $CodeRefus = "Impossible de continuer !"; } $MyCde->EnregCommande($Msg,$Customer); ?> <div class="card"> <div class="card-header"> Airmob : Votre paiement. </div> <div class="card-body"> <h4 class="card-title" style="color:<?=$Color?>;"><b><?=$Msg?></b></h4> <?php if ($CodeRefus) {?> <p class="card-text">Raison du refus :<br>[<?=$CodeRefus."] ".$RaisonRefus?></p> <a href="#" class="btn btn-primary" Onclick="index.php">RETOUR</a> <?php } else { ?> <p class="card-text">Nous avons bien enregistré votre réglement...</p> <?php } ?> </div> </div> <?php //die('DEBUG : initialisation stop !'); unset($_SESSION['airmob']); //die('Reset commande !'); //echo "paiement interrompu !"; exit; // DEBUG : affichage //echo "<pre>"; print_r($_SESSION['airmob']); echo "</pre>"; //echo "<h1>==> ".$Customer->id."</h1>"; //echo "<pre>"; print_r($Paiement); echo "</pre>"; exit; ?> </div> </div> </div> </body> </html>
💾 Save
❌ Cancel