2010-10-03 02:12:54 +02:00
|
|
|
<?php
|
2012-02-16 11:52:38 +01:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2013-06-25 13:19:44 +02:00
|
|
|
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
|
2012-04-05 17:20:37 +02:00
|
|
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
2010-10-03 02:12:54 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-10-03 02:12:54 +02:00
|
|
|
* (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
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-10-03 02:12:54 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-08-27 18:15:06 +02:00
|
|
|
/**
|
|
|
|
|
* \file htdocs/paypal/admin/paypal.php
|
|
|
|
|
* \ingroup paypal
|
|
|
|
|
* \brief Page to setup paypal module
|
2010-10-03 02:12:54 +02:00
|
|
|
*/
|
|
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
2017-09-15 13:43:16 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$servicename = 'PayPal';
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2018-05-26 17:57:30 +02:00
|
|
|
// Load translation files required by the page
|
2021-08-21 13:41:04 +02:00
|
|
|
$langs->loadLangs(array('admin', 'other', 'paypal', 'paybox', 'stripe'));
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!$user->admin) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2021-02-26 15:27:05 +01:00
|
|
|
if ($action == 'setvalue' && $user->admin) {
|
2011-09-06 11:33:24 +02:00
|
|
|
$db->begin();
|
2017-08-31 02:34:07 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_API_USER", GETPOST('PAYPAL_API_USER', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_API_PASSWORD", GETPOST('PAYPAL_API_PASSWORD', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_API_SIGNATURE", GETPOST('PAYPAL_API_SIGNATURE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_SSLVERSION", GETPOST('PAYPAL_SSLVERSION', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY", GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL", GETPOST('PAYPAL_ADD_PAYMENT_URL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2021-05-28 10:31:54 +02:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2021-05-28 10:31:54 +02:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2021-05-28 10:31:54 +02:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2021-06-11 19:05:05 +02:00
|
|
|
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2017-09-15 13:43:16 +02:00
|
|
|
// Payment token for URL
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$error++;
|
|
|
|
|
}
|
2020-09-14 19:00:18 +02:00
|
|
|
if (empty($conf->use_javascript_ajax)) {
|
|
|
|
|
$result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE", GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
2022-08-12 15:54:50 +02:00
|
|
|
if (!($result > 0)) {
|
2020-09-14 19:00:18 +02:00
|
|
|
$error++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$error) {
|
2021-02-26 15:27:05 +01:00
|
|
|
$db->commit();
|
|
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
|
|
|
} else {
|
|
|
|
|
$db->rollback();
|
2010-10-03 02:12:54 +02:00
|
|
|
dol_print_error($db);
|
2020-10-31 14:32:18 +01:00
|
|
|
}
|
2010-10-03 02:12:54 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-26 15:27:05 +01:00
|
|
|
if ($action == "setlive") {
|
2020-10-31 14:32:18 +01:00
|
|
|
$liveenable = GETPOST('value', 'int') ? 0 : 1;
|
|
|
|
|
$res = dolibarr_set_const($db, "PAYPAL_API_SANDBOX", $liveenable, 'yesno', 0, '', $conf->entity);
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!($res > 0)) {
|
|
|
|
|
$error++;
|
|
|
|
|
}
|
|
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
|
|
|
} else {
|
|
|
|
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
|
|
}
|
2017-05-14 17:05:13 +02:00
|
|
|
}
|
|
|
|
|
|
2010-10-03 02:12:54 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$form = new Form($db);
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader('', $langs->trans("PaypalSetup"));
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2010-10-10 21:14:08 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print load_fiche_titre($langs->trans("ModuleSetup").' PayPal', $linkback);
|
2011-05-17 12:36:53 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$head = paypaladmin_prepare_head();
|
2011-05-17 12:36:53 +02:00
|
|
|
|
2015-08-31 12:13:23 +02:00
|
|
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2015-08-31 12:13:23 +02:00
|
|
|
print '<input type="hidden" name="action" value="setvalue">';
|
|
|
|
|
|
|
|
|
|
|
2020-10-22 22:50:03 +02:00
|
|
|
print dol_get_fiche_head($head, 'paypalaccount', '', -1);
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2020-09-14 19:00:18 +02:00
|
|
|
print '<span class="opacitymedium">'.$langs->trans("PaypalDesc")."</span><br>\n";
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2012-07-04 10:29:17 +02:00
|
|
|
// Test if php curl exist
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!function_exists('curl_version')) {
|
2012-07-04 10:29:17 +02:00
|
|
|
$langs->load("errors");
|
2015-12-12 10:59:02 +01:00
|
|
|
setEventMessages($langs->trans("ErrorPhpCurlNotInstalled"), null, 'errors');
|
2012-07-04 10:29:17 +02:00
|
|
|
}
|
|
|
|
|
|
2010-10-03 02:12:54 +02:00
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
2020-12-07 11:42:35 +01:00
|
|
|
print '<div class="div-table-responsive-no-min">';
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2010-10-10 21:14:08 +02:00
|
|
|
|
2015-12-10 16:29:35 +01:00
|
|
|
// Account Parameters
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2010-10-10 23:40:02 +02:00
|
|
|
print '<td>'.$langs->trans("AccountParameter").'</td>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<td>'.$langs->trans("Value").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2017-05-14 17:05:13 +02:00
|
|
|
print '<tr class="oddeven">';
|
2020-12-07 11:42:35 +01:00
|
|
|
print '<td>';
|
2017-05-14 17:05:13 +02:00
|
|
|
print $langs->trans("PaypalLiveEnabled").'</td><td>';
|
2021-02-26 15:27:05 +01:00
|
|
|
if (empty($conf->global->PAYPAL_API_SANDBOX)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlive&token='.newToken().'&value=0">';
|
|
|
|
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlive&token='.newToken().'&value=1">';
|
|
|
|
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
2017-05-14 17:05:13 +02:00
|
|
|
}
|
2010-10-10 21:14:08 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td class="fieldrequired">';
|
2010-10-10 21:14:08 +02:00
|
|
|
print $langs->trans("PAYPAL_API_USER").'</td><td>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
|
2020-09-14 19:00:18 +02:00
|
|
|
print ' <span class="opacitymedium">'.$langs->trans("Example").': admin-facilitator_api1.example.com, paypal_api1.mywebsite.com</span>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td class="fieldrequired">';
|
2010-10-10 21:14:08 +02:00
|
|
|
print $langs->trans("PAYPAL_API_PASSWORD").'</td><td>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<input size="32" type="text" name="PAYPAL_API_PASSWORD" value="'.$conf->global->PAYPAL_API_PASSWORD.'">';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td class="fieldrequired">';
|
2010-10-10 21:14:08 +02:00
|
|
|
print $langs->trans("PAYPAL_API_SIGNATURE").'</td><td>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<input size="64" type="text" name="PAYPAL_API_SIGNATURE" value="'.$conf->global->PAYPAL_API_SIGNATURE.'">';
|
2020-09-14 19:00:18 +02:00
|
|
|
print '<br><span class="opacitymedium">'.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF</span>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-05-15 10:39:14 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2015-12-10 16:29:35 +01:00
|
|
|
print $langs->trans("PAYPAL_SSLVERSION").'</td><td>';
|
2020-04-10 10:59:32 +02:00
|
|
|
print $form->selectarray("PAYPAL_SSLVERSION", array('1'=> $langs->trans('TLSv1'), '6'=> $langs->trans('TLSv1.2')), $conf->global->PAYPAL_SSLVERSION);
|
2015-12-10 16:29:35 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2020-12-07 11:42:35 +01:00
|
|
|
print '</table>';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
|
|
print '<table class="noborder centpercent">';
|
|
|
|
|
|
2015-12-10 16:29:35 +01:00
|
|
|
// Usage Parameters
|
2010-10-10 21:14:08 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2010-10-10 23:40:02 +02:00
|
|
|
print '<td>'.$langs->trans("UsageParameter").'</td>';
|
2010-10-10 21:14:08 +02:00
|
|
|
print '<td>'.$langs->trans("Value").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-05-15 10:39:14 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2010-10-10 21:14:08 +02:00
|
|
|
print $langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").'</td><td>';
|
2020-04-10 10:59:32 +02:00
|
|
|
print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY", array('integral'=> $langs->trans('PaypalModeIntegral'), 'paypalonly'=> $langs->trans('PaypalModeOnlyPaypal')), $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY);
|
2010-10-03 02:12:54 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
/*
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2010-10-03 02:12:54 +02:00
|
|
|
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_EXPRESS").'</span></td><td>';
|
2016-03-25 15:53:44 +01:00
|
|
|
print $form->selectyesno("PAYPAL_API_EXPRESS",$conf->global->PAYPAL_API_EXPRESS);
|
2010-10-03 02:12:54 +02:00
|
|
|
print '</td></tr>';
|
2010-10-10 21:14:08 +02:00
|
|
|
*/
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2020-09-17 17:30:44 +02:00
|
|
|
print $langs->trans("PublicVendorName").'</td><td>';
|
2017-08-31 03:41:04 +02:00
|
|
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
|
2020-09-14 19:00:18 +02:00
|
|
|
print ' <span class="opacitymedium">'.$langs->trans("Example").': '.$mysoc->name.'</span>';
|
2010-10-31 14:29:33 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!empty($conf->banque->enabled)) {
|
2018-03-04 19:39:46 +01:00
|
|
|
print '<tr class="oddeven"><td>';
|
|
|
|
|
print $langs->trans("BankAccount").'</td><td>';
|
2020-12-07 11:42:35 +01:00
|
|
|
print img_picto('', 'bank_account').' ';
|
2019-09-16 18:29:04 +02:00
|
|
|
$form->select_comptes($conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS, 'PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
|
2018-03-04 19:39:46 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2010-10-31 14:29:33 +01:00
|
|
|
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
2017-08-31 02:34:07 +02:00
|
|
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
2020-09-14 19:00:18 +02:00
|
|
|
print ' <span class="opacitymedium">'.$langs->trans("Example").': http://mysite/mycss.css</span>';
|
2011-05-02 19:08:50 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2011-06-17 12:21:21 +02:00
|
|
|
print $langs->trans("PAYPAL_ADD_PAYMENT_URL").'</td><td>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print $form->selectyesno("PAYPAL_ADD_PAYMENT_URL", $conf->global->PAYPAL_ADD_PAYMENT_URL, 1);
|
2011-06-17 12:21:21 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-09-09 09:54:42 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
|
|
|
|
print $langs->trans("MessageForm").'</td><td>';
|
2020-04-10 10:59:32 +02:00
|
|
|
$doleditor = new DolEditor('ONLINE_PAYMENT_MESSAGE_FORM', $conf->global->ONLINE_PAYMENT_MESSAGE_FORM, '', 100, 'dolibarr_details', 'In', false, true, true, ROWS_4, '90%');
|
2017-09-09 09:54:42 +02:00
|
|
|
$doleditor->Create();
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2010-11-01 13:41:32 +01:00
|
|
|
print $langs->trans("MessageOK").'</td><td>';
|
2020-04-10 10:59:32 +02:00
|
|
|
$doleditor = new DolEditor('ONLINE_PAYMENT_MESSAGE_OK', $conf->global->ONLINE_PAYMENT_MESSAGE_OK, '', 100, 'dolibarr_details', 'In', false, true, true, ROWS_4, '90%');
|
2010-11-01 13:41:32 +01:00
|
|
|
$doleditor->Create();
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2010-11-01 13:41:32 +01:00
|
|
|
print $langs->trans("MessageKO").'</td><td>';
|
2020-04-10 10:59:32 +02:00
|
|
|
$doleditor = new DolEditor('ONLINE_PAYMENT_MESSAGE_KO', $conf->global->ONLINE_PAYMENT_MESSAGE_KO, '', 100, 'dolibarr_details', 'In', false, true, true, ROWS_4, '90%');
|
2010-11-01 13:41:32 +01:00
|
|
|
$doleditor->Create();
|
|
|
|
|
print '</td></tr>';
|
2010-10-03 02:12:54 +02:00
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2017-08-31 02:34:07 +02:00
|
|
|
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
2020-09-14 19:00:18 +02:00
|
|
|
print '<input class="minwidth200" type="text" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
|
|
|
|
print ' <span class="opacitymedium">'.$langs->trans("Example").': myemail@myserver.com, Payment service <myemail2@myserver2.com></span>';
|
2013-06-26 16:45:42 +02:00
|
|
|
print '</td></tr>';
|
2013-06-25 13:19:44 +02:00
|
|
|
|
2020-12-07 11:42:35 +01:00
|
|
|
print '</table>';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '<br>';
|
|
|
|
|
|
|
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
|
|
print '<table class="noborder centpercent">';
|
|
|
|
|
|
2011-09-06 00:52:17 +02:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td>'.$langs->trans("UrlGenerationParameters").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("Value").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2017-09-15 13:43:16 +02:00
|
|
|
// Payment token for URL
|
2017-04-14 13:02:29 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
2011-09-06 00:52:17 +02:00
|
|
|
print $langs->trans("SecurityToken").'</td><td>';
|
2020-09-14 19:00:18 +02:00
|
|
|
print '<input class="minwidth300" type="text" id="PAYMENT_SECURITY_TOKEN" name="PAYMENT_SECURITY_TOKEN" value="'.$conf->global->PAYMENT_SECURITY_TOKEN.'">';
|
|
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
2012-10-24 12:18:40 +02:00
|
|
|
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
2020-09-14 19:00:18 +02:00
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
if (!empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) {
|
2020-09-14 19:00:18 +02:00
|
|
|
$langs->load("errors");
|
2020-09-20 18:05:49 +02:00
|
|
|
print img_warning($langs->trans("WarningTheHiddenOptionIsOn", 'PAYMENT_SECURITY_ACCEPT_ANY_TOKEN'), '', 'pictowarning marginleftonly');
|
2020-09-14 19:00:18 +02:00
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
2011-09-06 00:52:17 +02:00
|
|
|
|
2020-09-14 19:00:18 +02:00
|
|
|
print '<tr class="oddeven"><td>';
|
|
|
|
|
print $langs->trans("SecurityTokenIsUnique").'</td><td>';
|
|
|
|
|
if ($conf->use_javascript_ajax) {
|
|
|
|
|
print ajax_constantonoff('PAYMENT_SECURITY_TOKEN_UNIQUE');
|
|
|
|
|
} else {
|
|
|
|
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
|
|
|
print $form->selectarray("PAYMENT_SECURITY_TOKEN_UNIQUE", $arrval, $conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE);
|
|
|
|
|
}
|
|
|
|
|
print '</td></tr>';
|
2011-09-06 00:52:17 +02:00
|
|
|
|
|
|
|
|
print '</table>';
|
2020-12-07 11:42:35 +01:00
|
|
|
print '</div>';
|
2011-09-06 00:52:17 +02:00
|
|
|
|
2020-10-27 18:19:31 +01:00
|
|
|
print dol_get_fiche_end();
|
2015-08-31 12:13:23 +02:00
|
|
|
|
2021-08-24 17:04:17 +02:00
|
|
|
print $form->buttonsSaveCancel("Modify", '');
|
2014-03-11 12:02:44 +01:00
|
|
|
|
2011-09-06 00:52:17 +02:00
|
|
|
print '</form>';
|
2010-10-03 02:12:54 +02:00
|
|
|
|
|
|
|
|
print '<br><br>';
|
|
|
|
|
|
2010-10-10 21:14:08 +02:00
|
|
|
// Help doc
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<u>'.$langs->trans("InformationToFindParameters", "Paypal").'</u>:<br>';
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
2020-12-07 11:42:35 +01:00
|
|
|
print '<a class="reposition" id="apidoca">'.$langs->trans("ClickHere").'...</a>';
|
2021-02-26 15:27:05 +01:00
|
|
|
}
|
2010-10-10 21:14:08 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$realpaypalurl = 'www.paypal.com';
|
|
|
|
|
$sandboxpaypalurl = 'developer.paypal.com';
|
2010-10-30 01:00:45 +02:00
|
|
|
|
2010-10-10 21:14:08 +02:00
|
|
|
print '<div id="apidoc">';
|
|
|
|
|
print 'Your API authentication information can be found with following steps. We recommend that you open a separate Web browser session when carrying out this procedure.<br>
|
2021-11-22 02:35:55 +01:00
|
|
|
1. Log in to your PayPal account (on real paypal <a href="https://'.$realpaypalurl.'" target="_blank" rel="noopener noreferrer external">'.$realpaypalurl.'</a> (or sandbox <a href="https://'.$sandboxpaypalurl.'" target="_blank" rel="noopener noreferrer external">'.$sandboxpaypalurl.'</a>).<br>
|
2013-07-09 00:35:55 +02:00
|
|
|
2. Click the "Profile" or "Preferencies" subtab located under the My Account heading.<br>
|
|
|
|
|
3. Click the link "API Access".<br>
|
2010-10-10 21:14:08 +02:00
|
|
|
4. Click the View API Certificate link in the right column.<br>
|
|
|
|
|
5. Click the Request API signature radio button on the Request API Credentials page.<br>
|
|
|
|
|
6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.<br>
|
|
|
|
|
7. Save the values for API Username, Password and Signature (make sure this long character signature is copied).<br>
|
|
|
|
|
8. Click the "Modify" button after copying your API Username, Password, and Signature.
|
|
|
|
|
';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
2021-02-26 15:27:05 +01:00
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
2012-10-24 12:18:40 +02:00
|
|
|
print "\n".'<script type="text/javascript">';
|
|
|
|
|
print '$(document).ready(function () {
|
2020-12-07 11:42:35 +01:00
|
|
|
$("#apidoc").hide();
|
|
|
|
|
$("#apidoca").click(function() {
|
|
|
|
|
console.log("We click on apidoca show/hide");
|
|
|
|
|
$("#apidoc").show();
|
|
|
|
|
$("#apidoca").hide();
|
|
|
|
|
return false;
|
|
|
|
|
})
|
2017-09-15 13:43:16 +02:00
|
|
|
});';
|
2012-10-24 12:18:40 +02:00
|
|
|
print '</script>';
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-15 13:43:16 +02:00
|
|
|
print '<br><br>';
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$token = '';
|
2017-09-15 13:43:16 +02:00
|
|
|
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php';
|
|
|
|
|
|
2018-08-14 09:55:58 +02:00
|
|
|
// End of page
|
2012-10-24 12:18:40 +02:00
|
|
|
llxFooter();
|
2012-05-09 02:39:30 +02:00
|
|
|
$db->close();
|