PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/asterix14/dolibarr
PHP | 70 lines | 27 code | 9 blank | 34 comment | 7 complexity | 1816460c69caaa42534b89a15a516978 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
  3. * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/paypal/lib/paypalfunctions.lib.php
  20. * \ingroup paypal
  21. * \brief Page with Paypal init var.
  22. */
  23. if (session_id() == "") session_start();
  24. // ==================================
  25. // PayPal Express Checkout Module
  26. // ==================================
  27. $API_version="56";
  28. /*
  29. ' Define the PayPal Redirect URLs.
  30. ' This is the URL that the buyer is first sent to do authorize payment with their paypal account
  31. ' change the URL depending if you are testing on the sandbox or the live PayPal site
  32. '
  33. ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=
  34. ' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token=
  35. */
  36. if ($conf->global->PAYPAL_API_SANDBOX)
  37. {
  38. $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
  39. $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
  40. }
  41. else
  42. {
  43. $API_Endpoint = "https://api-3t.paypal.com/nvp";
  44. $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
  45. }
  46. // Clean parameters
  47. $PAYPAL_API_USER="";
  48. if ($conf->global->PAYPAL_API_USER) $PAYPAL_API_USER=$conf->global->PAYPAL_API_USER;
  49. $PAYPAL_API_PASSWORD="";
  50. if ($conf->global->PAYPAL_API_PASSWORD) $PAYPAL_API_PASSWORD=$conf->global->PAYPAL_API_PASSWORD;
  51. $PAYPAL_API_SIGNATURE="";
  52. if ($conf->global->PAYPAL_API_SIGNATURE) $PAYPAL_API_SIGNATURE=$conf->global->PAYPAL_API_SIGNATURE;
  53. $PAYPAL_API_SANDBOX="";
  54. if ($conf->global->PAYPAL_API_SANDBOX) $PAYPAL_API_SANDBOX=$conf->global->PAYPAL_API_SANDBOX;
  55. // Proxy
  56. $PROXY_HOST = $conf->global->MAIN_PROXY_HOST;
  57. $PROXY_PORT = $conf->global->MAIN_PROXY_PORT;
  58. $PROXY_USER = $conf->global->MAIN_PROXY_USER;
  59. $PROXY_PASS = $conf->global->MAIN_PROXY_PASS;
  60. $USE_PROXY = empty($conf->global->MAIN_PROXY_USE)?false:true;
  61. ?>