From eadbfc7b9902404f6be185bac82d0899d580c98d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Jan 2009 21:49:43 +0000 Subject: [PATCH] First add for paybox module --- htdocs/paybox/paybox.lib.php | 135 +++++++++++++++++++++++++++++++++++ htdocs/paypal/paypal.lib.php | 135 +++++++++++++++++++++++++++++++++++ 2 files changed, 270 insertions(+) create mode 100644 htdocs/paybox/paybox.lib.php create mode 100644 htdocs/paypal/paypal.lib.php diff --git a/htdocs/paybox/paybox.lib.php b/htdocs/paybox/paybox.lib.php new file mode 100644 index 00000000000..a0467af28c4 --- /dev/null +++ b/htdocs/paybox/paybox.lib.php @@ -0,0 +1,135 @@ + + * Copyright (C) 2005-2007 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/paybox/paybox.lib.php + * \brief Library for common paybox functions + * \version $Id$ + */ + + +/** + * \brief Create a redirect form to paybox form + * \return int 1 if OK, -1 if ERROR + */ +function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko="",$ID=0) +{ + global $conf, $langs, $db; + + dol_syslog("Paypal.lib::print_paybox_redirect", LOG_DEBUG); + + + $IBS_DEVISE="978"; # Euro + + $ModulePaybox="module_linux.cgi"; + if ($_SERVER["WINDIR"] && eregi("windows",$_SERVER["WINDIR"])) { $ModulePaybox="module_NT_2000.cgi"; } + $URLPAYBOX=URL_ROOT.'/cgi-bin/'.$ModulePaybox; + if ($conf->global->PAYBOX_CGI_URL) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL; + $IBS_SITE=$conf->global->PAYBOX_IBS_SITE; + $IBS_RANG=$conf->global->PAYBOX_IBS_RANG; + + if (empty($URLPAYBOX)) + { + dol_print_error('',"Paybox setup param PAYBOX_CGI_URL not defined"); + return -1; + } + if (empty($IBS_SITE)) + { + dol_print_error('',"Paybox setup param PAYBOX_IBS_SITE not defined"); + return -1; + } + if (empty($IBS_RANG)) + { + dol_print_error('',"Paybox setup param PAYBOX_IBS_RANG not defined"); + return -1; + } + + // Value to use for test + $IBS_SITE="1999888"; # Site test + $IBS_RANG="99"; # Rang test + + + dol_syslog("Paypal.lib::print_paybox_redirect PRICE: ".$PRICE, LOG_DEBUG); + + // Definition des parametres vente produit pour paybox + $IBS_CMD="DOL:SITE=dolibarr-ID=".$ID; + $IBS_TOTAL=$PRICE*100; # En centimes + + $IBS_MODE=1; # Mode formulaire + + $IBS_PORTEUR=$EMAIL; + $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des paramètres du get de validation en reponse (url a definir sous paybox) + $IBS_TXT="
Vous allez être envoyé vers la page de paiement sécurisé Paybox
Merci de patienter quelques secondes...
"; + $IBS_EFFECTUE=$urlok; + $IBS_ANNULE=$urlko; + $IBS_REFUSE=$urlko; + $IBS_BOUTPI="Continuer"; + $IBS_BKGD="#FFFFFF"; + $IBS_WAIT="4000"; + $IBS_LANG="FRA"; + + dol_syslog("Soumission Paybox"); + dol_syslog("IBS_MODE: $IBS_MODE"); + dol_syslog("IBS_SITE: $IBS_SITE"); + dol_syslog("IBS_RANG: $IBS_RANG"); + dol_syslog("IBS_TOTAL: $IBS_TOTAL"); + dol_syslog("IBS_DEVISE: $IBS_DEVISE"); + dol_syslog("IBS_CMD: $IBS_CMD"); + dol_syslog("IBS_PORTEUR: $IBS_PORTEUR"); + dol_syslog("IBS_RETOUR: $IBS_RETOUR"); + dol_syslog("IBS_EFFECTUE: $IBS_EFFECTUE"); + dol_syslog("IBS_ANNULE: $IBS_ANNULE"); + dol_syslog("IBS_REFUSE: $IBS_REFUSE"); + dol_syslog("IBS_BKGD: $IBS_BKGD"); + dol_syslog("IBS_WAIT: $IBS_WAIT"); + dol_syslog("IBS_LANG: $IBS_LANG"); + + print ''; + print "\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print "\n"; + print ''; + print "\n"; + print ''; + print "\n"; + + return; +} + + +?> \ No newline at end of file diff --git a/htdocs/paypal/paypal.lib.php b/htdocs/paypal/paypal.lib.php new file mode 100644 index 00000000000..3f4c3772532 --- /dev/null +++ b/htdocs/paypal/paypal.lib.php @@ -0,0 +1,135 @@ + + * Copyright (C) 2005-2007 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/lib/admin.lib.php + * \brief Library of admin functions + * \version $Id$ + */ + + +/** + * \brief Create a redirect form to paybox form + * \return int 1 if OK, -1 if ERROR + */ +function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko="",$ID=0) +{ + global $conf, $langs, $db; + + dol_syslog("Paypal.lib::print_paybox_redirect", LOG_DEBUG); + + + $IBS_DEVISE="978"; # Euro + + $ModulePaybox="module_linux.cgi"; + if ($_SERVER["WINDIR"] && eregi("windows",$_SERVER["WINDIR"])) { $ModulePaybox="module_NT_2000.cgi"; } + $URLPAYBOX=URL_ROOT.'/cgi-bin/'.$ModulePaybox; + if ($conf->global->PAYBOX_CGI_URL) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL; + $IBS_SITE=$conf->global->PAYBOX_IBS_SITE; + $IBS_RANG=$conf->global->PAYBOX_IBS_RANG; + + if (empty($URLPAYBOX)) + { + dol_print_error('',"Paybox setup param PAYBOX_CGI_URL not defined"); + return -1; + } + if (empty($IBS_SITE)) + { + dol_print_error('',"Paybox setup param PAYBOX_IBS_SITE not defined"); + return -1; + } + if (empty($IBS_RANG)) + { + dol_print_error('',"Paybox setup param PAYBOX_IBS_RANG not defined"); + return -1; + } + + // Value to use for test + $IBS_SITE="1999888"; # Site test + $IBS_RANG="99"; # Rang test + + + dol_syslog("Paypal.lib::print_paybox_redirect PRICE: ".$PRICE, LOG_DEBUG); + + // Definition des parametres vente produit pour paybox + $IBS_CMD="DOL:SITE=dolibarr-ID=".$ID; + $IBS_TOTAL=$PRICE*100; # En centimes + + $IBS_MODE=1; # Mode formulaire + + $IBS_PORTEUR=$EMAIL; + $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des paramètres du get de validation en reponse (url a definir sous paybox) + $IBS_TXT="
Vous allez être envoyé vers la page de paiement sécurisé Paybox
Merci de patienter quelques secondes...
"; + $IBS_EFFECTUE=$urlok; + $IBS_ANNULE=$urlko; + $IBS_REFUSE=$urlko; + $IBS_BOUTPI="Continuer"; + $IBS_BKGD="#FFFFFF"; + $IBS_WAIT="4000"; + $IBS_LANG="FRA"; + + dol_syslog("Soumission Paybox"); + dol_syslog("IBS_MODE: $IBS_MODE"); + dol_syslog("IBS_SITE: $IBS_SITE"); + dol_syslog("IBS_RANG: $IBS_RANG"); + dol_syslog("IBS_TOTAL: $IBS_TOTAL"); + dol_syslog("IBS_DEVISE: $IBS_DEVISE"); + dol_syslog("IBS_CMD: $IBS_CMD"); + dol_syslog("IBS_PORTEUR: $IBS_PORTEUR"); + dol_syslog("IBS_RETOUR: $IBS_RETOUR"); + dol_syslog("IBS_EFFECTUE: $IBS_EFFECTUE"); + dol_syslog("IBS_ANNULE: $IBS_ANNULE"); + dol_syslog("IBS_REFUSE: $IBS_REFUSE"); + dol_syslog("IBS_BKGD: $IBS_BKGD"); + dol_syslog("IBS_WAIT: $IBS_WAIT"); + dol_syslog("IBS_LANG: $IBS_LANG"); + + print ''; + print "\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print "\n"; + print ''; + print "\n"; + print ''; + print "\n"; + + return; +} + + +?> \ No newline at end of file