dolibarr  16.0.5
config.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  * Copyright (C) 2017 Saasprov <saasprov@gmail.com>
4  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es.com>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  *
19  * Set Stripe environment: set the ApiKey and AppInfo
20  */
21 
28 require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php';
29 require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/lib/Stripe.php';
30 
31 //global $stripe;
32 global $conf;
33 global $stripearrayofkeysbyenv;
34 
35 $stripearrayofkeysbyenv = array(
36  0=>array(
37  "secret_key" => empty($conf->global->STRIPE_TEST_SECRET_KEY) ? '' : $conf->global->STRIPE_TEST_SECRET_KEY,
38  "publishable_key" => empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
39  ),
40  1=>array(
41  "secret_key" => empty($conf->global->STRIPE_LIVE_SECRET_KEY) ? '' : $conf->global->STRIPE_LIVE_SECRET_KEY,
42  "publishable_key" => empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
43  )
44 );
45 
46 $stripearrayofkeys = array();
47 if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) {
48  $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
49 } else {
50  $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
51 }
52 
53 \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
54 \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
55 \Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION) ? "2020-08-27" : $conf->global->STRIPE_FORCE_VERSION); // force version API
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484