diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 100a85f6c30..5e2c27dd392 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -78,9 +78,6 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; @@ -97,9 +94,9 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error ++; // Stock decrement - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; + //$result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); + //if (! $result > 0) + // $error ++; // Payment token for URL $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -166,18 +163,12 @@ print "\n"; print ''; print ''; print $langs->trans("StripeLiveEnabled").''; -if (!empty($conf->global->STRIPE_LIVE)) -{ - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_LIVE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); + } print ''; if (empty($conf->stripeconnect->enabled)) @@ -195,9 +186,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; - print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; - print ''; + print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php?test', 2); + $out.= ''; + $out.= ajax_autoselect("onlinetestwebhookurl", 0); + print '
'.$out; print ''; } else { print ''.$langs->trans("StripeConnect").''; @@ -225,9 +221,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; - print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; - print ''; + print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php', 2); + $out.= ''; + $out.= ajax_autoselect("onlinelivewebhookurl", 0); + print '
'.$out; print ''; } else @@ -272,22 +273,42 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? print ''; } -// Minimal amount for force 3Dsecure if it's optionnal +// Activate Payment Request API +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; + print $langs->trans("STRIPE_PAYMENT_REQUEST_API").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); + } + print ''; +} + +// Activate SEPA DIRECT_DEBIT if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { print ''; - print $langs->trans("STRIPE_MINIMAL_3DSECURE").''; - print ''.$langs->getCurrencySymbol($conf->currency).''; + print $langs->trans("STRIPE_SEPA_DIRECT_DEBIT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); + } + print ''; } // Warehouse for automatic decrement -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? -{ - print ''; - print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; - print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); - print ''; -} +//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment +//{ +// print ''; +// print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; +// print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); +// print ''; +//} print ''; print $langs->trans("CSSUrlForPaymentForm").''; @@ -329,7 +350,12 @@ print ''; print ''; print $langs->trans("SecurityTokenIsUnique").''; -print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE", (empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE), 1); +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 ''; print '';