28if (!defined(
'NOLOGIN')) {
31if (!defined(
'NOCSRFCHECK')) {
32 define(
"NOCSRFCHECK", 1);
34if (!defined(
'NOIPCHECK')) {
35 define(
'NOIPCHECK',
'1');
37if (!defined(
'NOBROWSERNOTIF')) {
38 define(
'NOBROWSERNOTIF',
'1');
44$entity = (!empty($_GET[
'e']) ? (int) $_GET[
'e'] : (!empty($_POST[
'e']) ? (int) $_POST[
'e'] : 1));
45if (is_numeric($entity)) {
46 define(
"DOLENTITY", $entity);
50require
'../../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
54if (isModEnabled(
'paypal')) {
55 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypal.lib.php';
56 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypalfunctions.lib.php';
59$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"paybox",
"paypal",
"stripe"));
61if (isModEnabled(
'paypal')) {
62 $PAYPALTOKEN =
GETPOST(
'TOKEN');
63 if (empty($PAYPALTOKEN)) {
64 $PAYPALTOKEN =
GETPOST(
'token');
66 $PAYPALPAYERID =
GETPOST(
'PAYERID');
67 if (empty($PAYPALPAYERID)) {
68 $PAYPALPAYERID =
GETPOST(
'PayerID');
71if (isModEnabled(
'paybox')) {
73if (isModEnabled(
'stripe')) {
81$suffix =
GETPOST(
"suffix",
'aZ09');
87if (preg_match(
'/PM=([^\.]+)/', $FULLTAG, $reg)) {
88 $paymentmethod = $reg[1];
90if (empty($paymentmethod)) {
91 dol_print_error(
null,
'The back url does not contain a parameter fulltag that should help us to find the payment method used');
98$validpaymentmethod = array();
99if (isModEnabled(
'paypal')) {
100 $validpaymentmethod[
'paypal'] =
'paypal';
102if (isModEnabled(
'paybox')) {
103 $validpaymentmethod[
'paybox'] =
'paybox';
105if (isModEnabled(
'stripe')) {
106 $validpaymentmethod[
'stripe'] =
'stripe';
111if (empty($validpaymentmethod)) {
130dol_syslog(
"Callback url when an online payment is refused or canceled. query_string=".(empty($_SERVER[
"QUERY_STRING"]) ?
'' : $_SERVER[
"QUERY_STRING"]).
" script_uri=".(empty($_SERVER[
"SCRIPT_URI"]) ?
'' : $_SERVER[
"SCRIPT_URI"]), LOG_DEBUG, 0,
'_payment');
133foreach ($_POST as $k => $v) {
134 if (is_scalar($k) && is_scalar($v)) {
135 $tracepost .=
"$k - $v\n";
138dol_syslog(
"POST=".$tracepost, LOG_DEBUG, 0,
'_payment');
142$appli = $mysoc->name;
145if (!empty($_SESSION[
'ipaddress'])) {
148 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
149 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
151 $paymentType = $_SESSION[
'PaymentType'];
152 $currencyCodeType = $_SESSION[
'currencyCodeType'];
153 $FinalPaymentAmt = $_SESSION[
'FinalPaymentAmt'];
155 $ipaddress = $_SESSION[
'ipaddress'];
156 $errormessage = $_SESSION[
'errormessage'];
158 if (is_object($object) && method_exists($object,
'call_trigger')) {
160 $result = $object->call_trigger(
'PAYMENTONLINE_PAYMENT_KO', $user);
170 $sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
175 $companylangs =
new Translate(
'', $conf);
176 $companylangs->setDefaultLang($mysoc->default_lang);
177 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox'));
180 $sendto = $sendemail;
182 $urlback = $_SERVER[
"REQUEST_URI"];
183 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"NewOnlinePaymentFailed");
185 $content .=
'<span style="color: orange">'.$companylangs->transnoentitiesnoconv(
"ValidationOfOnlinePaymentFailed").
"</span>\n";
187 $content .=
"<br><br>\n";
188 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
189 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
190 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
191 $content .= $companylangs->transnoentitiesnoconv(
"Error").
': '.$errormessage.
"<br>\n";
192 $content .=
"<br>\n";
193 $content .=
"tag=".$fulltag.
" token=".$onlinetoken.
" paymentType=".$paymentType.
" currencycodeType=".$currencyCodeType.
" payerId=".$payerID.
" ipaddress=".$ipaddress.
" FinalPaymentAmt=".$FinalPaymentAmt;
197 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
198 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml);
200 $result = $mailfile->sendfile();
202 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
204 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
208 unset($_SESSION[
'ipaddress']);
213 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
216$conf->dol_hide_topmenu = 1;
217$conf->dol_hide_leftmenu = 1;
219$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
220llxHeader($head, $langs->trans(
"PaymentForm"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea);
224print
'<span id="dolpaymentspan"></span>'.
"\n";
225print
'<div id="dolpaymentdiv" align="center">'.
"\n";
229$logosmall = $mysoc->logo_small;
231$paramlogo =
'ONLINE_PAYMENT_LOGO_'.$suffix;
232if (!empty($conf->global->$paramlogo)) {
233 $logosmall = $conf->global->$paramlogo;
235 $logosmall = $conf->global->ONLINE_PAYMENT_LOGO;
241if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
242 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
243 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
244} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
245 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
246 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
251 print
'<div class="backgreypublicpayment">';
252 print
'<div class="logopublicpayment">';
253 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
257 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
262 print
'<div class="backimagepublicpayment">';
263 print
'<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' .
getDolGlobalString(
'MAIN_IMAGE_PUBLIC_PAYMENT').
'">';
271print $langs->trans(
"YourPaymentHasNotBeenRecorded").
"<br><br>";
273$key =
'ONLINE_PAYMENT_MESSAGE_KO';
274if (!empty($conf->global->$key)) {
275 print $conf->global->$key;
279$ref =
GETPOST(
'ref',
'alphanohtml');
281require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
283 $urlsubscription = getOnlinePaymentUrl(0, ($type ? $type :
'free'), $ref, $FinalPaymentAmt, $tag);
285 print $langs->trans(
"ClickHereToTryAgain", $urlsubscription);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage translations.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.