Work on paypal module

This commit is contained in:
Laurent Destailleur 2010-10-03 18:16:14 +00:00
parent 660b85d584
commit aa34a9c6dc
12 changed files with 1139 additions and 12 deletions

View File

@ -21,4 +21,6 @@ ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment user
ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment user interface for a free amount
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL to offer a %s online payment user interface for a member subscription
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL (required only for free payment) to add your own payment comment tag.
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url <b>%s</b> to have payment created automatically when validated by paybox.
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url <b>%s</b> to have payment created automatically when validated by paybox.
YourPaymentHasBeenRecorded=This page confirms that your payment has been recorded. Thank you.
YourPaymentHasNotBeenRecorded=You payment has not been recorded and transaction has been canceled. Thank you.

View File

@ -22,4 +22,5 @@ ToOfferALinkForOnlinePaymentOnFreeAmount=URL offrant une interface de paiement e
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL offrant une interface de paiement en ligne %s sur la base d'une cotisation d'adhérent
YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url <b>&tag=<i>value</i></b> à n'importe quelles de ces URL (obligatoire pour le paiement libre uniquement) pour ajouter votre propre "code commentaire" du paiement.
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à <b>%s</b> pour avoir le paiement créé automatiquement si validé.
YourPaymentHasBeenRecorded=Cette page confirme que votre paiement a bien été enregistré. Merci.
YourPaymentHasNotBeenRecorded=Votre paiement n'a pas été enregitré et la transaction a été annulée. Merci.

View File

@ -231,7 +231,7 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
* @param $fromcompany
* @param $langs
*/
function html_print_footer($fromcompany,$langs)
function html_print_paybox_footer($fromcompany,$langs)
{
global $conf;

View File

@ -123,7 +123,7 @@ print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").'</span></td><td>';
print $form->selectyesno("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY);
print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=>'Integral','paypalonly'=>'Paypal only'),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY);
print '</td></tr>';
$var=!$var;

294
htdocs/paypal/lib/paypal.lib.php Executable file
View File

