| 1 | <?php |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2003-2011 Polytechnique.org * |
| 4 | * http://opensource.polytechnique.org/ * |
| 5 | * * |
| 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. * |
| 10 | * * |
| 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. * |
| 15 | * * |
| 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 * |
| 18 | * Foundation, Inc., * |
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | class CyberPayment |
| 23 | { |
| 24 | // {{{ properties |
| 25 | |
| 26 | var $val; |
| 27 | |
| 28 | var $urlform; |
| 29 | var $nomsite = "la BP Lorraine Champagne"; |
| 30 | var $infos; |
| 31 | |
| 32 | // }}} |
| 33 | // {{{ constructor |
| 34 | |
| 35 | function CyberPayment($val) |
| 36 | { |
| 37 | $this->val = strtr(sprintf("%.02f", (float)$val), '.', ','); |
| 38 | } |
| 39 | |
| 40 | // }}} |
| 41 | // {{{ function form() |
| 42 | |
| 43 | function prepareform(&$pay) |
| 44 | { |
| 45 | // toute la doc se trouve sur |
| 46 | // http://www.cyberpaiement.tm.fr/donnees.htm |
| 47 | |
| 48 | global $globals, $platal; |
| 49 | |
| 50 | $roboturl = str_replace("https://","http://", $globals->baseurl) |
| 51 | . '/' . $platal->ns . "payment/cyber_return/".S::v('uid')."?comment=".urlencode(Env::v('comment'))."&CHAMPBPX"; |
| 52 | $user = S::user(); |
| 53 | $name = $user->lastName(); |
| 54 | |
| 55 | // on constuit la reference de la transaction |
| 56 | $prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id(); |
| 57 | $fullref = substr("$prefix-xorg-{$pay->id}",-15); |
| 58 | |
| 59 | $this->urlform = "https://ecom.cimetz.com/telepaie/cgishell.exe/epaie01.exe"; |
| 60 | $this->infos['commercant'] = Array( |
| 61 | 'CHAMP000' => 510879, |
| 62 | 'CHAMP001' => 5965, |
| 63 | 'CHAMP002' => 5429159012, |
| 64 | 'CHAMP003' => "I", |
| 65 | 'CHAMP004' => "Polytechnique.org", |
| 66 | 'CHAMP005' => $roboturl, |
| 67 | 'CHAMP006' => "Polytechnique.org", |
| 68 | 'CHAMP007' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns, |
| 69 | 'CHAMP008' => $pay->mail); |
| 70 | $this->infos['client'] = Array( |
| 71 | 'CHAMP100' => replace_accent($name), |
| 72 | 'CHAMP101' => replace_accent(S::v('prenom')), |
| 73 | 'CHAMP102' => '.', |
| 74 | 'CHAMP103' => '.', |
| 75 | 'CHAMP104' => S::user()->bestEmail(), |
| 76 | 'CHAMP106' => '.', |
| 77 | 'CHAMP107' => '.', |
| 78 | 'CHAMP108' => '.', |
| 79 | 'CHAMP109' => '.', |
| 80 | 'CHAMP110' => '.'); |
| 81 | $this->infos['commande'] = Array( |
| 82 | 'CHAMP200' => $fullref, |
| 83 | 'CHAMP201' => $this->val, |
| 84 | 'CHAMP202' => "EUR"); |
| 85 | $this->infos['divers'] = Array('CHAMP900' => '01'); |
| 86 | } |
| 87 | |
| 88 | // }}} |
| 89 | } |
| 90 | |
| 91 | $api = 'CyberPayment'; |
| 92 | |
| 93 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
| 94 | ?> |