mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Stabilize code to prepare beta freeze.
This commit is contained in:
parent
b8a72cec2f
commit
2e277d643d
|
|
@ -144,7 +144,7 @@ $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
|||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
|
||||
dol_syslog("Stripe IPN was calle with event->type = ".$event->type);
|
||||
dol_syslog("Stripe IPN was called with event->type = ".$event->type);
|
||||
|
||||
|
||||
if ($event->type == 'payout.created') {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ print '<table class="noborder" width="100%">';
|
|||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("AccountParameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -177,7 +177,7 @@ print $langs->trans("StripeLiveEnabled").'</td><td>';
|
|||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td><td></td></tr>';
|
||||
|
||||
if (empty($conf->stripeconnect->enabled))
|
||||
{
|
||||
|
|
@ -195,41 +195,52 @@ if (empty($conf->stripeconnect->enabled))
|
|||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<span class="titlefield fieldrequired">'.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").'</span></td><td>';
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_ID" value="'.$conf->global->STRIPE_TEST_WEBHOOK_ID.'">';
|
||||
print ' '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_ID" value="'.$conf->global->STRIPE_TEST_WEBHOOK_ID.'">';
|
||||
print ' '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx<br>';
|
||||
}
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.$conf->global->STRIPE_TEST_WEBHOOK_KEY.'">';
|
||||
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' ';
|
||||
$url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$out.= '<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.'">';
|
||||
$out.= ajax_autoselect("onlinetestwebhookurl", 0);
|
||||
print '<br />'.$out;
|
||||
print '<br>'.$out;
|
||||
print '</td><td>';
|
||||
if ( !empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STRIPE_TEST_SECRET_KEY) && !empty($conf->global->STRIPE_TEST_WEBHOOK_ID) ) {
|
||||
\Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY);
|
||||
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID);
|
||||
$endpoint->enabled_events = $stripearrayofwebhookevents;
|
||||
if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) {
|
||||
if ( empty(GETPOST('status', 'alpha')) ) {
|
||||
$endpoint->disabled = true;
|
||||
} else {
|
||||
$endpoint->disabled = false;
|
||||
}}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled')
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
}
|
||||
//print $endpoint;
|
||||
} else print img_picto($langs->trans("inactive"), 'statut5');
|
||||
print'</td></tr>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
if (!empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STRIPE_TEST_SECRET_KEY) && !empty($conf->global->STRIPE_TEST_WEBHOOK_ID))
|
||||
{
|
||||
\Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY);
|
||||
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID);
|
||||
$endpoint->enabled_events = $stripearrayofwebhookevents;
|
||||
if (GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID) {
|
||||
if (empty(GETPOST('status', 'alpha'))) {
|
||||
$endpoint->disabled = true;
|
||||
} else {
|
||||
$endpoint->disabled = false;
|
||||
}
|
||||
}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled')
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
}
|
||||
//print $endpoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto($langs->trans("inactive"), 'statut5');
|
||||
}
|
||||
}
|
||||
print'</td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("StripeConnect").'</td>';
|
||||
print '<td><b>'.$langs->trans("StripeConnect_Mode").'</b><br/>';
|
||||
|
|
@ -238,7 +249,7 @@ else
|
|||
print '% + ';
|
||||
print price($conf->global->STRIPE_APPLICATION_FEE);
|
||||
print ' '.$langs->getCurrencySymbol($conf->currency).' '.$langs->trans("minimum").' '.price($conf->global->STRIPE_APPLICATION_FEE_MINIMAL).' '.$langs->getCurrencySymbol($conf->currency).' </td></tr>';
|
||||
print '</td></tr>';
|
||||
print '</td><td></td></tr>';
|
||||
}
|
||||
|
||||
if (empty($conf->stripeconnect->enabled))
|
||||
|
|
@ -256,47 +267,58 @@ if (empty($conf->stripeconnect->enabled))
|
|||
print '</td><td></td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_ID" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_ID.'">';
|
||||
print ' '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx<br>';
|
||||
print '<span class="titlefield fieldrequired">'.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").'</span></td><td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_ID" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_ID.'">';
|
||||
print ' '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx<br>';
|
||||
}
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_KEY.'">';
|
||||
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' ';
|
||||
$url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
$out.= '<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.'">';
|
||||
$out.= ajax_autoselect("onlinelivewebhookurl", 0);
|
||||
print '<br />'.$out;
|
||||
print '<br>'.$out;
|
||||
print '</td><td>';
|
||||
if ( !empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STRIPE_LIVE_SECRET_KEY) && !empty($conf->global->STRIPE_LIVE_WEBHOOK_ID) ) {
|
||||
\Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY);
|
||||
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID);
|
||||
$endpoint->enabled_events = $stripearrayofwebhookevents;
|
||||
if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) {
|
||||
if ( empty(GETPOST('status', 'alpha')) ) {
|
||||
$endpoint->disabled = true;
|
||||
} else {
|
||||
$endpoint->disabled = false;
|
||||
}}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled')
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
}
|
||||
//print $endpoint;
|
||||
} else print img_picto($langs->trans("inactive"), 'statut5');
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
if (!empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STRIPE_LIVE_SECRET_KEY) && !empty($conf->global->STRIPE_LIVE_WEBHOOK_ID))
|
||||
{
|
||||
\Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY);
|
||||
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID);
|
||||
$endpoint->enabled_events = $stripearrayofwebhookevents;
|
||||
if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) {
|
||||
if ( empty(GETPOST('status', 'alpha')) ) {
|
||||
$endpoint->disabled = true;
|
||||
} else {
|
||||
$endpoint->disabled = false;
|
||||
}
|
||||
}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled')
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
}
|
||||
//print $endpoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto($langs->trans("inactive"), 'statut5');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("StripeConnect").'</td>';
|
||||
print '<td>'.$langs->trans("StripeConnect_Mode").'</td></tr>';
|
||||
print '<td>'.$langs->trans("StripeConnect_Mode").'</td><td></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user