X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment%2Fmoney%2Fpaypal.inc.php;h=fb7fab493d4326545d25d5e323276c1d8ecf856e;hb=eaf30d86cc99df2414cf4f171a9b0f11b0561e3b;hp=910c01634f51eb89526b4dfdd35c720ac150821a;hpb=50bda57a9e381552715b048397e0729cb23b27e9;p=platal.git diff --git a/modules/payment/money/paypal.inc.php b/modules/payment/money/paypal.inc.php index 910c016..fb7fab4 100644 --- a/modules/payment/money/paypal.inc.php +++ b/modules/payment/money/paypal.inc.php @@ -1,6 +1,6 @@ val_number = $val; @@ -44,58 +44,62 @@ class PayPal function prepareform(&$pay) { // toute la doc sur : - // https://www.paypal.com/fr_FR/pdf/integration_guide.pdf - // attention : le renvoi automatique ne fonctionne que si - // on oblige les gens à créer un compte paypal - // nous ne l'utilisons pas ; il faut donc que l'utilisateur - // revienne sur le site - global $globals; + // https://www.paypal.com/fr_FR/pdf/integration_guide.pdf + // attention : le renvoi automatique ne fonctionne que si + // on oblige les gens à créer un compte paypal + // nous ne l'utilisons pas ; il faut donc que l'utilisateur + // revienne sur le site + global $globals, $platal; - $this->urlform = 'https://'.$globals->money->paypal_site.'/cgi-bin/webscr'; - $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom FROM auth_user_md5 WHERE user_id = {?}",S::v('uid')); - $name = $req->fetchOneCell(); + $this->urlform = 'https://'.$globals->money->paypal_site.'/cgi-bin/webscr'; + $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom + FROM auth_user_md5 + WHERE user_id = {?}",S::v('uid')); + $name = $req->fetchOneCell(); $roboturl = str_replace("https://","http://",$globals->baseurl) - ."/payment/paypal_return/".S::v('uid'); + . '/' . $platal->ns . "payment/paypal_return/".S::v('uid')."?comment=".urlencode(Env::v('comment')); - $this->infos = Array(); + $this->infos = Array(); - $this->infos['commercant'] = Array( - 'business' => $globals->money->paypal_compte, - 'rm' => 2, - 'return' => $roboturl, - 'cn' => 'Commentaires', - 'no_shipping' => 1, - 'cbt' => 'Revenir sur polytechnique.org'); + $this->infos['commercant'] = Array( + 'business' => $globals->money->paypal_compte, + 'rm' => 2, + 'return' => $roboturl, + 'cn' => 'Commentaires', + 'no_shipping' => 1, + 'cbt' => empty($GLOBALS['IS_XNET_SITE']) ? + 'Revenir sur polytechnique.org' : + 'Revenir sur polytechnique.net'); - $info_client = Array( - 'first_name' => S::v('prenom'), - 'last_name' => $name, - 'email' => S::v('bestalias').'@polytechnique.org'); + $info_client = Array( + 'first_name' => S::v('prenom'), + 'last_name' => $name, + 'email' => S::v('bestalias').'@' . $globals->mail->domain); - $res = XDB::query( - "SELECT a.adr1 AS address1, a.adr2 AS address2, - a.city, a.postcode AS zip, a.country, - IF(t.tel, t.tel, q.profile_mobile) AS night_phone_b - FROM auth_user_quick AS q - LEFT JOIN adresses AS a ON (q.user_id = a.uid) - LEFT JOIN tels AS t ON (t.uid = a.uid AND t.adrid = a.adrid) - WHERE q.user_id = {?} AND FIND_IN_SET('active', a.statut) - LIMIT 1", S::v('uid')); - $this->infos['client']=array_merge($info_client, $res->fetchOneAssoc()); + $res = XDB::query( + "SELECT a.adr1 AS address1, a.adr2 AS address2, + a.city, a.postcode AS zip, a.country, + IF(t.tel, t.tel, q.profile_mobile) AS night_phone_b + FROM auth_user_quick AS q + LEFT JOIN adresses AS a ON (q.user_id = a.uid AND FIND_IN_SET('active', a.statut)) + LEFT JOIN tels AS t ON (t.uid = a.uid AND t.adrid = a.adrid) + WHERE q.user_id = {?} + LIMIT 1", S::v('uid')); + $this->infos['client'] = array_merge($info_client, $res->fetchOneAssoc()); // on constuit la reference de la transaction + require_once 'xorg.misc.inc.php'; $prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id(); $fullref = substr("$prefix-xorg-{$pay->id}",-15); - $this->infos['commande'] = Array( - 'item_name' => $pay->text, - 'amount' => $this->val_number, - 'currency_code' => 'EUR', - 'custom' => $fullref); - - $this->infos['divers'] = Array('cmd' => '_xclick'); + $this->infos['commande'] = Array( + 'item_name' => $pay->text, + 'amount' => $this->val_number, + 'currency_code' => 'EUR', + 'custom' => $fullref); + $this->infos['divers'] = Array('cmd' => '_xclick'); } // }}} @@ -103,4 +107,5 @@ class PayPal $api = 'PayPal'; +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>