Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
html_old /
btm2000.bak /
core /
triggers /
Delete
Unzip
Name
Size
Permission
Date
Action
README
639
B
-rw-r--r--
2025-11-25 13:15
README-FR
757
B
-rw-r--r--
2025-11-25 13:15
dolibarrtriggers.class.php
3.25
KB
-rw-r--r--
2025-11-25 13:15
index.html
0
B
-rw-r--r--
2025-11-25 13:15
interface_20_all_Logevents.class.php
8.15
KB
-rw-r--r--
2025-11-25 13:15
interface_20_modWorkflow_WorkflowManager.class.php
14.46
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modAgenda_ActionsAuto.class.php
37.67
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modBlockedlog_ActionsBlockedLog.class.php
4.71
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modLdap_Ldapsynchro.class.php
25.27
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modMailmanspip_Mailmanspipsynchro.class.php
5.24
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modNotification_Notification.class.php
4.54
KB
-rw-r--r--
2025-11-25 13:15
interface_50_modTicket_TicketEmail.class.php
14.93
KB
-rw-r--r--
2025-11-25 13:15
interface_80_modStripe_Stripe.class.php
8.19
KB
-rw-r--r--
2025-11-25 13:15
Save
Rename
<?php /* * Copyright (C) 2018 ptibogxiv <support@ptibogxiv.net> * * 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/>. */ /** * \file htdocs/core/triggers/interface_50_modStripe_Stripe.class.php * \ingroup core * \brief Fichier * \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: * - Le nom du fichier doit etre: interface_99_modMymodule_Mytrigger.class.php * ou: interface_99_all_Mytrigger.class.php * - Le fichier doit rester stocke dans core/triggers * - Le nom de la classe doit etre InterfaceMytrigger * - Le nom de la propriete name doit etre Mytrigger */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** * Class of triggers for stripe module */ class InterfaceStripe { public $db; /** * Constructor * * @param DoliDB $db Database handler */ public function __construct($db) { $this->db = $db; $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = 'stripe'; $this->description = "Triggers of the module Stripe"; $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version $this->picto = 'stripe@stripe'; } /** * Trigger name * * @return string Name of trigger file */ public function getName() { return $this->name; } /** * Trigger description * * @return string Description of trigger file */ public function getDesc() { return $this->description; } /** * Trigger version * * @return string Version of trigger file */ public function getVersion() { global $langs; $langs->load("admin"); if ($this->version == 'development') { return $langs->trans("Development"); } elseif ($this->version == 'experimental') { return $langs->trans("Experimental"); } elseif ($this->version == 'dolibarr') { return DOL_VERSION; } elseif ($this->version) { return $this->version; } else { return $langs->trans("Unknown"); } } /** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file * is inside directory core/triggers * * @param string $action Event action code * @param CommonObject $object Object * @param User $user Object user * @param Translate $langs Object langs * @param Conf $conf Object conf * @return int <0 if KO, 0 if no triggered ran, >0 if OK */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { // Put here code you want to execute when a Dolibarr business events occurs. // Data and type of action are stored into $object and $action global $langs, $db, $conf; $langs->load("members"); $langs->load("users"); $langs->load("mails"); $langs->load('other'); require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); if (empty($conf->stripe->enabled)) return 0; $ok = 1; $service = 'StripeTest'; $servicestatus = 0; if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; $servicestatus = 1; } // If customer is linked to Stripe, we update/delete Stripe too if ($action == 'COMPANY_MODIFY') { dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. if ($object->client != 0) { $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request if ($customer) { $namecleaned = $object->name ? $object->name : null; $vatcleaned = $object->tva_intra ? $object->tva_intra : null; // We force data to "null" if empty as expected by Stripe // Detect if we change a Stripe info (email, description, vat id) $changerequested = 0; if (! empty($object->email) && $object->email != $customer->email) $changerequested++; if ($namecleaned != $customer->description) $changerequested++; if ($vatcleaned != $customer->business_vat_id) $changerequested++; if ($changerequested) { if (! empty($object->email)) $customer->email = $object->email; $customer->description = $namecleaned; $customer->business_vat_id = $vatcleaned; $customer->save(); } } } } if ($action == 'COMPANY_DELETE') { dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); if ($customer) { $customer->delete(); } $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account"; $sql.= " WHERE site='stripe' AND fk_soc = " . $object->id; $this->db->query($sql); } // If payment mode is linked to Stripee, we update/delete Stripe too if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { // For creation of credit card, we do not create in Stripe automatically } if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') { dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); if (! empty($object->stripe_card_ref)) { $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this if ($stripecu) { // Get customer (required to get a card) if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $customer = \Stripe\Customer::retrieve($stripecu); } else { $customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc)); } if ($customer) { $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { $card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])); try { $card->save($dataforcard); } catch(Exception $e) { $ok = -1; $this->error = $e->getMessages(); } } } } } } if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') { dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); if (! empty($object->stripe_card_ref)) { $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this if ($stripecu) { // Get customer (required to get a card) if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $customer = \Stripe\Customer::retrieve($stripecu); } else { $customer = \Stripe\Customer::retrieve($stripecu, array("stripe_account" => $stripeacc)); } if ($customer) { $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { if (method_exists($card, 'detach')) $card->detach(); else $card->delete(); } } } } } return $ok; } }