@ -0,0 +1,294 @@
<?php
/* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
*
* 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/paypal/paypal.lib.php
* \brief Library for common paypal functions
* \version $Id$
*/
function llxHeaderPaypal($title, $head = "")
{
global $user, $conf, $langs;
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>';
print "\n";
print "<html>\n";
print "<head>\n";
print '<meta name="robots" content="noindex,nofollow">'."\n";
print '<meta name="keywords" content="dolibarr,payment,online">'."\n";
print '<meta name="description" content="Welcome on Dolibarr online payment form">'."\n";
print "<title>".$title."</title>\n";
if ($head) print $head."\n";
if ($conf->global->PAYPAL_CSS_URL) print '<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
else
{
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$conf->css.'?lang='.$langs->defaultlang.'">'."\n";
print '<style type="text/css">';
print '.CTableRow1 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #e6E6eE; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
print '</style>';
}
print "</head>\n";
print '<body style="margin: 20px;">'."\n";
}
function llxFooterPaypal()
{
print "</body>\n";
print "</html>\n";
}
/**
* \brief Create a redirect form to paypal form
* \return int 1 if OK, -1 if ERROR
*/
function print_paypal_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
{
global $conf, $langs, $db;
dol_syslog("Paypal.lib::print_paybox_redirect", LOG_DEBUG);
// Clean parameters
$PBX_IDENTIFIANT="2"; # Identifiant pour v2 test
if ($conf->global->PAYBOX_PBX_IDENTIFIANT) $PBX_IDENTIFIANT=$conf->global->PAYBOX_PBX_IDENTIFIANT;
$IBS_SITE="1999888"; # Site test
if ($conf->global->PAYBOX_IBS_SITE) $IBS_SITE=$conf->global->PAYBOX_IBS_SITE;
$IBS_RANG="99"; # Rang test
if ($conf->global->PAYBOX_IBS_RANG) $IBS_RANG=$conf->global->PAYBOX_IBS_RANG;
$IBS_DEVISE="840"; # Currency (Dollar US by default)
if ($CURRENCY == 'EUR') $IBS_DEVISE="978";
if ($CURRENCY == 'USD') $IBS_DEVISE="840";
$URLPAYBOX="";
if ($conf->global->PAYBOX_CGI_URL_V1) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL_V1;
if ($conf->global->PAYBOX_CGI_URL_V2) $URLPAYBOX=$conf->global->PAYBOX_CGI_URL_V2;
if (empty($IBS_DEVISE))
{
dol_print_error('',"Paybox setup param PAYBOX_IBS_DEVISE not defined");
return -1;
}
if (empty($URLPAYBOX))
{
dol_print_error('',"Paybox setup param PAYBOX_CGI_URL_V1 and PAYBOX_CGI_URL_V2 undefined");
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;
}
// Definition des parametres vente produit pour paybox
$IBS_CMD=$TAG;
$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 parametres du get de validation en reponse (url a definir sous paybox)
//$IBS_TXT="<center><b>".$langsiso->trans("YouWillBeRedirectedOnPayBox")."</b><br><i>".$langsiso->trans("PleaseBePatient")."...</i><br></center>";
$IBS_TXT=' '; // Use a space
$IBS_BOUTPI=$langs->trans("Wait");
//$IBS_BOUTPI='';
$IBS_EFFECTUE=$urlok;
$IBS_ANNULE=$urlko;
$IBS_REFUSE=$urlko;
$IBS_BKGD="#FFFFFF";
$IBS_WAIT="2000";
$IBS_LANG="GBR"; // By default GBR=english (FRA, GBR, ESP, ITA et DEU...)
if (preg_match('/^FR/i',$langs->defaultlang)) $IBS_LANG="FRA";
if (preg_match('/^ES/i',$langs->defaultlang)) $IBS_LANG="ESP";
if (preg_match('/^IT/i',$langs->defaultlang)) $IBS_LANG="ITA";
if (preg_match('/^DE/i',$langs->defaultlang)) $IBS_LANG="DEU";
if (preg_match('/^NL/i',$langs->defaultlang)) $IBS_LANG="NLD";
if (preg_match('/^SE/i',$langs->defaultlang)) $IBS_LANG="SWE";
$IBS_OUTPUT='E';
$PBX_SOURCE='HTML';
$PBX_TYPEPAIEMENT='CARTE';
dol_syslog("Soumission Paybox", LOG_DEBUG);
dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG);
dol_syslog("IBS_SITE: $IBS_SITE", LOG_DEBUG);
dol_syslog("IBS_RANG: $IBS_RANG", LOG_DEBUG);
dol_syslog("IBS_TOTAL: $IBS_TOTAL", LOG_DEBUG);
dol_syslog("IBS_DEVISE: $IBS_DEVISE", LOG_DEBUG);
dol_syslog("IBS_CMD: $IBS_CMD", LOG_DEBUG);
dol_syslog("IBS_PORTEUR: $IBS_PORTEUR", LOG_DEBUG);
dol_syslog("IBS_RETOUR: $IBS_RETOUR", LOG_DEBUG);
dol_syslog("IBS_EFFECTUE: $IBS_EFFECTUE", LOG_DEBUG);
dol_syslog("IBS_ANNULE: $IBS_ANNULE", LOG_DEBUG);
dol_syslog("IBS_REFUSE: $IBS_REFUSE", LOG_DEBUG);
dol_syslog("IBS_BKGD: $IBS_BKGD", LOG_DEBUG);
dol_syslog("IBS_WAIT: $IBS_WAIT", LOG_DEBUG);
dol_syslog("IBS_LANG: $IBS_LANG", LOG_DEBUG);
dol_syslog("IBS_OUTPUT: $IBS_OUTPUT", LOG_DEBUG);
dol_syslog("PBX_IDENTIFIANT: $PBX_IDENTITIANT", LOG_DEBUG);
dol_syslog("PBX_SOURCE: $PBX_SOURCE", LOG_DEBUG);
dol_syslog("PBX_TYPEPAIEMENT: $PBX_TYPEPAIEMENT", LOG_DEBUG);
header("Content-type: text/html; charset=".$conf->file->character_set_client);
print '<html>'."\n";
print '<head>'."\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->file->character_set_client."\">\n";
print '</head>'."\n";
print '<body>'."\n";
print "\n";
// Formulaire pour module Paybox
print '<form action="'.$URLPAYBOX.'" NAME="Submit" method="POST">'."\n";
// For Paybox V1 (IBS_xxx)
/*
print '<!-- Param for Paybox v1 -->'."\n";
print '<input type="hidden" name="IBS_MODE" value="'.$IBS_MODE.'">'."\n";
print '<input type="hidden" name="IBS_SITE" value="'.$IBS_SITE.'">'."\n";
print '<input type="hidden" name="IBS_RANG" value="'.$IBS_RANG.'">'."\n";
print '<input type="hidden" name="IBS_TOTAL" value="'.$IBS_TOTAL.'">'."\n";
print '<input type="hidden" name="IBS_DEVISE" value="'.$IBS_DEVISE.'">'."\n";
print '<input type="hidden" name="IBS_CMD" value="'.$IBS_CMD.'">'."\n";
print '<input type="hidden" name="IBS_PORTEUR" value="'.$IBS_PORTEUR.'">'."\n";
print '<input type="hidden" name="IBS_RETOUR" value="'.$IBS_RETOUR.'">'."\n";
print '<input type="hidden" name="IBS_EFFECTUE" value="'.$IBS_EFFECTUE.'">'."\n";
print '<input type="hidden" name="IBS_ANNULE" value="'.$IBS_ANNULE.'">'."\n";
print '<input type="hidden" name="IBS_REFUSE" value="'.$IBS_REFUSE.'">'."\n";
print '<input type="hidden" name="IBS_TXT" value="'.$IBS_TXT.'">'."\n";
print '<input type="hidden" name="IBS_BKGD" value="'.$IBS_BKGD.'">'."\n";
print '<input type="hidden" name="IBS_WAIT" value="'.$IBS_WAIT.'">'."\n";
print '<input type="hidden" name="IBS_LANG" value="'.$IBS_LANG.'">'."\n";
print '<input type="hidden" name="IBS_OUTPUT" value="'.$IBS_OUTPUT.'">'."\n";
*/
// For Paybox V2 (PBX_xxx)
print '<!-- Param for Paybox v2 -->'."\n";
print '<input type="hidden" name="PBX_IDENTIFIANT" value="'.$PBX_IDENTIFIANT.'">'."\n";
print '<input type="hidden" name="PBX_MODE" value="'.$IBS_MODE.'">'."\n";
print '<input type="hidden" name="PBX_SITE" value="'.$IBS_SITE.'">'."\n";
print '<input type="hidden" name="PBX_RANG" value="'.$IBS_RANG.'">'."\n";
print '<input type="hidden" name="PBX_TOTAL" value="'.$IBS_TOTAL.'">'."\n";
print '<input type="hidden" name="PBX_DEVISE" value="'.$IBS_DEVISE.'">'."\n";
print '<input type="hidden" name="PBX_CMD" value="'.$IBS_CMD.'">'."\n";
print '<input type="hidden" name="PBX_PORTEUR" value="'.$IBS_PORTEUR.'">'."\n";
print '<input type="hidden" name="PBX_RETOUR" value="'.$IBS_RETOUR.'">'."\n";
print '<input type="hidden" name="PBX_EFFECTUE" value="'.$IBS_EFFECTUE.'">'."\n";
print '<input type="hidden" name="PBX_ANNULE" value="'.$IBS_ANNULE.'">'."\n";
print '<input type="hidden" name="PBX_REFUSE" value="'.$IBS_REFUSE.'">'."\n";
print '<input type="hidden" name="PBX_TXT" value="'.$IBS_TXT.'">'."\n";
print '<input type="hidden" name="PBX_BKGD" value="'.$IBS_BKGD.'">'."\n";
print '<input type="hidden" name="PBX_WAIT" value="'.$IBS_WAIT.'">'."\n";
print '<input type="hidden" name="PBX_LANG" value="'.$IBS_LANG.'">'."\n";
print '<input type="hidden" name="PBX_OUTPUT" value="'.$IBS_OUTPUT.'">'."\n";
print '<input type="hidden" name="PBX_SOURCE" value="'.$PBX_SOURCE.'">'."\n";
print '<input type="hidden" name="PBX_TYPEPAIEMENT" value="'.$PBX_TYPEPAIEMENT.'">'."\n";
print '</form>'."\n";
// Formulaire pour module Paybox v2 (PBX_xxx)
print "\n";
print '<script type="text/javascript" language="javascript">'."\n";
print ' document.Submit.submit();'."\n";
print '</script>'."\n";
print "\n";
print '</body></html>'."\n";
print "\n";
return;
}
/**
* Show footer of company in HTML pages
*
* @param $fromcompany
* @param $langs
*/
function html_print_paypal_footer($fromcompany,$langs)
{
global $conf;
// Juridical status
$ligne1="";
if ($fromcompany->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
}
// Capital
if ($fromcompany->capital)
{
$ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie);
}
// Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2))
{
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
}
// Prof Id 2
if ($fromcompany->idprof2)
{
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
}
// Second line of company infos
$ligne2="";
// Prof Id 3
if ($fromcompany->idprof3)
{
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
}
// Prof Id 4
if ($fromcompany->idprof4)
{
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
}
print '<br><br><hr>'."\n";
print '<center><font style="font-size: 10px;">'."\n";
print $fromcompany->nom.'<br>';
print $ligne1.'<br>';
print $ligne2;
print '</font></center>'."\n";
}
?>

