Update stripe.php

This commit is contained in:
ptibogxiv 2019-04-24 13:51:41 +02:00 committed by GitHub
parent 57ce70bbc9
commit 6d06f128e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,9 +205,9 @@ if ( !empty($conf->global->STRIPE_TEST_WEBHOOK_KEY) && !empty($conf->global->STR
\Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY); \Stripe\Stripe::setApiKey($conf->global->STRIPE_TEST_SECRET_KEY);
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID); $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID);
$endpoint->enabled_events = $stripearrayofwebhookevents; $endpoint->enabled_events = $stripearrayofwebhookevents;
if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) { if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID ) {
if ( empty( GETPOST('status','alpha') )) { if ( empty( GETPOST('status', 'alpha') )) {
$endpoint->disabled = true; $endpoint->disabled = true;
} else { } else {
$endpoint->disabled = false; $endpoint->disabled = false;
}} }}
@ -216,15 +216,15 @@ $endpoint->save();
if ($endpoint->status == 'enabled') if ($endpoint->status == 'enabled')
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
} }
//print $endpoint; //print $endpoint;
} else print img_picto($langs->trans("inactive"),'statut5'); } else print img_picto($langs->trans("inactive"), 'statut5');
print'</td></tr>'; print'</td></tr>';
} else { } else {
print '<tr class="oddeven"><td>'.$langs->trans("StripeConnect").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("StripeConnect").'</td>';
@ -267,8 +267,8 @@ if ( !empty($conf->global->STRIPE_LIVE_WEBHOOK_KEY) && !empty($conf->global->STR
\Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY); \Stripe\Stripe::setApiKey($conf->global->STRIPE_LIVE_SECRET_KEY);
$endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID); $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_LIVE_WEBHOOK_ID);
$endpoint->enabled_events = $stripearrayofwebhookevents; $endpoint->enabled_events = $stripearrayofwebhookevents;
if ( GETPOST('webhook','alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) { if ( GETPOST('webhook', 'alpha') == $conf->global->STRIPE_LIVE_WEBHOOK_ID ) {
if ( empty( GETPOST('status','alpha') )) { if ( empty( GETPOST('status', 'alpha') )) {
$endpoint->disabled = true; $endpoint->disabled = true;
} else { } else {
$endpoint->disabled = false; $endpoint->disabled = false;
@ -278,15 +278,15 @@ $endpoint->save();
if ($endpoint->status == 'enabled') if ($endpoint->status == 'enabled')
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=1">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
} }
//print $endpoint; //print $endpoint;
} else print img_picto($langs->trans("inactive"),'statut5'); } else print img_picto($langs->trans("inactive"), 'statut5');
print '</td></tr>'; print '</td></tr>';
} }
else else