dolibarr/htdocs/paypal/lib/paypalfunctions.lib.php

72 lines
2.8 KiB
PHP
Raw Permalink Normal View History

2011-09-29 20:06:14 +02:00
<?php
2024-12-11 20:38:48 +01:00
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
2011-09-21 15:05:32 +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
2011-09-21 15:05:32 +02:00
* (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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2011-09-21 15:05:32 +02:00
*/
/**
* \file htdocs/paypal/lib/paypalfunctions.lib.php
* \ingroup paypal
* \brief Page with Paypal init var.
*/
2021-02-26 15:27:05 +01:00
if (session_id() == "") {
session_start();
2021-02-26 15:27:05 +01:00
if (ini_get('register_globals')) { // To solve bug in using $_SESSION
foreach ($_SESSION as $key => $value) {
if (isset($GLOBALS[$key])) {
unset($GLOBALS[$key]);
}
}
}
}
2011-09-21 15:05:32 +02:00
// ==================================
// PayPal Express Checkout Module
// ==================================
$API_version = "56";
2011-09-21 15:05:32 +02:00
/*
' Define the PayPal Redirect URLs.
' This is the URL that the buyer is first sent to do authorize payment with their paypal account
' change the URL depending if you are testing on the sandbox or the live PayPal site
'
' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=
' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token=
*/
2023-11-27 11:56:32 +01:00
if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha')) { // We can force sand box with param 'forcesandbox'
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
2020-05-21 15:05:19 +02:00
} else {
$API_Endpoint = "https://api-3t.paypal.com/nvp";
$API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
2011-09-21 15:05:32 +02:00
}
// Clean parameters
2024-12-11 20:38:48 +01:00
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
2011-09-21 15:05:32 +02:00
// Proxy
2024-01-05 04:18:53 +01:00
$PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST');
$PROXY_PORT = getDolGlobalString('MAIN_PROXY_PORT');
$PROXY_USER = getDolGlobalString('MAIN_PROXY_USER');
$PROXY_PASS = getDolGlobalString('MAIN_PROXY_PASS');
$USE_PROXY = getDolGlobalBool('MAIN_PROXY_USE');