View File

@ -30,7 +30,7 @@ define("NOLOGIN",1); // This means this output page does not require to be logg
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/lib/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -642,7 +642,7 @@ print '</center>';
print '<br>';
html_print_footer($mysoc,$langs);
html_print_paybox_footer($mysoc,$langs);
$db->close();

View File

@ -29,7 +29,7 @@ define("NOLOGIN",1); // This means this output page does not require to be logg
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/lib/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
// Security check
@ -37,10 +37,11 @@ if (empty($conf->paybox->enabled)) accessforbidden('',1,1,1);
$langs->load("main");
$langs->load("other");
$langs->load("paybox");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("paybox");
$langs->load("paypal");
@ -60,8 +61,10 @@ $langs->load("companies");
llxHeaderPayBox($langs->trans("PaymentForm"));
print $langs->trans("YourPaymentHasNotBeenRecorded");
html_print_footer($mysoc,$langs);
html_print_paybox_footer($mysoc,$langs);
$db->close();

View File

@ -29,7 +29,7 @@ define("NOLOGIN",1); // This means this output page does not require to be logg
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paybox/lib/paybox.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
// Security check
@ -37,10 +37,11 @@ if (empty($conf->paybox->enabled)) accessforbidden('',1,1,1);
$langs->load("main");
$langs->load("other");
$langs->load("paybox");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("paybox");
$langs->load("paypal");
@ -59,8 +60,10 @@ $langs->load("companies");
llxHeaderPayBox($langs->trans("PaymentForm"));
print $langs->trans("YourPaymentHasBeenRecorded");
html_print_footer($mysoc,$langs);
html_print_paybox_footer($mysoc,$langs);
$db->close();

