63634c5cec0fc4e3983f1720882f34e8d5158092
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 ***************************************************************************/
28 var $nomsite = "PayPal";
38 $this->val_number
= $val;
42 // {{{ function form()
44 function prepareform(&$pay)
47 // https://www.paypal.com/fr_FR/pdf/integration_guide.pdf
48 // attention : le renvoi automatique ne fonctionne que si
49 // on oblige les gens à créer un compte paypal
50 // nous ne l'utilisons pas ; il faut donc que l'utilisateur
51 // revienne sur le site
54 $this->urlform
= 'https://'.$globals->money
->paypal_site
.'/cgi-bin/webscr';
56 $roboturl = str_replace("https://","http://",$globals->baseurl
)
57 ."/paiement/paypal_retour.php?uid="
58 .Session
::getInt('uid');
60 $this->infos
= Array();
62 $this->infos
['commercant'] = Array(
63 'business' => $globals->money
->paypal_compte
,
65 'return' => $roboturl,
66 'cn' => 'Commentaires',
68 'cbt' => 'Revenir sur polytechnique.org');
71 'first_name' => Session
::get('prenom'),
72 'last_name' => Session
::get('nom'),
73 'email' => Session
::get('bestalias').'@polytechnique.org');
75 $res = $globals->xdb
->query(
76 "SELECT a.adr1 AS address1, a.adr2 AS address2,
77 a.city, a.postcode AS zip, a.country,
78 IF(a.tel, a.tel, q.profile_mobile) AS night_phone_b
79 FROM auth_user_quick AS q
80 LEFT JOIN adresses AS a ON (q.user_id = a.uid)
81 WHERE q.user_id = {?} AND FIND_IN_SET('active', a.statut)
82 LIMIT 1", Session
::getInt('uid'));
83 $this->infos
['client']=array_merge($info_client, $res->fetchOneAssoc());
85 // on constuit la reference de la transaction
86 $prefix = ($pay->flags
->hasflag('unique')) ?
str_pad("",15,"0") : rand_url_id();
87 $fullref = substr("$prefix-xorg-{$pay->id}",-15);
89 $this->infos
['commande'] = Array(
90 'item_name' => $pay->text
,
91 'amount' => $this->val_number
,
92 'currency_code' => 'EUR',
93 'custom' => $fullref);
95 $this->infos
['divers'] = Array('cmd' => '_xclick');