29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypal.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
35$servicename =
'PayPal';
47$langs->loadLangs(array(
'admin',
'other',
'paypal',
'stripe'));
53$action =
GETPOST(
'action',
'aZ09');
56if ($action ==
'setvalue' && $user->admin) {
100 if (!($result > 0)) {
104 if (!($result > 0)) {
108 if (!($result > 0)) {
113 if (!($result > 0)) {
126if ($action ==
"setlive") {
146llxHeader(
'', $langs->trans(
"PaypalSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-paypal page-admin_paypal');
149$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
154print
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
155print
'<input type="hidden" name="token" value="'.newToken().
'">';
156print
'<input type="hidden" name="action" value="setvalue">';
161print
'<span class="opacitymedium">'.$langs->trans(
"PaypalDesc").
"</span><br>\n";
164if (!function_exists(
'curl_version')) {
165 $langs->load(
"errors");
166 setEventMessages($langs->trans(
"ErrorPhpCurlNotInstalled"),
null,
'errors');
172print
'<div class="div-table-responsive-no-min">';
173print
'<table class="noborder centpercent">';
176print
'<tr class="liste_titre">';
177print
'<td>'.$langs->trans(
"AccountParameter").
'</td>';
178print
'<td>'.$langs->trans(
"Value").
'</td>';
181print
'<tr class="oddeven">';
183print $langs->trans(
"PaypalLiveEnabled").
'</td><td>';
185 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setlive&token='.newToken().
'&value=0">';
186 print
img_picto($langs->trans(
"Activated"),
'switch_on');
188 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setlive&token='.newToken().
'&value=1">';
189 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
193print
'<tr class="oddeven"><td class="fieldrequired">';
194print $langs->trans(
"PAYPAL_API_USER").
'</td><td>';
195print
'<input size="32" type="text" name="PAYPAL_API_USER" value="'.getDolGlobalString(
'PAYPAL_API_USER').
'">';
196print
' <span class="opacitymedium">'.$langs->trans(
"Example").
': admin-facilitator_api1.example.com, paypal_api1.mywebsite.com</span>';
200print
'<tr class="oddeven"><td class="fieldrequired">';
201print $langs->trans(
"PAYPAL_API_PASSWORD").
'</td><td>';
202print
'<input size="32" type="text" name="PAYPAL_API_PASSWORD" value="'.getDolGlobalString(
'PAYPAL_API_PASSWORD').
'">';
206print
'<tr class="oddeven"><td class="fieldrequired">';
207print $langs->trans(
"PAYPAL_API_SIGNATURE").
'</td><td>';
208print
'<input size="64" type="text" name="PAYPAL_API_SIGNATURE" value="'.getDolGlobalString(
'PAYPAL_API_SIGNATURE').
'">';
209print
'<br><span class="opacitymedium">'.$langs->trans(
"Example").
': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF</span>';
213print
'<tr class="oddeven"><td>';
214print $langs->trans(
"PAYPAL_SSLVERSION").
'</td><td>';
215print $form->selectarray(
"PAYPAL_SSLVERSION", array(
'1'=> $langs->trans(
'TLSv1'),
'6'=> $langs->trans(
'TLSv1.2')),
getDolGlobalString(
'PAYPAL_SSLVERSION'));
224print
'<div class="div-table-responsive-no-min">';
225print
'<table class="noborder centpercent">';
228print
'<tr class="liste_titre">';
229print
'<td>'.$langs->trans(
"UsageParameter").
'</td>';
230print
'<td>'.$langs->trans(
"Value").
'</td>';
234print
'<tr class="oddeven"><td>';
235print $langs->trans(
"PAYPAL_API_INTEGRAL_OR_PAYPALONLY").
'</td><td>';
236print $form->selectarray(
"PAYPAL_API_INTEGRAL_OR_PAYPALONLY", array(
'integral'=> $langs->trans(
'PaypalModeIntegral'),
'paypalonly'=> $langs->trans(
'PaypalModeOnlyPaypal')),
getDolGlobalString(
'PAYPAL_API_INTEGRAL_OR_PAYPALONLY'));
247print
'<tr class="oddeven"><td>';
248print $langs->trans(
"PublicVendorName").
'</td><td>';
249print
'<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.getDolGlobalString(
'ONLINE_PAYMENT_CREDITOR').
'">';
250print
' <span class="opacitymedium">'.$langs->trans(
"Example").
': '.
$mysoc->name.
'</span>';
254 print
'<tr class="oddeven"><td>';
255 print $langs->trans(
"BankAccount").
'</td><td>';
257 $form->select_comptes(
getDolGlobalString(
'PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS'),
'PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS', 0,
'', 1);
261print
'<tr class="oddeven"><td>';
262print $langs->trans(
"CSSUrlForPaymentForm").
'</td><td>';
263print
'<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'">';
264print
' <span class="opacitymedium">'.$langs->trans(
"Example").
': https://mysite/mycss.css</span>';
268print
'<tr class="oddeven"><td>';
269print $langs->trans(
"PAYPAL_ADD_PAYMENT_URL").
'</td><td>';
270print $form->selectyesno(
"PAYPAL_ADD_PAYMENT_URL",
getDolGlobalString(
'PAYPAL_ADD_PAYMENT_URL'), 1);
274print
'<tr class="oddeven"><td>';
275print $langs->trans(
"MessageForm").
'</td><td>';
276$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_FORM',
getDolGlobalString(
'ONLINE_PAYMENT_MESSAGE_FORM'),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_4,
'90%');
281print
'<tr class="oddeven"><td>';
282print $langs->trans(
"MessageOK").
'</td><td>';
283$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_OK',
getDolGlobalString(
'ONLINE_PAYMENT_MESSAGE_OK'),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_4,
'90%');
288print
'<tr class="oddeven"><td>';
289print $langs->trans(
"MessageKO").
'</td><td>';
290$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_KO',
getDolGlobalString(
'ONLINE_PAYMENT_MESSAGE_KO'),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_4,
'90%');
295print
'<tr class="oddeven"><td>';
296print $langs->trans(
"ONLINE_PAYMENT_SENDEMAIL").
'</td><td>';
297print
'<input class="minwidth200" type="text" name="ONLINE_PAYMENT_SENDEMAIL" value="'.getDolGlobalString(
'ONLINE_PAYMENT_SENDEMAIL').
'">';
298print
' <span class="opacitymedium">'.$langs->trans(
"Example").
': myemail@myserver.com, Payment service <myemail2@myserver2.com></span>';
306print
'<div class="div-table-responsive-no-min">';
307print
'<table class="noborder centpercent">';
309print
'<tr class="liste_titre">';
310print
'<td>'.$langs->trans(
"UrlGenerationParameters").
'</td>';
311print
'<td>'.$langs->trans(
"Value").
'</td>';
315print
'<tr class="oddeven"><td>';
316print $langs->trans(
"SecurityToken").
'</td><td>';
317print
'<input class="minwidth300" type="text" id="PAYMENT_SECURITY_TOKEN" name="PAYMENT_SECURITY_TOKEN" value="'.getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
'">';
318if (!empty(
$conf->use_javascript_ajax)) {
319 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_token" class="linkobject"');
322 $langs->load(
"errors");
323 print
img_warning($langs->trans(
"WarningTheHiddenOptionIsOn",
'PAYMENT_SECURITY_ACCEPT_ANY_TOKEN'),
'',
'pictowarning marginleftonly');
332print $form->buttonsSaveCancel(
"Save",
'');
339print
'<u>'.$langs->trans(
"InformationToFindParameters",
"Paypal").
'</u>:<br>';
340if (!empty(
$conf->use_javascript_ajax)) {
341 print
'<a class="reposition" id="apidoca">'.$langs->trans(
"ClickHere").
'...</a>';
344$realpaypalurl =
'www.paypal.com';
345$sandboxpaypalurl =
'developer.paypal.com';
347print
'<div id="apidoc">';
348print
'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>
3491. 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>
3502. Click the "Profile" or "Preferencies" subtab located under the My Account heading.<br>
3513. Click the link "API Access".<br>
3524. Click the View API Certificate link in the right column.<br>
3535. Click the Request API signature radio button on the Request API Credentials page.<br>
3546. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.<br>
3557. Save the values for API Username, Password and Signature (make sure this long character signature is copied).<br>
3568. Click the "Modify" button after copying your API Username, Password, and Signature.
360if (!empty(
$conf->use_javascript_ajax)) {
362 <script type="text/javascript">
363 $(document).ready(function () {
365 $("#apidoca").click(function() {
366 console.log("We click on apidoca so we show/hide");
368 $("#apidoca").hide();
380include DOL_DOCUMENT_ROOT.
'/core/tpl/onlinepaymentlinks.tpl.php';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
paypaladmin_prepare_head()
Define head array for tabs of paypal tools setup pages.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.