30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/stripe/lib/stripe.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
38$servicename =
'Stripe';
39$listofsupportedhooks = array();
41$listofsupportedhooks[] = array(
'code' =>
'payment_intent.payment_failed',
'status' => 1);
42$listofsupportedhooks[] = array(
'code' =>
'payment_intent.succeeded',
'status' => 1);
44$listofsupportedhooks[] = array(
'code' =>
'charge.dispute.closed',
'status' => 1);
45$listofsupportedhooks[] = array(
'code' =>
'charge.dispute.created',
'status' => 1);
46$listofsupportedhooks[] = array(
'code' =>
'charge.dispute.funds_withdrawn',
'status' => 1);
48$listofsupportedhooks[] = array(
'code' =>
'payout.create',
'status' =>
getDolGlobalString(
'STRIPE_AUTO_RECORD_PAYOUT') ? 1 : 0);
49$listofsupportedhooks[] = array(
'code' =>
'payout.paid',
'status' =>
getDolGlobalString(
'STRIPE_AUTO_RECORD_PAYOUT') ? 1 : 0);
62$langs->loadLangs(array(
'admin',
'other',
'paypal',
'stripe'));
64if (empty($user->admin)) {
67if (empty(
$conf->stripe->enabled)) {
71$action =
GETPOST(
'action',
'aZ09');
79if ($action ==
'setvalue' && $user->admin) {
82 if (empty(
$conf->stripeconnect->enabled)) {
100 if (!($result > 0)) {
104 if (!($result > 0)) {
108 if (!($result > 0)) {
112 if (!($result > 0)) {
117 if (!($result > 0)) {
121 if (!($result > 0)) {
125 if (!($result > 0)) {
129 if (!($result > 0)) {
139 if (!($result > 0)) {
142 $result =
dolibarr_set_const($db,
"ONLINE_PAYMENT_MESSAGE_FORM",
GETPOST(
'ONLINE_PAYMENT_MESSAGE_FORM',
'restricthtml'),
'chaine', 0,
'',
$conf->entity);
143 if (!($result > 0)) {
146 $result =
dolibarr_set_const($db,
"ONLINE_PAYMENT_MESSAGE_OK",
GETPOST(
'ONLINE_PAYMENT_MESSAGE_OK',
'restricthtml'),
'chaine', 0,
'',
$conf->entity);
147 if (!($result > 0)) {
150 $result =
dolibarr_set_const($db,
"ONLINE_PAYMENT_MESSAGE_KO",
GETPOST(
'ONLINE_PAYMENT_MESSAGE_KO',
'restricthtml'),
'chaine', 0,
'',
$conf->entity);
151 if (!($result > 0)) {
155 if (!($result > 0)) {
165 if (!($result > 0)) {
171 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
174 dol_print_error($db);
178if ($action ==
"setlive") {
182 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
184 setEventMessages($langs->trans(
"Error"),
null,
'errors');
194$form =
new Form($db);
197llxHeader(
'', $langs->trans(
"StripeSetup"));
199$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>';
205print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
206print
'<input type="hidden" name="token" value="'.newToken().
'">';
207print
'<input type="hidden" name="action" value="setvalue">';
208print
'<input type="hidden" name="page_y" value="">';
212$stripearrayofwebhookevents = array(
'account.updated',
'payout.created',
'payout.paid',
'charge.pending',
'charge.refunded',
'charge.succeeded',
'charge.failed',
'payment_intent.succeeded',
'payment_intent.payment_failed',
'payment_method.attached',
'payment_method.updated',
'payment_method.card_automatically_updated',
'payment_method.detached',
'source.chargeable',
'customer.deleted');
214print
'<div class="info">'.$langs->trans(
"StripeDesc").
"</div><br>\n";
216print
'<div class="div-table-responsive-no-min">';
217print
'<table class="noborder centpercent">';
218print
'<tr class="liste_titre">';
219print
'<td>'.$langs->trans(
"AccountParameter").
'</td>';
224print
'<tr class="oddeven">';
226print $langs->trans(
"StripeLiveEnabled").
'</td><td>';
227if (
$conf->use_javascript_ajax) {
228 print ajax_constantonoff(
'STRIPE_LIVE');
230 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
231 print $form->selectarray(
"STRIPE_LIVE", $arrval,
$conf->global->STRIPE_LIVE);
233print
'</td><td></td></tr>';
235if (empty(
$conf->stripeconnect->enabled)) {
236 print
'<tr class="oddeven"><td>';
237 print
'<span class="fieldrequired">'.$langs->trans(
"STRIPE_TEST_PUBLISHABLE_KEY").
'</span></td><td>';
238 print
'<input class="minwidth300" type="text" name="STRIPE_TEST_PUBLISHABLE_KEY" value="' .
getDolGlobalString(
'STRIPE_TEST_PUBLISHABLE_KEY').
'" placeholder="'.$langs->trans(
"Example").
': pk_test_xxxxxxxxxxxxxxxxxxxxxxxx">';
239 print
'</td><td></td></tr>';
241 print
'<tr class="oddeven"><td>';
242 print
'<span class="titlefield fieldrequired">'.$langs->trans(
"STRIPE_TEST_SECRET_KEY").
'</span></td><td>';
243 print
'<input class="minwidth300 input-icon-password" type="password" id="STRIPE_TEST_SECRET_KEY" name="STRIPE_TEST_SECRET_KEY" value="' .
getDolGlobalString(
'STRIPE_TEST_SECRET_KEY').
'" placeholder="'.$langs->trans(
"Example").
': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx">';
245 print
showEyeForField(
'eyeSTRIPE_TEST_SECRET_KEY',
'STRIPE_TEST_SECRET_KEY');
247 print
'</td><td></td></tr>';
249 print
'<tr class="oddeven"><td>';
250 print
'<span class="titlefield">'.$langs->trans(
"STRIPE_TEST_WEBHOOK_KEY").
'</span></td><td>';
252 print
'<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_ID" value="'.getDolGlobalString(
'STRIPE_TEST_WEBHOOK_ID').
'" placeholder="'.$langs->trans(
"Example").
': we_xxxxxxxxxxxxxxxxxxxxxxxx">';
255 print
'<input class="minwidth300 input-icon-password" type="password" id="STRIPE_TEST_WEBHOOK_KEY" name="STRIPE_TEST_WEBHOOK_KEY" value="'.getDolGlobalString(
'STRIPE_TEST_WEBHOOK_KEY').
'" placeholder="'.$langs->trans(
"Example").
': whsec_xxxxxxxxxxxxxxxxxxxxxxxx">';
257 print
showEyeForField(
'eyeSTRIPE_TEST_WEBHOOK_KEY',
'STRIPE_TEST_WEBHOOK_KEY');
259 $out = img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForTestWebhook").
'</span> ';
264 $out .=
'<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.
'" disabled>';
268 $messagepopup = $langs->trans(
'ListOfSupportedHooksToActivate').
':<br><br>';
269 foreach ($listofsupportedhooks as $val) {
270 $messagepopup .=
'<br>'.(empty($val[
'status']) ?
'<span class="opacitymedium">' :
'');
271 $messagepopup .= $val[
'code'];
272 $messagepopup .= (empty($val[
'status']) ?
' - '.$langs->trans(
"FeatureNotUsedAccordingtoSetup",
'Stripe').
'</span>' :
'');
275 print $form->textwithpicto(
'', $messagepopup, 1,
'help',
'valignmiddle', 0, 3,
'webhookscodetest');
282 $endpoint = \Stripe\WebhookEndpoint::retrieve(
getDolGlobalString(
'STRIPE_TEST_WEBHOOK_ID'));
283 $endpoint->enabled_events = $stripearrayofwebhookevents;
285 if (!
GETPOST(
'status',
'alpha')) {
286 $endpoint->disabled =
true;
288 $endpoint->disabled =
false;
291 $endpoint->url = $url;
295 if ($endpoint->status ==
'enabled') {
296 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=ipn&token='.
newToken().
'&webhook='.$endpoint->id.
'&status=0">';
297 print img_picto($langs->trans(
"Activated"),
'switch_on');
299 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=ipn&token='.
newToken().
'&webhook='.$endpoint->id.
'&status=1">';
300 print img_picto($langs->trans(
"Disabled"),
'switch_off');
303 print $e->getMessage();
306 print
'Bad value for the secret key. Reenter and save it again to fix this.';
309 print img_picto($langs->trans(
"Inactive"),
'statut5');
314 print
'<tr class="oddeven"><td>'.$langs->trans(
"StripeConnect").
'</td>';
315 print
'<td><b>'.$langs->trans(
"StripeConnect_Mode").
'</b><br>';
316 print $langs->trans(
"STRIPE_APPLICATION_FEE_PLATFORM").
' ';
321 print
'</td><td></td></tr>';
324if (empty(
$conf->stripeconnect->enabled)) {
325 print
'<tr class="oddeven"><td>';
326 print
'<span class="fieldrequired">'.$langs->trans(
"STRIPE_LIVE_PUBLISHABLE_KEY").
'</span></td><td>';
327 print
'<input class="minwidth300" type="text" name="STRIPE_LIVE_PUBLISHABLE_KEY" value="'.getDolGlobalString(
'STRIPE_LIVE_PUBLISHABLE_KEY').
'" placeholder="'.$langs->trans(
"Example").
': pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" spellcheck="false">';
328 print
'</td><td></td></tr>';
330 print
'<tr class="oddeven"><td>';
331 print
'<span class="fieldrequired">'.$langs->trans(
"STRIPE_LIVE_SECRET_KEY").
'</span></td><td>';
332 print
'<input class="minwidth300 input-icon-password" type="password" id="STRIPE_LIVE_SECRET_KEY" name="STRIPE_LIVE_SECRET_KEY" value="'.getDolGlobalString(
'STRIPE_LIVE_SECRET_KEY').
'" placeholder="'.$langs->trans(
"Example").
': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx" spellcheck="false">';
334 print
showEyeForField(
'eyeSTRIPE_LIVE_SECRET_KEY',
'STRIPE_LIVE_SECRET_KEY');
336 print
'</td><td></td></tr>';
338 print
'<tr class="oddeven"><td>';
339 print
'<span class="titlefield">'.$langs->trans(
"STRIPE_LIVE_WEBHOOK_KEY").
'</span></td><td>';
341 print
'<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_ID" value="'.getDolGlobalString(
'STRIPE_LIVE_WEBHOOK_ID').
'" placeholder="'.$langs->trans(
"Example").
': we_xxxxxxxxxxxxxxxxxxxxxxxx" spellcheck="false">';
344 print
'<input class="minwidth300 input-icon-password" type="password" id="STRIPE_LIVE_WEBHOOK_KEY" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.getDolGlobalString(
'STRIPE_LIVE_WEBHOOK_KEY').
'" placeholder="'.$langs->trans(
"Example").
': whsec_xxxxxxxxxxxxxxxxxxxxxxxx" spellcheck="false">';
346 print
showEyeForField(
'eyeSTRIPE_LIVE_WEBHOOK_KEY',
'STRIPE_LIVE_WEBHOOK_KEY');
348 $out = img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForLiveWebhook").
'</span> ';
352 $out .=
'<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.
'" disabled>';
357 $messagepopup = $langs->trans(
'ListOfSupportedHooksToActivate').
':<br><br>';
358 foreach ($listofsupportedhooks as $val) {
359 $messagepopup .=
'<br>'.(empty($val[
'status']) ?
'<span class="opacitymedium">' :
'');
360 $messagepopup .= $val[
'code'];
361 $messagepopup .= (empty($val[
'status']) ?
' - '.$langs->trans(
"FeatureNotUsedAccordingtoSetup",
'Stripe').
'</span>' :
'');
364 print $form->textwithpicto(
'', $messagepopup, 1,
'help',
'valignmiddle', 0, 3,
'webhookscodeprod');
371 $endpoint = \Stripe\WebhookEndpoint::retrieve(
getDolGlobalString(
'STRIPE_LIVE_WEBHOOK_ID'));
372 $endpoint->enabled_events = $stripearrayofwebhookevents;
374 if (empty(
GETPOST(
'status',
'alpha'))) {
375 $endpoint->disabled =
true;
377 $endpoint->disabled =
false;
380 $endpoint->url = $url;
383 if ($endpoint->status ==
'enabled') {
384 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=ipn&token='.
newToken().
'&webhook='.$endpoint->id.
'&status=0">';
385 print img_picto($langs->trans(
"Activated"),
'switch_on');
387 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=ipn&token='.
newToken().
'&webhook='.$endpoint->id.
'&status=1">';
388 print img_picto($langs->trans(
"Disabled"),
'switch_off');
391 print $e->getMessage();
395 print img_picto($langs->trans(
"Inactive"),
'statut5');
407print
'<div class="div-table-responsive-no-min">';
408print
'<table class="noborder centpercent">';
409print
'<tr class="liste_titre">';
410print
'<td>'.$langs->trans(
"UsageParameter").
'</td>';
414print
'<tr class="oddeven"><td>';
415print $langs->trans(
"PublicVendorName").
'</td><td>';
416print
'<input class="minwidth300" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.getDolGlobalString(
'ONLINE_PAYMENT_CREDITOR').
'" placeholder="'.dolPrintHTMLForAttribute(
$mysoc->name).
'">';
419print
'<tr class="oddeven"><td>';
420print $langs->trans(
"BankAccount").
'</td><td>';
421print img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
422$form->select_comptes(
getDolGlobalString(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'),
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0,
'', 1);
427 print
'<tr class="oddeven"><td>';
428 print $langs->trans(
"STRIPE_CARD_PRESENT").
'</td><td>';
429 if (
$conf->use_javascript_ajax) {
430 print ajax_constantonoff(
'STRIPE_CARD_PRESENT');
432 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
433 print $form->selectarray(
"STRIPE_CARD_PRESENT", $arrval,
$conf->global->STRIPE_CARD_PRESENT);
440 print
'<tr class="oddeven"><td>';
441 print $langs->trans(
"TERMINAL_LOCATION").
'</td><td>';
442 $service =
'StripeTest';
445 $service =
'StripeLive';
450 global $stripearrayofkeysbyenv;
451 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'secret_key'];
452 if (!empty($site_account)) {
453 \Stripe\Stripe::setApiKey($site_account);
456 $service =
'StripeTest';
457 $servicestatus =
'0';
458 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning');
460 $service =
'StripeLive';
461 $servicestatus =
'1';
463 $stripe =
new Stripe($db);
464 if (!empty($site_account)) {
466 $stripeacc = $stripe->getStripeAccount($service);
468 $locations = \Stripe\Terminal\Location::all(
null, array(
"stripe_account" => $stripeacc));
470 $locations = \Stripe\Terminal\Location::all();
474 print $e->getMessage().
'<br>';
479 $location[
""] = $langs->trans(
"NotDefined");
480 if (!empty($locations)) {
481 foreach ($locations as $tmplocation) {
482 $location[$tmplocation->id] = $tmplocation->display_name;
486 print $form->selectarray(
"STRIPE_LOCATION", $location,
getDolGlobalString(
'STRIPE_LOCATION'));
490print
'<tr class="oddeven"><td>';
491print $langs->trans(
"STRIPE_SEPA_DIRECT_DEBIT").
'</td><td>';
492if (
$conf->use_javascript_ajax) {
493 print ajax_constantonoff(
'STRIPE_SEPA_DIRECT_DEBIT');
495 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
496 print $form->selectarray(
"STRIPE_SEPA_DIRECT_DEBIT", $arrval,
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT'));
500print
'<tr class="oddeven"><td>';
501print $langs->trans(
"STRIPE_SEPA_CREDIT_TRANSFER").
'</td><td>';
502if (
$conf->use_javascript_ajax) {
503 print ajax_constantonoff(
'STRIPE_SEPA_CREDIT_TRANSFER');
505 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
506 print $form->selectarray(
"STRIPE_SEPA_CREDIT_TRANSFER", $arrval,
getDolGlobalString(
'STRIPE_SEPA_CREDIT_TRANSFER'));
513 print
'<tr class="oddeven"><td>';
514 print $langs->trans(
"STRIPE_KLARNA").
'</td><td>';
515 if (
$conf->use_javascript_ajax) {
516 print ajax_constantonoff(
'STRIPE_KLARNA');
518 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
519 print $form->selectarray(
"STRIPE_KLARNA", $arrval,
$conf->global->STRIPE_KLARNA);
526 print
'<tr class="oddeven"><td>';
527 print $langs->trans(
"STRIPE_BANCONTACT").
'</td><td>';
528 if (
$conf->use_javascript_ajax) {
529 print ajax_constantonoff(
'STRIPE_BANCONTACT');
531 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
532 print $form->selectarray(
"STRIPE_BANCONTACT", $arrval,
$conf->global->STRIPE_BANCONTACT);
534 print
' <span class="opacitymedium">'.$langs->trans(
"ExampleOnlyForBECustomers").
'</span>';
540 print
'<tr class="oddeven"><td>';
541 print $langs->trans(
"STRIPE_IDEAL").
'</td><td>';
542 if (
$conf->use_javascript_ajax) {
543 print ajax_constantonoff(
'STRIPE_IDEAL');
545 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
546 print $form->selectarray(
"STRIPE_IDEAL", $arrval,
$conf->global->STRIPE_SEPA_DIRECT_DEBIT);
548 print
' <span class="opacitymedium">'.$langs->trans(
"ExampleOnlyForNLCustomers").
'</span>';
554 print
'<tr class="oddeven"><td>';
555 print $langs->trans(
"STRIPE_GIROPAY").
'</td><td>';
556 if (
$conf->use_javascript_ajax) {
557 print ajax_constantonoff(
'STRIPE_GIROPAY');
559 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
560 print $form->selectarray(
"STRIPE_GIROPAY", $arrval,
$conf->global->STRIPE_GIROPAY);
562 print
' <span class="opacitymedium">'.$langs->trans(
"ExampleOnlyForDECustomers").
'</span>';
568 print
'<tr class="oddeven"><td>';
569 print $langs->trans(
"STRIPE_SOFORT").
'</td><td>';
570 if (
$conf->use_javascript_ajax) {
571 print ajax_constantonoff(
'STRIPE_SOFORT');
573 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
574 print $form->selectarray(
"STRIPE_SOFORT", $arrval,
$conf->global->STRIPE_SOFORT);
576 print
' <span class="opacitymedium">'.$langs->trans(
"ExampleOnlyForATBEDEITNLESCustomers").
'</span>';
580print
'<tr class="oddeven"><td>';
581print $langs->trans(
"CSSUrlForPaymentForm").
'</td><td>';
582print
'<input class="width500" type="text" name="ONLINE_PAYMENT_CSS_URL" value="' .
getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'" spellcheck="false">';
583print
' <span class="opacitymedium">'.$langs->trans(
"Example").
': http://mysite/mycss.css</span>';
586print
'<tr class="oddeven"><td>';
587print $langs->trans(
"MessageForm").
'</td><td>';
588$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_FORM',
getDolGlobalString(
"ONLINE_PAYMENT_MESSAGE_FORM"),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_2,
'90%');
592print
'<tr class="oddeven"><td>';
593print $langs->trans(
"MessageOK").
'</td><td>';
594$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_OK',
getDolGlobalString(
"ONLINE_PAYMENT_MESSAGE_OK"),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_2,
'90%');
598print
'<tr class="oddeven"><td>';
599print $langs->trans(
"MessageKO").
'</td><td>';
600$doleditor =
new DolEditor(
'ONLINE_PAYMENT_MESSAGE_KO',
getDolGlobalString(
"ONLINE_PAYMENT_MESSAGE_KO"),
'', 100,
'dolibarr_details',
'In',
false,
true,
true, ROWS_2,
'90%');
604print
'<tr class="oddeven"><td>';
605print $langs->trans(
"ONLINE_PAYMENT_SENDEMAIL").
'</td><td>';
606print img_picto(
'',
'email',
'class="pictofixedwidth"');
607print
'<input class="minwidth200" type="text" name="ONLINE_PAYMENT_SENDEMAIL" value="' .
getDolGlobalString(
'ONLINE_PAYMENT_SENDEMAIL').
'">';
608print
' <span class="opacitymedium small">'.$langs->trans(
"Example").
': myemail@myserver.com, Payment service <myemail2@myserver2.com></span>';
617print
'<div class="div-table-responsive-no-min">';
618print
'<table class="noborder centpercent">';
619print
'<tr class="liste_titre">';
620print
'<td>Payout</td>';
621print
'<td class="width300"></td>';
627print
'<tr class="oddeven"><td>';
628print $form->textwithpicto($langs->trans(
"StripeAutoRecordPayout"),
'<span class="opacitymedium">'.$langs->trans(
"StripeAutoRecordPayout2",
"payout.created | payout.failed | payout.paid").
'</span>');
631if (
$conf->use_javascript_ajax) {
632 print ajax_constantonoff(
'STRIPE_AUTO_RECORD_PAYOUT', array(),
null, 0, 0, 1);
634 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
635 print $form->selectarray(
"STRIPE_AUTO_RECORD_PAYOUT", $arrval,
getDolGlobalInt(
'STRIPE_AUTO_RECORD_PAYOUT'));
639print
'<tr class="oddeven"><td>';
640print $langs->trans(
"StripeUserAccountForActions").
'</td><td>';
641print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
getDolGlobalString(
'STRIPE_USER_ACCOUNT_FOR_ACTIONS'),
'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0);
645 print
'<tr class="oddeven"><td>';
646 print $langs->trans(
"BankAccountForBankTransfer").
'</td><td>';
647 print img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
648 $form->select_comptes(
getDolGlobalString(
'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS'),
'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0,
'', 1);
657print
'<div class="div-table-responsive-no-min">';
658print
'<table class="noborder centpercent">';
660print
'<tr class="liste_titre">';
661print
'<td>'.$langs->trans(
"UrlGenerationParameters").
'</td>';
666print
'<tr class="oddeven"><td>';
667print $langs->trans(
"SecurityToken").
'</td><td>';
668print
'<input class="minwidth300" type="text" id="PAYMENT_SECURITY_TOKEN" name="PAYMENT_SECURITY_TOKEN" value="' .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
'" spellcheck="false">';
669if (!empty(
$conf->use_javascript_ajax)) {
670 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_token" class="linkobject"');
673 $langs->load(
"errors");
674 print img_warning($langs->trans(
"WarningTheHiddenOptionIsOn",
'PAYMENT_SECURITY_ACCEPT_ANY_TOKEN'),
'',
'pictowarning marginleftonly');
683print $form->buttonsSaveCancel(
"Save",
'', array(),
false,
'reposition');
691include DOL_DOCUMENT_ROOT.
'/core/tpl/onlinepaymentlinks.tpl.php';
694print
info_admin($langs->trans(
"ExampleOfTestCreditCard",
'4242424242424242 (no 3DSecure) or 4000000000003063 (3DSecure required) or 4000002760003184 (3DSecure2 required on all transaction) or 4000003800000446 (3DSecure2 required, the off-session allowed)',
'4000000000000101',
'4000000000000069',
'4000000000000341').
'. '.$langs->trans(
'SeeAlso',
'https://docs.stripe.com/testing?testing-method=card-numbers'));
697 print
info_admin($langs->trans(
"ExampleOfTestBankAcountForSEPA",
'AT611904300234573201 (pending->succeed) or AT861904300235473202 (pending->failed)').
'. '.$langs->trans(
'SeeAlso',
'https://docs.stripe.com/testing?payment-method=sepa-direct-debit'));
702if (!empty(
$conf->use_javascript_ajax)) {
703 print
"\n".
'<script type="text/javascript">';
704 print
'$(document).ready(function () {
706 $("#apidoca").click(function() {
707 console.log("We click on apidoca show/hide");
709 $("#apidoca").hide();
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage a WYSIWYG editor.
Stripe class @TODO No reason to extend CommonObject.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
utf8_check($str)
Check if a string is in UTF8.
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.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
showEyeForField($htmlname, $htmlnameofinput)
Output the eye picto to show/hide a password HTML field.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stripeadmin_prepare_head()
Define head array for tabs of stripe tools setup pages.