dolibarr/htdocs/stripe/config.php

59 lines
2.0 KiB
PHP
Raw Normal View History

2017-04-18 05:44:08 +02:00
<?php
2017-04-22 06:58:44 +02:00
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Saasprov <saasprov@gmail.com>
2017-09-21 12:06:43 +02:00
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es.com>
2017-04-18 05:44:08 +02:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Set Stripe environment: set the ApiKey and AppInfo
2017-04-18 05:44:08 +02:00
*/
2017-04-22 06:58:44 +02:00
/**
* \file htdocs/stripe/config.php
2017-04-22 06:58:44 +02:00
* \ingroup Stripe
* \brief Page to move config in api
*/
2017-04-18 05:44:08 +02:00
2017-04-29 07:04:34 +02:00
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/lib/Stripe.php';
2017-04-18 05:44:08 +02:00
2017-05-14 05:26:19 +02:00
global $stripe;
global $conf;
2018-05-17 16:07:44 +02:00
global $stripearrayofkeysbyenv;
2017-05-14 05:26:19 +02:00
2018-05-17 16:07:44 +02:00
$stripearrayofkeysbyenv = array(
0=>array(
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
"publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
),
1=>array(
"secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY,
"publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
)
);
2017-05-08 06:52:30 +02:00
$stripearrayofkeys = array();
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
2017-05-08 06:52:30 +02:00
{
2018-06-15 15:29:19 +02:00
$stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
2017-05-08 06:52:30 +02:00
}
else
2017-05-08 06:52:30 +02:00
{
2018-06-15 15:29:19 +02:00
$stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
2017-05-08 06:52:30 +02:00
}
2017-04-18 05:44:08 +02:00
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
\Stripe\Stripe::setApiVersion("2018-11-08"); // force version API