From a2558f2b2bccc90e7db9946f09817fb252aef3c7 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sat, 8 Jul 2006 23:40:03 +0000 Subject: [PATCH] migrate payments. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@397 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 3 + hooks/money.inc.php | 2 +- htdocs/paiement/cyberpaiement_retour.php | 148 ---------- htdocs/paiement/index.php | 61 ---- htdocs/paiement/paypal_retour.php | 129 --------- include/money/cyberpaiement.inc.php | 4 +- include/money/paypal.inc.php | 3 +- modules/payment.php | 325 ++++++++++++++++++++++ modules/platal.php | 2 + templates/{paiement => payment}/index.tpl | 18 +- templates/{paiement => payment}/retour_paypal.tpl | 2 +- templates/xnet/groupe/evenements.tpl | 2 +- templates/xnet/groupe/telepaiement.tpl | 2 +- 13 files changed, 351 insertions(+), 350 deletions(-) delete mode 100644 htdocs/paiement/cyberpaiement_retour.php delete mode 100644 htdocs/paiement/index.php delete mode 100644 htdocs/paiement/paypal_retour.php create mode 100644 modules/payment.php rename templates/{paiement => payment}/index.tpl (92%) rename templates/{paiement => payment}/retour_paypal.tpl (96%) diff --git a/ChangeLog b/ChangeLog index 3beb0e8..556f349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ New: * Marketing: - Switch to the new URI scheme. -MC + * Payment: + - Switch to the new URI scheme. -MC + * Platal: - Create module. -MC diff --git a/hooks/money.inc.php b/hooks/money.inc.php index 33012b3..7549511 100644 --- a/hooks/money.inc.php +++ b/hooks/money.inc.php @@ -49,7 +49,7 @@ function money_menu() { global $globals; if ($globals->money->mpay_enable) { - $globals->menu->addPrivateEntry(XOM_SERVICES, 30, 'Télépaiements', 'paiement/'); + $globals->menu->addPrivateEntry(XOM_SERVICES, 30, 'Télépaiements', 'payment'); } } diff --git a/htdocs/paiement/cyberpaiement_retour.php b/htdocs/paiement/cyberpaiement_retour.php deleted file mode 100644 index 306d3a7..0000000 --- a/htdocs/paiement/cyberpaiement_retour.php +++ /dev/null @@ -1,148 +0,0 @@ -addTo("telepaiement@polytechnique.org"); - $mymail->setFrom("webmaster@polytechnique.org"); - $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)"); - $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); - $mymail->send(); - exit; -} - -/* http://fr.wikipedia.org/wiki/Formule_de_Luhn */ -function luhn($nombre) { - $s = strrev($nombre); - $sum = 0; - for ($i = 0; $i < strlen($s); $i++) { - $dgt = $s{$i}; - $sum += ($i % 2) ? (2*$dgt) % 9 : $dgt; - } - return $sum % 10; -} - -/* calcule la clé d'acceptation a partir de 5 champs */ -function cle_accept($d1,$d2,$d3,$d4,$d5) -{ - $m1 = luhn($d1.$d5); - $m2 = luhn($d2.$d5); - $m3 = luhn($d3.$d5); - $m4 = luhn($d4.$d5); - $n = $m1 + $m2 + $m3 + $m4; - $alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - return $alpha{$n-1}.$m1.$m2.$m3.$m4; -} - -/* user id */ -$uid = clean_request('uid'); -/* reference banque (numero de transaction) */ -$champ901 = clean_request('CHAMP901'); -/* cle d'acceptation */ -$champ905 = clean_request('CHAMP905'); -/* code retour */ -$champ906 = clean_request('CHAMP906'); -/* email renvoye par la banque */ -$champ104 = clean_request('CHAMP104'); -/* reference complete de la commande */ -$champ200 = clean_request('CHAMP200'); -/* montant de la transaction */ -$champ201 = clean_request('CHAMP201'); -/* devise */ -$champ202 = clean_request('CHAMP202'); -$montant = "$champ201 $champ202"; - -/* on extrait les informations sur l'utilisateur */ -$res = $globals->xdb->query(" - SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme') - FROM auth_user_md5 AS a -INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme') - WHERE a.user_id={?}", $uid); -if (!list($prenom,$nom,$promo,$forlife,$femme) = $res->fetchOneRow()) { - erreur("uid invalide"); -} - - -/* on extrait la reference de la commande */ -if (!ereg('-xorg-([0-9]+)$',$champ200,$matches)) { - erreur("référence de commande invalide"); -} - -echo ($ref = $matches[1]); -$res = $globals->xdb->query("SELECT mail,text,confirmation FROM paiement.paiements WHERE id={?}", $ref); -if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) { - erreur("référence de commande inconnue"); -} - -/* on extrait le code de retour */ -if ($champ906 != "0000") { - $res = $globals->xdb->query("SELECT rcb.text,c.id,c.text - FROM paiement.codeRCB AS rcb - LEFT JOIN paiement.codeC AS c ON rcb.codeC=c.id - WHERE rcb.id='$champ906'"); - if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) { - erreur("erreur lors du paiement : $c_text ($c_id)"); - } else{ - erreur("erreur inconnue lors du paiement"); - } -} - -/* on fait l'insertion en base de donnees */ -$globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle) - VALUES ({?},{?},{?},{?},{?},{?})", - $champ901, $uid, $ref, $champ200, $montant, $champ905); - -/* on genere le mail de confirmation */ -$conf_text = str_replace("",$prenom,$conf_text); -$conf_text = str_replace("",$nom,$conf_text); -$conf_text = str_replace("",$promo,$conf_text); -$conf_text = str_replace("",$montant,$conf_text); -$conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); -$conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); - -$mymail = new HermesMailer(); -$mymail->setFrom($conf_mail); -$mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); -$mymail->addCc($conf_mail); -$mymail->setSubject($conf_title); -$mymail->setTxtBody($conf_text); -$mymail->send(); - -/* on envoie les details de la transaction à telepaiement@ */ -$mymail = new HermesMailer(); -$mymail->setFrom("webmaster@polytechnique.org"); -$mymail->addTo("telepaiement@polytechnique.org"); -$mymail->setSubject($conf_title); -$msg = "utilisateur : $prenom $nom ($uid)\n". - "mail : $forlife@polytechnique.org\n\n". - "paiement : $conf_title ($conf_mail)\n". - "reference : $champ200\n". - "montant : $montant\n\n". - "dump de REQUEST:\n". - var_export($_REQUEST,true); -$mymail->setTxtBody($msg); -$mymail->send(); - -?> diff --git a/htdocs/paiement/index.php b/htdocs/paiement/index.php deleted file mode 100644 index afe8561..0000000 --- a/htdocs/paiement/index.php +++ /dev/null @@ -1,61 +0,0 @@ -assign('xorg_title','Polytechnique.org - Télépaiements'); -require_once('profil.func.inc.php'); -require_once('money.inc.php'); - -// initialisation -$op = Env::get('op', 'select'); -$meth = new PayMethod(Env::getInt('methode', -1)); -$pay = new Payment(Env::getInt('ref', -1)); - -if($pay->flags->hasflag('old')){ - $page->trig("La transaction selectionnée est périmée."); - $pay = new Payment(); -} -$val = (Env::has('montant') && Env::get('montant')!=0) ? Env::get('montant') : $pay->montant_def; - -if (($e = $pay->check($val)) !== true) { - $page->trig($e); -} - -if ($op=='submit') { - $pay->init($val, $meth); - $pay->prepareform($pay); -} else { - $res = $globals->xdb->iterator("SELECT timestamp, montant FROM paiement.transactions WHERE uid = {?} AND ref = {?} ORDER BY timestamp DESC", Session::getInt('uid', -1), Env::getInt('ref', -1)); - - if ($res->total()) $page->assign('transactions', $res); -} - -$val = floor($val).".".substr(floor(($val - floor($val))*100+100),1); -$page->assign('montant',$val); - -$page->assign('meth', $meth); -$page->assign('pay', $pay); -$page->assign('evtlink', $pay->event()); - -$page->assign('prefix',$globals->money->mpay_tprefix); -$page->run(); -?> diff --git a/htdocs/paiement/paypal_retour.php b/htdocs/paiement/paypal_retour.php deleted file mode 100644 index 5639d61..0000000 --- a/htdocs/paiement/paypal_retour.php +++ /dev/null @@ -1,129 +0,0 @@ -addTo("telepaiement@polytechnique.org"); - $mymail->setFrom("webmaster@polytechnique.org"); - $mymail->setSubject("erreur lors d'un télépaiement (PayPal)"); - $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); - $mymail->send(); - - $page->trig($text); -} - -/* user id */ -$uid = clean_request('uid'); -/* reference banque (numero de transaction) */ -$no_transaction = clean_request('tx'); -/* token a renvoyer pour avoir plus d'information */ -$clef = clean_request('sig'); -/* code retour */ -$status = clean_request('st'); -/* raison */ -$reason = ($status == 'Pending')?clean_request('pending_reason'):clean_request('reason_code'); -/* reference complete de la commande */ -$fullref = clean_request('cm'); -/* montant de la transaction */ -$montant_nb = clean_request('amt'); -/* devise */ -$montant_dev = clean_request('cc'); -$montant = "$montant_nb $montant_dev"; - -/* on extrait le code de retour */ -if ($status != "Completed") { - if ($status) - erreur("erreur lors du paiement : $status - $reason"); - else - erreur("Paiement annulé", false); -} - -/* on extrait les informations sur l'utilisateur */ -$res = $globals->xdb->query(" - SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme') - FROM auth_user_md5 AS a -INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme') - WHERE a.user_id={?}", $uid); -if (!list($prenom,$nom,$promo,$forlife,$femme) = $res->fetchOneRow()) { - erreur("uid invalide"); -} - -/* on extrait la reference de la commande */ -if (!ereg('-xorg-([0-9]+)$',$fullref,$matches)) { - erreur("référence de commande invalide"); -} - -$ref = $matches[1]; -$res = $globals->xdb->query("SELECT mail,text,confirmation FROM paiement.paiements WHERE id={?}", $ref); -if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) { - erreur("référence de commande inconnue"); -} - -/* on fait l'insertion en base de donnees */ -$globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle) - VALUES ({?},{?},{?},{?},{?},{?})", - $no_transaction, $uid, $ref, $fullref, $montant, $clef); - -/* on genere le mail de confirmation */ -$conf_text = str_replace("",$prenom,$conf_text); -$conf_text = str_replace("",$nom,$conf_text); -$conf_text = str_replace("",$promo,$conf_text); -$conf_text = str_replace("",$montant,$conf_text); -$conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); -$conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); - -$mymail = new HermesMailer(); -$mymail->setFrom($conf_mail); -$mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); -$mymail->addCc($conf_mail); -$mymail->setSubject($conf_title); -$mymail->setTxtBody($conf_text); -$mymail->send(); - -/* on envoie les details de la transaction à telepaiement@ */ -$mymail = new HermesMailer(); -$mymail->setFrom("webmaster@polytechnique.org"); -$mymail->addTo("telepaiement@polytechnique.org"); -$mymail->setSubject($conf_title); -$msg = "utilisateur : $prenom $nom ($uid)\n". - "mail : $forlife@polytechnique.org\n\n". - "paiement : $conf_title ($conf_mail)\n". - "reference : $no_transaction\n". - "montant : $montant\n\n". - "dump de REQUEST:\n". - var_export($_REQUEST,true); -$mymail->setTxtBody($msg); -$mymail->send(); - -$page->assign('texte', $conf_text); -$page->assign('erreur', $erreur); -$page->run(); -?> diff --git a/include/money/cyberpaiement.inc.php b/include/money/cyberpaiement.inc.php index cb54f28..4e20288 100644 --- a/include/money/cyberpaiement.inc.php +++ b/include/money/cyberpaiement.inc.php @@ -48,9 +48,7 @@ class CyberPayment global $globals; $roboturl = str_replace("https://","http://",$globals->baseurl) - ."/paiement/cyberpaiement_retour.php?uid=" - .Session::getInt('uid') - ."&CHAMPBPX"; + ."/payment/cyber_return/".Session::getInt('uid')."?CHAMPBPX"; if (Cookie::has(session_name())) { $returnurl .= "?".SID; } diff --git a/include/money/paypal.inc.php b/include/money/paypal.inc.php index ecd669f..d3e2ddf 100644 --- a/include/money/paypal.inc.php +++ b/include/money/paypal.inc.php @@ -56,8 +56,7 @@ class PayPal $name = $req->fetchOneCell(); $roboturl = str_replace("https://","http://",$globals->baseurl) - ."/paiement/paypal_retour.php?uid=" - .Session::getInt('uid'); + ."/payment/paypal_return/".Session::getInt('uid'); $this->infos = Array(); diff --git a/modules/payment.php b/modules/payment.php new file mode 100644 index 0000000..02933d1 --- /dev/null +++ b/modules/payment.php @@ -0,0 +1,325 @@ +addTo("telepaiement@polytechnique.org"); + $mymail->setFrom("webmaster@polytechnique.org"); + $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)"); + $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); + $mymail->send(); + exit; +} + +/* sort en affichant une erreur */ +function paypal_erreur($text, $send=true) { + global $page, $erreur; + if ($erreur) return; + $erreur = $text; + if (!$send) return; + + $mymail = new HermesMailer(); + $mymail->addTo("telepaiement@polytechnique.org"); + $mymail->setFrom("webmaster@polytechnique.org"); + $mymail->setSubject("erreur lors d'un télépaiement (PayPal)"); + $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); + $mymail->send(); + + $page->trig($text); +} + +/* http://fr.wikipedia.org/wiki/Formule_de_Luhn */ +function luhn($nombre) { + $s = strrev($nombre); + $sum = 0; + for ($i = 0; $i < strlen($s); $i++) { + $dgt = $s{$i}; + $sum += ($i % 2) ? (2*$dgt) % 9 : $dgt; + } + return $sum % 10; +} + +/* calcule la clé d'acceptation a partir de 5 champs */ +function cle_accept($d1,$d2,$d3,$d4,$d5) +{ + $m1 = luhn($d1.$d5); + $m2 = luhn($d2.$d5); + $m3 = luhn($d3.$d5); + $m4 = luhn($d4.$d5); + $n = $m1 + $m2 + $m3 + $m4; + $alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + return $alpha{$n-1}.$m1.$m2.$m3.$m4; +} + + +class PaymentModule extends PLModule +{ + function handlers() + { + return array( + 'payment' => $this->make_hook('payment', AUTH_MDP), + 'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUB), + 'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUB), + ); + } + + function handler_payment(&$page, $ref = -1) + { + global $globals; + + require_once 'profil.func.inc.php' ; + require_once 'money.inc.php' ; + + $page->changeTpl('payment/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Télépaiements'); + + // initialisation + $op = Env::get('op', 'select'); + $meth = new PayMethod(Env::getInt('methode', -1)); + $pay = new Payment($ref); + + if($pay->flags->hasflag('old')){ + $page->trig("La transaction selectionnée est périmée."); + $pay = new Payment(); + } + $val = Env::get('montant') != 0 ? Env::get('montant') : $pay->montant_def; + + if (($e = $pay->check($val)) !== true) { + $page->trig($e); + } + + if ($op=='submit') { + $pay->init($val, $meth); + $pay->prepareform($pay); + } else { + $res = $globals->xdb->iterator("SELECT timestamp, montant + FROM paiement.transactions + WHERE uid = {?} AND ref = {?} + ORDER BY timestamp DESC", + Session::getInt('uid', -1), $ref); + + if ($res->total()) $page->assign('transactions', $res); + } + + $val = floor($val).".".substr(floor(($val - floor($val))*100+100),1); + $page->assign('montant',$val); + + $page->assign('meth', $meth); + $page->assign('pay', $pay); + $page->assign('evtlink', $pay->event()); + + $page->assign('prefix',$globals->money->mpay_tprefix); + + return PL_OK; + } + + function handler_cyber_return(&$page, $uid = null) + { + require_once 'diogenes/diogenes.hermes.inc.php'; + + /* reference banque (numero de transaction) */ + $champ901 = clean_request('CHAMP901'); + /* cle d'acceptation */ + $champ905 = clean_request('CHAMP905'); + /* code retour */ + $champ906 = clean_request('CHAMP906'); + /* email renvoye par la banque */ + $champ104 = clean_request('CHAMP104'); + /* reference complete de la commande */ + $champ200 = clean_request('CHAMP200'); + /* montant de la transaction */ + $champ201 = clean_request('CHAMP201'); + /* devise */ + $champ202 = clean_request('CHAMP202'); + $montant = "$champ201 $champ202"; + + /* on extrait les informations sur l'utilisateur */ + $res = $globals->xdb->query(" + SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme') + FROM auth_user_md5 AS a + INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme') + WHERE a.user_id={?}", $uid); + if (!list($prenom,$nom,$promo,$forlife,$femme) = $res->fetchOneRow()) { + cb_erreur("uid invalide"); + } + + + /* on extrait la reference de la commande */ + if (!ereg('-xorg-([0-9]+)$',$champ200,$matches)) { + cb_erreur("référence de commande invalide"); + } + + echo ($ref = $matches[1]); + $res = $globals->xdb->query("SELECT mail,text,confirmation + FROM paiement.paiements WHERE id={?}", $ref); + if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) { + cb_erreur("référence de commande inconnue"); + } + + /* on extrait le code de retour */ + if ($champ906 != "0000") { + $res = $globals->xdb->query("SELECT rcb.text,c.id,c.text + FROM paiement.codeRCB AS rcb + LEFT JOIN paiement.codeC AS c ON rcb.codeC=c.id + WHERE rcb.id='$champ906'"); + if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) { + cb_erreur("erreur lors du paiement : $c_text ($c_id)"); + } else{ + cb_erreur("erreur inconnue lors du paiement"); + } + } + + /* on fait l'insertion en base de donnees */ + $globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle) + VALUES ({?},{?},{?},{?},{?},{?})", + $champ901, $uid, $ref, $champ200, $montant, $champ905); + + /* on genere le mail de confirmation */ + $conf_text = str_replace("",$prenom,$conf_text); + $conf_text = str_replace("",$nom,$conf_text); + $conf_text = str_replace("",$promo,$conf_text); + $conf_text = str_replace("",$montant,$conf_text); + $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); + $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); + + $mymail = new HermesMailer(); + $mymail->setFrom($conf_mail); + $mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); + $mymail->addCc($conf_mail); + $mymail->setSubject($conf_title); + $mymail->setTxtBody($conf_text); + $mymail->send(); + + /* on envoie les details de la transaction à telepaiement@ */ + $mymail = new HermesMailer(); + $mymail->setFrom("webmaster@polytechnique.org"); + $mymail->addTo("telepaiement@polytechnique.org"); + $mymail->setSubject($conf_title); + $msg = "utilisateur : $prenom $nom ($uid)\n". + "mail : $forlife@polytechnique.org\n\n". + "paiement : $conf_title ($conf_mail)\n". + "reference : $champ200\n". + "montant : $montant\n\n". + "dump de REQUEST:\n". + var_export($_REQUEST,true); + $mymail->setTxtBody($msg); + $mymail->send(); + exit; + } + + function handler_paypal_return(&$page, $uid = null) + { + global $globals; + + $page->changeTpl('payment/retour_paypal.tpl'); + require_once 'diogenes/diogenes.hermes.inc.php'; + + /* reference banque (numero de transaction) */ + $no_transaction = clean_request('tx'); + /* token a renvoyer pour avoir plus d'information */ + $clef = clean_request('sig'); + /* code retour */ + $status = clean_request('st'); + /* raison */ + $reason = ($status == 'Pending')?clean_request('pending_reason'):clean_request('reason_code'); + /* reference complete de la commande */ + $fullref = clean_request('cm'); + /* montant de la transaction */ + $montant_nb = clean_request('amt'); + /* devise */ + $montant_dev = clean_request('cc'); + $montant = "$montant_nb $montant_dev"; + + /* on extrait le code de retour */ + if ($status != "Completed") { + if ($status) + paypal_erreur("erreur lors du paiement : $status - $reason"); + else + paypal_erreur("Paiement annulé", false); + } + + /* on extrait les informations sur l'utilisateur */ + $res = $globals->xdb->query(" + SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme') + FROM auth_user_md5 AS a + INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme') + WHERE a.user_id={?}", $uid); + if (!list($prenom,$nom,$promo,$forlife,$femme) = $res->fetchOneRow()) { + paypal_erreur("uid invalide"); + } + + /* on extrait la reference de la commande */ + if (!ereg('-xorg-([0-9]+)$',$fullref,$matches)) { + paypal_erreur("référence de commande invalide"); + } + + $ref = $matches[1]; + $res = $globals->xdb->query("SELECT mail,text,confirmation + FROM paiement.paiements WHERE id={?}", $ref); + if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) { + paypal_erreur("référence de commande inconnue"); + } + + /* on fait l'insertion en base de donnees */ + $globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle) + VALUES ({?},{?},{?},{?},{?},{?})", + $no_transaction, $uid, $ref, $fullref, $montant, $clef); + + /* on genere le mail de confirmation */ + $conf_text = str_replace("",$prenom,$conf_text); + $conf_text = str_replace("",$nom,$conf_text); + $conf_text = str_replace("",$promo,$conf_text); + $conf_text = str_replace("",$montant,$conf_text); + $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); + $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); + + $mymail = new HermesMailer(); + $mymail->setFrom($conf_mail); + $mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); + $mymail->addCc($conf_mail); + $mymail->setSubject($conf_title); + $mymail->setTxtBody($conf_text); + $mymail->send(); + + /* on envoie les details de la transaction à telepaiement@ */ + $mymail = new HermesMailer(); + $mymail->setFrom("webmaster@polytechnique.org"); + $mymail->addTo("telepaiement@polytechnique.org"); + $mymail->setSubject($conf_title); + $msg = "utilisateur : $prenom $nom ($uid)\n". + "mail : $forlife@polytechnique.org\n\n". + "paiement : $conf_title ($conf_mail)\n". + "reference : $no_transaction\n". + "montant : $montant\n\n". + "dump de REQUEST:\n". + var_export($_REQUEST,true); + $mymail->setTxtBody($msg); + $mymail->send(); + + $page->assign('texte', $conf_text); + $page->assign('erreur', $erreur); + + return PL_OK; + } +} + +?> diff --git a/modules/platal.php b/modules/platal.php index 46cbb49..182e4a9 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -63,6 +63,8 @@ class PlatalModule extends PLModule } $page->assign('prefs', $globals->hook->prefs()); + + return PL_OK; } } diff --git a/templates/paiement/index.tpl b/templates/payment/index.tpl similarity index 92% rename from templates/paiement/index.tpl rename to templates/payment/index.tpl index efee2a3..afc991c 100644 --- a/templates/paiement/index.tpl +++ b/templates/payment/index.tpl @@ -83,7 +83,19 @@ Si tu n'es pas encore inscrit {else} -
+ + +