31
htdocs/public/paypal/index.php Executable file
View File

@ -0,0 +1,31 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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.
*/
/**
* \file htdocs/public/paypal/index.php
* \ingroup core
* \brief A redirect page to an error
* \author Laurent Destailleur
* \version $Id$
*/
require("../../master.inc.php");
header("Location: ".DOL_URL_ROOT.'/public/error-404.php');
?>

View File

@ -0,0 +1,651 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* 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.
*/
/**
* \file htdocs/public/paypal/newpayment.php
* \ingroup paypal
* \brief File to offer a way to make a payment for a particular Dolibarr entity
* \author Laurent Destailleur
* \version $Id$
*/
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
// Security check
if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1);
// Creation d'un jeton contre les failles CSRF
$token = md5(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire
// roulement des jetons car cree a chaque appel
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
$_SESSION['newtoken'] = $token;
// Verification de la presence et de la validite du jeton
if (isset($_POST['token']) && isset($_SESSION['token']))
{
if ($_POST['token'] != $_SESSION['token'])
{
unset($_POST);
}
}
$langs->load("main");
$langs->load("other");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("errors");
$langs->load("paybox");
$langs->load("paypal");
// Input are:
// type ('invoice','order','contractline'),
// id (object id),
// amount (required if id is empty),
// tag (a free text, required if type is empty)
// currency (iso code)
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
else $currency=$_REQUEST["currency"];
if (empty($_REQUEST["amount"]))
{
dol_print_error('','ErrorBadParameters');
session_destroy();
exit;
}
$amount=$_REQUEST["amount"];
if (is_numeric($amount) && empty($_REQUEST["tag"]))
{
dol_print_error('','ErrorBadParameters');
session_destroy();
exit;
}
if (! is_numeric($amount) && empty($_REQUEST["ref"]))
{
dol_print_error('','ErrorBadParameters');
session_destroy();
exit;
}
$suffix=$_REQUEST["suffix"];
/*
* Actions
*/
if ($_REQUEST["action"] == 'dopayment')
{
$PRICE=$_REQUEST["newamount"];
$EMAIL=$_REQUEST["EMAIL"];
$urlok='';
$urlko='';
$TAG=$_REQUEST["newtag"];
$ID=$_REQUEST["id"];
$mesg='';
if (empty($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
elseif (empty($TAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
if (empty($mesg))
{
print_paypal_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
session_destroy();
exit;
}
}
/*
* View
*/
llxHeaderPaypal($langs->trans("PaymentForm"));
// Common variables
$creditor=$mysoc->nom;
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
print '<center>';
print '<form name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="dopayment">';
print '<input type="hidden" name="amount" value="'.$_REQUEST["amount"].'">';
print '<input type="hidden" name="tag" value="'.$_REQUEST["tag"].'">';
print '<input type="hidden" name="suffix" value="'.$_REQUEST["suffix"].'">';
print "\n";
print '<table style="font-size:14px;" summary="Logo" width="80%">'."\n";
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
$width=0;
// Define logo and logosmall
$logosmall=$mysoc->logo_small;
$logo=$mysoc->logo;
$paramlogo='PAYBOX_LOGO_'.$suffix;
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
// Define urllogo
$urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$logosmall);
}
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode($logo);
$width=96;
}
// Output html code for logo
if ($urllogo)
{
print '<tr>';
print '<td align="center"><img title="'.$title.'" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '></td>';
print '</tr>'."\n";
}
print '<tr><td align="center"><br>'.$langs->trans("WelcomeOnPaymentPage").'<br></td></tr>'."\n";
print '<tr><td align="center"><br>'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n";
print '<tr><td align="center">';
print '<table with="100%">';
print '<tr class="liste_total"><td align="left" colspan="2">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n";
$found=false;
$error=0;
$var=false;
// Free payment
if (is_numeric($_REQUEST["amount"]))
{
$found=true;
$tag=$_REQUEST["tag"];
$newtag=$tag;
// Creditor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
// Amount
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
else {
print '<b>'.price($amount).'</b>';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
print '</td></tr>'."\n";
// Tag
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$newtag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
print '</td></tr>'."\n";
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
}
// Payment on customer order
if ($_REQUEST["amount"] == 'order')
{
$found=true;
$langs->load("orders");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
$order=new Commande($db);
$result=$order->fetch('',$_REQUEST["ref"]);
if ($result < 0)
{
$mesg=$order->error;
$error++;
}
else
{
$result=$order->fetch_thirdparty($order->socid);
}
$amount=$order->total_ttc;
$newtag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
$newtag=dol_string_unaccent($newtag);
// Creditor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->client->nom.'</b>';
// Object
$var=!$var;
$text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>';
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
print '<input type="hidden" name="ref" value="'.$order->ref.'">';
print '</td></tr>'."\n";
// Amount
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
else {
print '<b>'.price($amount).'</b>';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
print '</td></tr>'."\n";
// Tag
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$newtag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
print '</td></tr>'."\n";
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
}
// Payment on customer invoice
if ($_REQUEST["amount"] == 'invoice')
{
$found=true;
$langs->load("bills");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
$invoice=new Facture($db);
$result=$invoice->fetch('',$_REQUEST["ref"]);
if ($result < 0)
{
$mesg=$invoice->error;
$error++;
}
else
{
$result=$invoice->fetch_thirdparty($invoice->socid);
}
$amount=$invoice->total_ttc - $invoice->getSommePaiement();
$newtag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
$newtag=dol_string_unaccent($newtag);
// Creditor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->client->nom.'</b>';
// Object
$var=!$var;
$text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>';
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
print '<input type="hidden" name="ref" value="'.$invoice->ref.'">';
print '</td></tr>'."\n";
// Amount
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
else {
print '<b>'.price($amount).'</b>';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
print '</td></tr>'."\n";
// Tag
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$newtag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
print '</td></tr>'."\n";
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
}
// Payment on contract line
if ($_REQUEST["amount"] == 'contractline')
{
$found=true;
$langs->load("contracts");
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
$contractline=new ContratLigne($db);
$result=$contractline->fetch('',$_REQUEST["ref"]);
if ($result < 0)
{
$mesg=$contractline->error;
$error++;
}
else
{
if ($contractline->fk_contrat > 0)
{
$contract=new Contrat($db);
$result=$contract->fetch($contractline->fk_contrat);
if ($result > 0)
{
$result=$contract->fetch_thirdparty($contract->socid);
}
else
{
$mesg=$contract->error;
$error++;
}
}
else
{
$mesg='ErrorRecordNotFound';
$error++;
}
}
$amount=$contractline->total_ttc;
if ($contractline->fk_product)
{
$product=new Product($db);
$result=$product->fetch($contractline->fk_product);
// We define price for product (TODO Put this in a method in product class)
if ($conf->global->PRODUIT_MULTIPRICES)
{
$pu_ht = $product->multiprices[$contract->client->price_level];
$pu_ttc = $product->multiprices_ttc[$contract->client->price_level];
$price_base_type = $product->multiprices_base_type[$contract->client->price_level];
}
else
{
$pu_ht = $product->price;
$pu_ttc = $product->price_ttc;
$price_base_type = $product->price_base_type;
}
$amount=$pu_ttc;
if (empty($amount))
{
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
exit;
}
}
$newtag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
$newtag=dol_string_unaccent($newtag);
$qty=1;
if (isset($_REQUEST["qty"])) $qty=$_REQUEST["qty"];
// Creditor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->client->nom.'</b>';
// Object
$var=!$var;
$text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>';
if ($contractline->fk_product)
{
$text.='<br>'.$product->ref.($product->libelle?' - '.$product->libelle:'');
}
if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description);
//if ($contractline->date_fin_validite) {
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
// $text.=dol_print_date($contractline->date_fin_validite);
//}
if ($contractline->date_fin_validite)
{
$text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite);
}
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
print '<input type="hidden" name="ref" value="'.$contractline->ref.'">';
print '</td></tr>'."\n";
// Quantity
$var=!$var;
$label=$langs->trans("Quantity");
$qty=1;
$duration='';
if ($contractline->fk_product)
{
if ($product->isservice() && $product->duration_value > 0)
{
$label=$langs->trans("Duration");
// TODO Put this in a global method
if ($product->duration_value > 1)
{
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears"));
}
else
{
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear"));
}
$duration=$product->duration_value.' '.$dur[$product->duration_unit];
}
}
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$label.'</td>';
print '<td class="CTableRow'.($var?'1':'2').'"><b>'.($duration?$duration:$qty).'</b>';
print '<input type="hidden" name="newqty" value="'.$qty.'">';
print '</b></td></tr>'."\n";
// Amount
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
else {
print '<b>'.price($amount).'</b>';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
print '</td></tr>'."\n";
// Tag
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$newtag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
print '</td></tr>'."\n";
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
}
// Payment on member subscription
if ($_REQUEST["amount"] == 'membersubscription')
{
$found=true;
$langs->load("members");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
$member=new Adherent($db);
$result=$member->fetch('',$_REQUEST["ref"]);
if ($result < 0)
{
$mesg=$member->error;
$error++;
}
else
{
$subscription=new Cotisation($db);
}
$amount=$subscription->total_ttc;
$newtag='MID='.$member->id.'.M='.strtr($member->getFullName($langs),"-"," ");
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; }
$newtag=dol_string_unaccent($newtag);
// Creditor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b></td></tr>'."\n";
// Debitor
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$member->getFullName($langs).'</b>';
// Object
$var=!$var;
$text='<b>'.$langs->trans("PaymentSubscription").'</b>';
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
print '<input type="hidden" name="ref" value="'.$member->ref.'">';
print '</td></tr>'."\n";
// Amount
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'">';
if (empty($amount) || ! is_numeric($amount)) print '<input class="flat" size=8 type="text" name="newamount" value="'.$_REQUEST["newamount"].'">';
else {
print '<b>'.price($amount).'</b>';
print '<input type="hidden" name="newamount" value="'.$amount.'">';
}
print ' <b>'.$langs->trans("Currency".$conf->monnaie).'</b>';
print '<input type="hidden" name="currency" value="'.$conf->monnaie.'">';
print '</td></tr>'."\n";
// Tag
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$newtag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="newtag" value="'.$newtag.'">';
print '</td></tr>'."\n";
// EMail
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
}
if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>';
print '</table>';
if ($found && ! $error) // We are in a management option and no error
{
print '<br><input class="button" type="submit" name="dopayment" value="'.$langs->trans("PayBoxDoPayment").'">';
//print '<tr><td align="center" colspan="2">'.$langs->trans("YouWillBeRedirectedOnPayBox").'...</td></tr>';
}
else
{
dol_print_error_email();
}
print '</td></tr>';
print '</table>';
print '</form>';
print '</center>';
print '<br>';
html_print_paypal_footer($mysoc,$langs);
$db->close();
llxFooterPaypal('$Date$ - $Revision$');
?>

View File

@ -0,0 +1,70 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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.
*/
/**
* \file htdocs/public/paybox/paymentko.php
* \ingroup paybox
* \brief File to show page after a failed payment
* \author Laurent Destailleur
* \version $Id$
*/
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
// Security check
if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1);
$langs->load("main");
$langs->load("other");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("paybox");
$langs->load("paypal");
/*
* Actions
*/
/*
* View
*/
llxHeaderPaypal($langs->trans("PaymentForm"));
print $langs->trans("YourPaymentHasNotBeenRecorded");
html_print_paypal_footer($mysoc,$langs);
$db->close();
llxFooterPaypal('$Date$ - $Revision$');
?>

View File

@ -0,0 +1,72 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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.
*/
/**
* \file htdocs/public/paypal/paymentok.php
* \ingroup paypal
* \brief File to show page after a successful payment
* \author Laurent Destailleur
* \version $Id$
*/
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
// Security check
if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1);
$langs->load("main");
$langs->load("other");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("paybox");
$langs->load("paypal");
/*
* Actions
*/
/*
* View
*/
llxHeaderPaypal($langs->trans("PaymentForm"));
print $langs->trans("YourPaymentHasBeenRecorded");
html_print_paypal_footer($mysoc,$langs);
$db->close();
llxFooterPaypal('$Date$ - $Revision$');
?>