Пример #1
0
 public function exportCSV()
 {
     $opts = Option::getAll($this->id);
     header("Content-type: text/csv");
     header("Content-Disposition: attachment; filename=" . $this->titre . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     foreach ($opts as $opt) {
         if ($opt->status == 'V') {
             echo $opt->id . "," . $opt->user_login . "," . $opt->user_prenom . "," . $opt->user_nom . "," . $opt->user_mail . "," . $opt->choice_name . "," . $opt->choice_price . "," . $opt->date_creation . "\n";
         }
     }
     exit;
 }
Пример #2
0
    $app->response->redirect("install");
});
$app->get('/cron', function () use($app, $payutcClient, $admin) {
    $payutcClient = getPayutcClient("WEBSALE");
    $options = Option::getAll();
    foreach ($options as $opt) {
        if ($opt->status == 'W') {
            $desc = new Desc($opt->fk_desc_id);
            $funId = $desc->payutc_fun_id;
            $opt->checkStatus($payutcClient, $funId);
        }
    }
    $app->redirect('index');
});
$app->get('/callback', function () use($app, $payutcClient, $admin) {
    $payutcClient = getPayutcClient("WEBSALE");
    $options = Option::getAll(null, null, null, 'W');
    foreach ($options as $opt) {
        if ($opt->status == 'W') {
            $desc = new Desc($opt->fk_desc_id);
            $funId = $desc->payutc_fun_id;
            $opt->checkStatus($payutcClient, $funId);
        }
    }
    if ($_GET['url']) {
        $app->redirect($_GET['url']);
    } else {
        $app->redirect('index');
    }
});
$app->run();
Пример #3
0
 public static function getAll($desc_id = null, $choice_id = null, $tra_id = null, $option_status = null)
 {
     $qb = self::getQbBase();
     if ($desc_id) {
         $qb->andWhere('o.fk_desc_id = :desc_id')->setParameter('desc_id', $desc_id);
     }
     if ($choice_id) {
         $qb->andWhere('o.fk_choice_id = :choice_id')->setParameter('choice_id', $choice_id);
     }
     if ($tra_id) {
         $qb->andWhere('o.payutc_tra_id = :tra_id')->setParameter('tra_id', $tra_id);
     }
     if ($option_status) {
         $qb->andWhere('o.option_status = :option_status')->setParameter('option_status', $option_status);
     }
     $ret = array();
     foreach ($qb->execute()->fetchAll() as $data) {
         $opt = new Option();
         $opt->bind($data);
         $ret[] = $opt;
     }
     return $ret;
 }
Пример #4
0
</h1>
<p class="lead"><?php 
echo $desc->desc;
?>
</p>
</div>

<div class="row marketing">
<div class="col-lg-12">

<?php 
$has_place = false;
if (!$username) {
    echo '<div class="alert alert-info">Avant toute chose tu dois te connecter ! <a class="btn btn-primary" href="login">Connexion</a></div>';
} else {
    $opt = Option::getUser($user->login, $desc->id);
    if (count($opt) > 0) {
        $has_place = true;
        $o = $opt[0];
        if ($o->status == 'W') {
            $o->checkStatus($payutcClient, $desc->payutc_fun_id);
        }
        if ($o->status == 'V') {
            echo '<div class="alert alert-info">Félicitation ' . $user->prenom . ' ' . $user->nom . ', Tu as une place pour cet événement. Les organisateurs te contacteront par mail très prochainement.</div>';
        } else {
            echo '<div class="alert alert-info">' . $user->prenom . ' ' . $user->nom . ', Une place est en cours de réservation avec tes identifiants.
                Tu peux <a class="btn btn-primary" href="' . $o->payutc_tra_url . '">retourner sur PayIcam</a> pour terminer le paiement ou <a class="btn btn-danger" href="cancel?id=' . $desc->id . '">annuler ta commande</a> (Dans tous les cas si tu ne paies pas dans les 15 minutes à venir ta commande sera automatiquement annulée).</div>';
        }
    }
}
$debut = new DateTime($desc->debut);
Пример #5
0
 public function shotgun($user, $payutcClient)
 {
     $desc = new Desc();
     $desc->select($this->descId);
     // Check not yet shotguned
     $opt = Option::getUser($user->login, $this->descId);
     if (count($opt) > 0) {
         $o = $opt[0];
         if ($o->status == 'W') {
             $o->checkStatus($payutcClient, $desc->payutc_fun_id);
         }
         if ($o->status == 'V') {
             throw new \Exception("Tu as déjà une place pour cet événement.");
         } else {
             return $o->payutc_tra_url;
         }
     }
     // Check available
     if (!$this->isAvailable()) {
         throw new \Exception("Tu as malheureusement cliqué trop lentement, ce choix n'est plus disponible !");
     }
     // Check always open
     $debut = new \DateTime($desc->debut);
     $fin = new \DateTime($desc->fin);
     $now = new \DateTime("NOW");
     $diff = $now->diff($debut);
     if ($diff->invert) {
         if ($now->diff($fin)->invert) {
             throw new \Exception("Désolé la vente est terminé...");
         }
     } else {
         throw new \Exception("La vente n'est pas encore ouvert ! Qu'est ce que tu fais la ?");
     }
     // Let's play !
     // cotisation
     // if($user->is_cotisant != 1) {
     //     $art_id = $this->payutc_art_idNC;
     // } else {
     $art_id = $this->payutc_art_idC;
     // }
     $vente = $payutcClient->createTransaction(array("items" => json_encode(array(array($art_id, 1))), "fun_id" => $desc->payutc_fun_id, "mail" => $user->mail, "return_url" => Config::get("self_url") . "shotgun?id=" . $desc->id, "callback_url" => Config::get("self_url") . "callback"));
     $opt = new Option();
     $opt->user_login = $user->login;
     $opt->user_prenom = $user->prenom;
     $opt->user_nom = $user->nom;
     $opt->user_mail = $user->mail;
     $opt->user_cotisant = $user->is_cotisant ? 1 : 0;
     $opt->fk_desc_id = $desc->id;
     $opt->fk_choice_id = $this->id;
     $opt->payutc_tra_id = $vente->tra_id;
     $opt->payutc_tra_url = $vente->url;
     $opt->date_creation = date("Y-m-d H:i:s");
     $opt->status = 'W';
     $opt->insert();
     return $vente->url;
 }