From 77f92a5da32bb9949fc75f5e78db708caad92a08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Apr 2019 21:12:43 +0200 Subject: [PATCH] Update stripe.php --- htdocs/stripe/admin/stripe.php | 56 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 02471d57a76..3135592d528 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -215,7 +215,7 @@ if ( empty(GETPOST('status', 'alpha')) ) { } else { $endpoint->disabled = false; }} -$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 2); +$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 3); $endpoint->save(); if ($endpoint->status == 'enabled') { @@ -256,8 +256,8 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; - print ''; - print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; @@ -267,31 +267,31 @@ if (empty($conf->stripeconnect->enabled)) $out.= ajax_autoselect("onlinelivewebhookurl", 0); print '
'.$out; print ''; -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', 2); -$endpoint->save(); -if ($endpoint->status == 'enabled') -{ - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); -} -//print $endpoint; -} else print img_picto($langs->trans("inactive"), 'statut5'); - print ''; + 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 ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + } + else + { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + } + //print $endpoint; + } else print img_picto($langs->trans("inactive"), 'statut5'); + print ''; } else {