diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 82a0ad525ef..d889041be60 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -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') { diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 3135592d528..134030687df 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -165,7 +165,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; print ''; @@ -177,7 +177,7 @@ print $langs->trans("StripeLiveEnabled").''; +print ''; if (empty($conf->stripeconnect->enabled)) { @@ -195,41 +195,52 @@ if (empty($conf->stripeconnect->enabled)) print ''; + 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 ''; + 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 { print ''; print ''; - print ''; + print ''; } if (empty($conf->stripeconnect->enabled)) @@ -256,47 +267,58 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; } else { print ''; - print ''; + print ''; }
'.$langs->trans("AccountParameter").''.$langs->trans("Value").''.$langs->trans("Status").'
'; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); } -print '
'; print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; - print ''; - print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + } print ''; 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.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); - print '
'.$out; + print '
'.$out; print '
'; -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 ''; - 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'
'.$langs->trans("StripeConnect").''.$langs->trans("StripeConnect_Mode").'
'; @@ -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).'
'; - print ''; - print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").'
'; + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + } print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php', 3); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); - print '
'.$out; + 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', 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'); + 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 ''; + 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 '
'.$langs->trans("StripeConnect").''.$langs->trans("StripeConnect_Mode").'
'.$langs->trans("StripeConnect_Mode").'