Si tu ne souhaites pas utiliser notre interface de télépaiement, tu peux virer directement la somme de ton choix sur notre compte 30004 00314 00010016782 60. Nous veillerons à ce que ton paiement parvienne à @@ -98,7 +110,7 @@ Si tu n'es pas encore inscrit Transaction - {select_db_table table="`$prefix`paiements" valeur=$pay->id where=" WHERE FIND_IN_SET('old',flags)=0"} {if $pay->url} @@ -111,7 +123,7 @@ Si tu n'es pas encore inscrit Méthode diff --git a/templates/paiement/retour_paypal.tpl b/templates/payment/retour_paypal.tpl similarity index 96% rename from templates/paiement/retour_paypal.tpl rename to templates/payment/retour_paypal.tpl index 89cc21c..1c54137 100644 --- a/templates/paiement/retour_paypal.tpl +++ b/templates/payment/retour_paypal.tpl @@ -32,5 +32,5 @@ r

{$texte|nl2br}

{/if} -

[retour aux Télépaiements]

+

[retour aux Télépaiements]

{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnet/groupe/evenements.tpl b/templates/xnet/groupe/evenements.tpl index 013a6f8..5ae5477 100644 --- a/templates/xnet/groupe/evenements.tpl +++ b/templates/xnet/groupe/evenements.tpl @@ -143,7 +143,7 @@ Ev $e.paid}class="erreur"{/if}> Tu dois payer {$montant|replace:'.':','} €{if $e.paid > 0}, et tu as déjà payé {$e.paid|replace:'.':','} €{/if}. {if $e.paiement_id && $montant > $e.paid} - [Payer en ligne] + [Payer en ligne] {/if} diff --git a/templates/xnet/groupe/telepaiement.tpl b/templates/xnet/groupe/telepaiement.tpl index a41ebc4..9b2740c 100644 --- a/templates/xnet/groupe/telepaiement.tpl +++ b/templates/xnet/groupe/telepaiement.tpl @@ -30,7 +30,7 @@ Voici la liste des paiements en ligne possible pour le groupe {$asso.nom}

-{$p.text} +{$p.text}

{if $trans[$p.id]} -- 2.1.4