ffe502c5e9fe1f93705219d2f2a980c8799e7a26
2 /***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
29 var $nomsite = "la BP Lorraine Champagne";
35 function CyberPayment($val)
37 $this->val
= strtr(sprintf("%.02f", (float)$val), '.', ',');
41 // {{{ function form()
43 function prepareform(&$pay)
45 // toute la doc se trouve sur
46 // http://www.cyberpaiement.tm.fr/donnees.htm
50 $roboturl = str_replace("https://","http://",$globals->baseurl
)
51 ."/paiement/cyberpaiement_retour.php?uid="
52 .Session
::getInt('uid')
54 if (Cookie
::has(session_name())) {
55 $returnurl .= "?".SID
;
57 $req = $globals->xdb
->query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",Session
::get('uid'));
58 $name = $req->fetchOneCell();
60 // on constuit la reference de la transaction
61 $prefix = ($pay->flags
->hasflag('unique')) ?
str_pad("",15,"0") : rand_url_id();
62 $fullref = substr("$prefix-xorg-{$pay->id}",-15);
64 $this->urlform
= "https://ecom.cimetz.com/telepaie/cgishell.exe/epaie01.exe";
65 $this->infos
['commercant'] = Array(
68 'CHAMP002' => 5429159012,
70 'CHAMP004' => "Polytechnique.org",
71 'CHAMP005' => $roboturl,
72 'CHAMP006' => "Polytechnique.org",
73 'CHAMP007' => $globals->baseurl
,
74 'CHAMP008' => $pay->mail
);
75 $this->infos
['client'] = Array(
77 'CHAMP101' => Session
::get('prenom'),
80 'CHAMP104' => Session
::get('bestalias').'@polytechnique.org',
86 $this->infos
['commande'] = Array(
87 'CHAMP200' => $fullref,
88 'CHAMP201' => $this->val
,
90 $this->infos
['divers'] = Array('CHAMP900' => '01');
96 $api = 'CyberPayment';