From 3b626b75c42a1ad6ce05b5dcbf650bdd0a72e0c5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 22 Apr 2017 06:58:44 +0200 Subject: [PATCH] Update works --- htdocs/{stripe => core}/lib/stripe.lib.php | 0 htdocs/core/modules/modStripe.class.php | 4 +- htdocs/stripe/checkout.php | 23 ++++--- htdocs/stripe/config.php | 25 ++++---- htdocs/stripe/lib/index.html | 0 htdocs/stripe/paymnt_link.php | 72 ---------------------- 6 files changed, 26 insertions(+), 98 deletions(-) rename htdocs/{stripe => core}/lib/stripe.lib.php (100%) delete mode 100644 htdocs/stripe/lib/index.html delete mode 100644 htdocs/stripe/paymnt_link.php diff --git a/htdocs/stripe/lib/stripe.lib.php b/htdocs/core/lib/stripe.lib.php similarity index 100% rename from htdocs/stripe/lib/stripe.lib.php rename to htdocs/core/lib/stripe.lib.php diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 4b498629017..4f4b15fa0a4 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -73,8 +73,8 @@ class modStripe extends DolibarrModules // Dependencies $this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->phpmin = array(4,1); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module + $this->phpmin = array(5,3); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(5,0); // Minimum version of Dolibarr required by module $this->langfiles = array("stripe"); // Constants diff --git a/htdocs/stripe/checkout.php b/htdocs/stripe/checkout.php index 0989d55b76f..f7f547afae9 100644 --- a/htdocs/stripe/checkout.php +++ b/htdocs/stripe/checkout.php @@ -1,6 +1,6 @@ - * Copyright (C) <2016> SaaSprov.ma +/* Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Saasprov * * 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 @@ -16,12 +16,11 @@ * along with this program. If not, see . */ - +require '../main.inc.php'; + // Load Dolibarr environment - - -require_once('config.php'); -require_once('stripe/init.php'); +require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'); +require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php'); define("NOLOGIN",1); define("NOCSRFCHECK",1); @@ -30,8 +29,8 @@ $langs->load("main"); $langs->load("other"); $langs->load("stripe"); -$SOURCE=GETPOST("source",'alpha'); -$ref=$REF=GETPOST('ref','alpha'); +$source=GETPOST("source",'alpha'); +$ref=GETPOST('ref','alpha'); $form = new Form($db); @@ -40,18 +39,18 @@ $form = new Form($db); * * @return void */ -function llxHeader() { } +function llxHeader() {} /** * Footer empty * * @return void */ -function llxFooter() { } +function llxFooter() {} $invoice = null; // Payment on customer invoice -if (GETPOST("source") == 'invoice') +if ($source == 'invoice') { $found=true; $langs->load("bills"); diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 9cc083051ec..78d394feb53 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -1,6 +1,6 @@ - * Copyright (C) <2016> +/* Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Saasprov * * 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 @@ -16,21 +16,22 @@ * along with this program. If not, see . */ +/** +* \file stripe/config.php +* \ingroup Stripe +* \brief Page to move config in api +*/ -// Load Dolibarr environment -if (false === (@include '../main.inc.php')) { // From htdocs directory - require '../../main.inc.php'; // From "custom" directory -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; dol_include_once('/stripe/lib/stripe.lib.php'); -require_once('stripe/init.php'); +require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php'); -//use \Stripe\Stripe as Stripe; +//use \includes\stripe as stripe; $stripe = array( - "secret_key" => $conf->global->TEST_SECRET_KEY, - "publishable_key" => $conf->global->TEST_PUBLISHABLE_KEY + "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, + "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY ); -\Stripe\Stripe::setApiKey($stripe['secret_key']); -?> \ No newline at end of file +\includes\stripe::setApiKey($stripe['secret_key']); \ No newline at end of file diff --git a/htdocs/stripe/lib/index.html b/htdocs/stripe/lib/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/stripe/paymnt_link.php b/htdocs/stripe/paymnt_link.php deleted file mode 100644 index 68adbf47a3c..00000000000 --- a/htdocs/stripe/paymnt_link.php +++ /dev/null @@ -1,72 +0,0 @@ - - * Copyright (C) ---Put here your own copyright and developer email--- - * - * 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 . - */ - - -// Load Dolibarr environment -if (false === (@include '../main.inc.php')) { // From htdocs directory - require '../../main.inc.php'; // From "custom" directory -} -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; - -// Load traductions files requiredby by page -$langs->load("mymodule"); -$langs->load("other"); - -// Get parameters -$id = GETPOST('id', 'int'); // For backward compatibility - -$object = new Facture($db); -// Load object -if ($id > 0 || ! empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); -} - - - - -/*************************************************** -* VIEW -* -* Put here all code to build page -****************************************************/ - -llxHeader('','StripePaymentLink',''); - - -// Part to show record -if ($id) -{ - print load_fiche_titre($langs->trans("StripePaymentLink")); - - dol_fiche_head(); - - $link = $dolibarr_main_url_root . '/custom/stripe/checkout.php?source=invoice&ref=' . $object->ref; - print ''."\n"; - print ''; - // LIST_OF_TD_LABEL_FIELDS_VIEW - print '
'.$langs->trans("PaymentLink").'
'; - - dol_fiche_end(); - - - - -} - -llxFooter(); -$db->close();