From 7360e1c0d45a032b8d6f77ea2cb76c93b5214b0d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:19:21 +0100 Subject: [PATCH 1/4] Fix servicestatus list of payment stripe --- htdocs/stripe/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index bf8802f4c89..f9599984fd0 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -85,7 +85,7 @@ if (! empty($conf->stripe->enabled)) if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; - $servicestatus = 0; + $servicestatus = 1; } $stripe=new Stripe($db); From 232741d9198ba3525f4900ecca605c32948b5568 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:27:50 +0100 Subject: [PATCH 2/4] Update payment.php --- htdocs/stripe/payment.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index f9599984fd0..fd1b9fcc84b 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -78,19 +78,22 @@ if ($facid > 0) $ret=$object->fetch($facid); } -if (! empty($conf->stripe->enabled)) +if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; - $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) - { - $service = 'StripeLive'; - $servicestatus = 1; - } - - $stripe=new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } +else +{ + $service = 'StripeLive'; + $servicestatus = '1'; +} +$stripeacc = $stripe->getStripeAccount($service); +/*if (empty($stripeaccount)) +{ + print $langs->trans('ErrorStripeAccountNotDefined'); +}*/ // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paiementcard','globalcard')); From f027bd2b08b53bd4a67da0aa4043e44b189d8927 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:30:25 +0100 Subject: [PATCH 3/4] Update payment.php --- htdocs/stripe/payment.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index fd1b9fcc84b..bb6a6f1dbb2 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -98,7 +98,6 @@ $stripeacc = $stripe->getStripeAccount($service); // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paiementcard','globalcard')); - /* * Actions */ From b8df685186a839ae7ed6664ff7439591b1a479e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:11:53 +0100 Subject: [PATCH 4/4] Update payment.php --- htdocs/stripe/payment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index bb6a6f1dbb2..50d64521621 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -78,7 +78,12 @@ if ($facid > 0) $ret=$object->fetch($facid); } -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) +if (! empty($conf->stripe->enabled)) +{ + access_forbidden(); +} + +if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) { $service = 'StripeTest'; $servicestatus = '0';