diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php
index 4f4b15fa0a4..e7e20be5b83 100644
--- a/htdocs/core/modules/modStripe.class.php
+++ b/htdocs/core/modules/modStripe.class.php
@@ -65,7 +65,7 @@ class modStripe extends DolibarrModules
$this->picto='stripe@stripe';
// Data directories to create when module is enabled.
- $this->dirs = array('/stripe/temp');
+ $this->dirs = array();
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("stripe.php@stripe");
diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
index bf28e6a3db6..7572e0d2030 100644
--- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
+++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
@@ -117,17 +117,33 @@ CREATE TABLE llx_product_attribute_combination
entity INT DEFAULT 1 NOT NULL
);
-INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (1,'VT', 'Journal des ventes', 1, 1);
-INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (2,'AC', 'Journal des achats', 2, 1);
-INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (3,'BQ', 'Journal de banque', 3, 1);
-INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (4,'OD', 'Journal des opérations diverses', 0, 1);
-INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Journal des à-nouveaux', 9, 1);
-ALTER TABLE llx_accounting_journal ADD COLUMN entity integer DEFAULT 1;
+ALTER TABLE llx_bank_account drop foreign key bank_fk_accountancy_journal;
+
+-- Add journal entries
+INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (1,'VT', 'Sale journal', 2, 1);
+INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (2,'AC', 'Purchase journal', 3, 1);
+INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (3,'BQ', 'Bank journal', 4, 1);
+INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (4,'OD', 'Other journal', 1, 1);
+INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Has new journal', 9, 1);
+-- Fix old entries
+UPDATE llx_accounting_journal SET nature = 1 where code = 'OD' and nature = 0;
+UPDATE llx_accounting_journal SET nature = 2 where code = 'VT' and nature = 1;
+UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2;
+UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3;
+
+UPDATE llx_bank_account as ba set accountancy_journal = 'BQ' where accountancy_journal = 'BK';
+UPDATE llx_bank_account as ba set accountancy_journal = 'OD' where accountancy_journal IS NULL;
+
+ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer;
+ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal);
+
+UPDATE llx_bank_account as ba set fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal as aj where ba.accountancy_journal = aj.code) where accountancy_journal not in ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
+ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
+
ALTER TABLE llx_paiementfourn ADD COLUMN model_pdf varchar(255);
-
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
@@ -262,14 +278,6 @@ insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
-UPDATE llx_accounting_journal SET nature = 1 where code = 'OD' and nature = 0;
-UPDATE llx_accounting_journal SET nature = 2 where code = 'VT' and nature = 1;
-UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2;
-UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3;
-
-
-ALTER TABLE llx_bank_account CHANGE COLUMN accountancy_journal fk_accountancy_journal integer;
---ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
diff --git a/htdocs/install/mysql/tables/llx_bank_account.key.sql b/htdocs/install/mysql/tables/llx_bank_account.key.sql
index 986ca7ea550..c5f2786fd24 100644
--- a/htdocs/install/mysql/tables/llx_bank_account.key.sql
+++ b/htdocs/install/mysql/tables/llx_bank_account.key.sql
@@ -19,5 +19,6 @@
ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity);
+ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal);
--- ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
+ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang
index c0a55888e7c..91fe071627c 100644
--- a/htdocs/langs/en_US/paybox.lang
+++ b/htdocs/langs/en_US/paybox.lang
@@ -11,6 +11,7 @@ YourEMail=Email to receive payment confirmation
Creditor=Creditor
PaymentCode=Payment code
PayBoxDoPayment=Go on payment
+ToPay=Do payment
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
Continue=Next
ToOfferALinkForOnlinePayment=URL for %s payment
diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang
index 3c699527018..a0cadc88096 100644
--- a/htdocs/langs/en_US/paypal.lang
+++ b/htdocs/langs/en_US/paypal.lang
@@ -16,15 +16,17 @@ ThisIsTransactionId=This is id of transaction: %s
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
PredefinedMailContentLink=You can click on the secure link below to make your payment (PayPal) if it is not already done.\n\n%s\n\n
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
-NewPaypalPaymentReceived=New Paypal payment received
-NewPaypalPaymentFailed=New Paypal payment tried but failed
+NewOnlinePaymentReceived=New online payment received
+NewOnlinePaymentFailed=New online payment tried but failed
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
ReturnURLAfterPayment=Return URL after payment
-ValidationOfPaypalPaymentFailed=Validation of Paypal payment failed
-PaypalConfirmPaymentPageWasCalledButFailed=Payment confirmation page for Paypal was called by Paypal but confirmation failed
+ValidationOfOnlinePaymentFailed=Validation of online payment failed
+PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error
SetExpressCheckoutAPICallFailed=SetExpressCheckout API call failed.
DoExpressCheckoutPaymentAPICallFailed=DoExpressCheckoutPayment API call failed.
DetailedErrorMessage=Detailed Error Message
ShortErrorMessage=Short Error Message
ErrorCode=Error Code
ErrorSeverityCode=Error Severity Code
+OnlinePaymentSystem=Online payment system
+PaypalLiveEnabled=Paypal live enabled (otherwise test/sandbox mode)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang
index 3f85dc2d544..c115a76603c 100644
--- a/htdocs/langs/en_US/stripe.lang
+++ b/htdocs/langs/en_US/stripe.lang
@@ -9,6 +9,7 @@ ThisScreenAllowsYouToPay=This screen allow you to make an online payment to %s.
ThisIsInformationOnPayment=This is information on payment to do
ToComplete=To complete
YourEMail=Email to receive payment confirmation
+STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
Creditor=Creditor
PaymentCode=Payment code
StripeDoPayment=Go on payment
@@ -38,4 +39,4 @@ STRIPE_TEST_SECRET_KEY=Secret test key
STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key
STRIPE_LIVE_SECRET_KEY=Secret live key
STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key
-StripeLiveEnabled=Stripe live enabled
\ No newline at end of file
+StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode)
\ No newline at end of file
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index 36c8df9d0d6..2d0be83c80d 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -44,8 +44,6 @@ if ($action == 'setvalue' && $user->admin)
{
$db->begin();
- $result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",GETPOST('PAYPAL_API_SANDBOX','alpha'),'chaine',0,'',$conf->entity);
- if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST('PAYPAL_API_USER','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",GETPOST('PAYPAL_API_PASSWORD','alpha'),'chaine',0,'',$conf->entity);
@@ -85,6 +83,21 @@ if ($action == 'setvalue' && $user->admin)
}
}
+if ($action=="setlive")
+{
+ $liveenable = GETPOST('value','int')?0:1;
+ $res = dolibarr_set_const($db, "PAYPAL_API_SANDBOX", $liveenable,'yesno',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
/*
* View
@@ -127,13 +140,21 @@ print '
'."\n";
+print ' ';
+
+
+// Add more content on page for some services
+if (preg_match('/^dopayment/',$action))
+{
+ // Simple checkout
+ /*
+ print '';
+ */
+
+ // Personalized checkout
+ print '';
+
+ print '
+
+
+
-
-
+
+
+
+
+ ';
+}
+htmlPrintOnlinePaymentFooter($mysoc,$langs);
+
+llxFooter('', 'public');
+
+$db->close();
diff --git a/htdocs/public/stripe/paymentko.php b/htdocs/public/stripe/paymentko.php
new file mode 100644
index 00000000000..01000939b37
--- /dev/null
+++ b/htdocs/public/stripe/paymentko.php
@@ -0,0 +1,165 @@
+
+*
+ * 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 .
+ */
+
+/**
+ * \file htdocs/public/stripe/paymentko.php
+ * \ingroup core
+ * \brief File to show page after a failed payment.
+ * This page is called by payment system with url provided to it competed with parameter FULLTAG=xxx
+ * More data like token are saved into session. This token can be used to get more informations.
+ */
+
+define("NOLOGIN",1); // This means this output page does not require to be logged.
+define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
+
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// TODO This should be useless. Because entity must be retreive from object ref and not from url.
+$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) define("DOLENTITY", $entity);
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
+
+$langs->load("main");
+$langs->load("other");
+$langs->load("dict");
+$langs->load("bills");
+$langs->load("companies");
+$langs->load("paybox");
+$langs->load("paypal");
+$langs->load("stripe");
+
+$FULLTAG=GETPOST('FULLTAG');
+if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
+
+// Security check
+if (empty($conf->stripe->enabled)) accessforbidden('',0,0,1);
+
+$object = new stdClass(); // For triggers
+
+$paymentmethod='stripe';
+
+
+/*
+ * Actions
+ */
+
+
+
+
+/*
+ * View
+ */
+
+dol_syslog("Callback url when a PayPal payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_stripe');
+
+$tracepost = "";
+foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
+dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_stripe');
+
+if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
+{
+ $fulltag = $FULLTAG;
+ $onlinetoken = empty($PAYPALTOKEN)?$_SESSION['onlinetoken']:$PAYPALTOKEN;
+ $payerID = empty($PAYPALPAYERID)?$_SESSION['payerID']:$PAYPALPAYERID;
+ $currencyCodeType = $_SESSION['currencyCodeType'];
+ $paymentType = $_SESSION['paymentType'];
+ $FinalPaymentAmt = $_SESSION['FinalPaymentAmt'];
+ $ipaddress = $_SESSION['ipaddress'];
+
+ // Appel des triggers
+ include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
+ $interface=new Interfaces($db);
+ $result=$interface->run_triggers('STRIPE_PAYMENT_KO',$object,$user,$langs,$conf);
+ if ($result < 0) { $error++; $errors=$interface->errors; }
+ // Fin appel triggers
+
+ // Send an email
+ $sendemail = '';
+ if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
+
+ if ($sendemail)
+ {
+ // Get on url call
+ $sendto=$sendemail;
+ $from=$conf->global->MAILING_EMAIL_FROM;
+
+ // Define link to login card
+ $appli=constant('DOL_APPLICATION_TITLE');
+ if (! empty($conf->global->MAIN_APPLICATION_TITLE))
+ {
+ $appli=$conf->global->MAIN_APPLICATION_TITLE;
+ if (preg_match('/\d\.\d/', $appli))
+ {
+ if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core
+ }
+ else $appli.=" ".DOL_VERSION;
+ }
+ else $appli.=" ".DOL_VERSION;
+
+ $urlback=$_SERVER["REQUEST_URI"];
+ $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
+ $content="";
+ $content.=$langs->transnoentitiesnoconv("ValidationOfOnlinePaymentFailed")."\n";
+ $content.="\n";
+ $content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
+ $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."\n";
+ $content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
+ $content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+ $mailfile = new CMailFile($topic, $sendto, $from, $content);
+
+ $result=$mailfile->sendfile();
+ if ($result)
+ {
+ dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_stripe');
+ }
+ else
+ {
+ dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_stripe');
+ }
+ }
+
+ unset($_SESSION['ipaddress']);
+}
+
+$head='';
+if (! empty($conf->global->STRIPE_CSS_URL)) $head=''."\n";
+
+$conf->dol_hide_topmenu=1;
+$conf->dol_hide_leftmenu=1;
+
+llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
+
+
+// Show ko message
+print ''."\n";
+print '
\n";
+
+
+htmlPrintOnlinePaymentFooter($mysoc,$langs);
+
+
+llxFooter('', 'public');
+
+$db->close();
diff --git a/htdocs/public/stripe/paymentok.php b/htdocs/public/stripe/paymentok.php
new file mode 100644
index 00000000000..4eede2e9544
--- /dev/null
+++ b/htdocs/public/stripe/paymentok.php
@@ -0,0 +1,199 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/public/stripe/paymentok.php
+ * \ingroup core
+ * \brief File to show page after a successful payment
+ * This page is called by payment system with url provided to it completed with parameter FULLTAG=xxx
+ * More data like token are saved into session. This token can be used to get more informations.
+ */
+
+define("NOLOGIN",1); // This means this output page does not require to be logged.
+define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
+
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// TODO This should be useless. Because entity must be retreive from object ref and not from url.
+$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) define("DOLENTITY", $entity);
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
+
+$langs->load("main");
+$langs->load("other");
+$langs->load("dict");
+$langs->load("bills");
+$langs->load("companies");
+$langs->load("paybox");
+$langs->load("paypal");
+
+$FULLTAG=GETPOST('FULLTAG');
+if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
+$source=GETPOST('source');
+$ref=GETPOST('ref');
+
+// Security check
+if (empty($conf->stripe->enabled)) accessforbidden('', 0, 0, 1);
+
+
+$ispaymentok = false;
+// If payment is ok
+$PAYMENTSTATUS=$TRANSACTIONID=$TAXAMT=$NOTE='';
+// If payment is ko
+$ErrorCode=$ErrorShortMsg=$ErrorLongMsg=$ErrorSeverityCode='';
+
+
+$object = new stdClass(); // For triggers
+
+$paymentmethod='stripe';
+
+
+/*
+ * Actions
+ */
+
+
+
+/*
+ * View
+ */
+
+dol_syslog("Callback url when a payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_stripe');
+
+$tracepost = "";
+foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
+dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_stripe');
+
+$head='';
+if (! empty($conf->global->STRIPE_CSS_URL)) $head=''."\n";
+
+$conf->dol_hide_topmenu=1;
+$conf->dol_hide_leftmenu=1;
+
+llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
+
+
+
+// Show message
+print ''."\n";
+print '
'."\n";
+
+$ispaymentok = true; // We call this page if payment is ok
+if ($ispaymentok)
+{
+ // Get on url call
+ $fulltag = $FULLTAG;
+ $onlinetoken = empty($PAYPALTOKEN)?$_SESSION['onlinetoken']:$PAYPALTOKEN;
+ $payerID = empty($PAYPALPAYERID)?$_SESSION['payerID']:$PAYPALPAYERID;
+ // Set by newpayment.php
+ $paymentType = $_SESSION['PaymentType'];
+ $currencyCodeType = $_SESSION['currencyCodeType'];
+ $FinalPaymentAmt = $_SESSION["Payment_Amount"];
+ // From env
+ $ipaddress = $_SESSION['ipaddress'];
+ $TRANSACTIONID = $_SESSION['TRANSACTIONID'];
+
+ // Appel des triggers
+ include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
+ $interface=new Interfaces($db);
+ $result=$interface->run_triggers('STRIPE_PAYMENT_OK',$object,$user,$langs,$conf);
+ if ($result < 0) { $error++; $errors=$interface->errors; }
+ // Fin appel triggers
+
+
+ print $langs->trans("YourPaymentHasBeenRecorded")." \n";
+ print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."
\n";
+ if (! empty($conf->global->STRIPE_MESSAGE_OK)) print $conf->global->STRIPE_MESSAGE_OK;
+
+ $sendemail = '';
+ if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
+
+ // Send an email
+ if ($sendemail)
+ {
+ $sendto=$sendemail;
+ $from=$conf->global->MAILING_EMAIL_FROM;
+ // Define $urlwithroot
+ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
+ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
+ // Define link to login card
+ $appli=constant('DOL_APPLICATION_TITLE');
+ if (! empty($conf->global->MAIN_APPLICATION_TITLE))
+ {
+ $appli=$conf->global->MAIN_APPLICATION_TITLE;
+ if (preg_match('/\d\.\d/', $appli))
+ {
+ if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core
+ }
+ else $appli.=" ".DOL_VERSION;
+ }
+ else $appli.=" ".DOL_VERSION;
+
+ $urlback=$_SERVER["REQUEST_URI"];
+ $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
+ $tmptag=dolExplodeIntoArray($fulltag,'.','=');
+ $content="";
+ if (! empty($tmptag['MEM']))
+ {
+ $langs->load("members");
+ $url=$urlwithroot."/adherents/card_subscriptions.php?rowid=".$tmptag['MEM'];
+ $content.=$langs->trans("PaymentSubscription")." \n";
+ $content.=$langs->trans("MemberId").': '.$tmptag['MEM']." \n";
+ $content.=$langs->trans("Link").': '.$url.''." \n";
+ }
+ else
+ {
+ $content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")." \n";
+ }
+ $content.=" \n";
+ $content.=$langs->transnoentitiesnoconv("TechnicalInformation").": \n";
+ $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod." \n";
+ $content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback." \n";
+ $content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
+
+ $ishtml=dol_textishtml($content); // May contain urls
+
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+ $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
+
+ $result=$mailfile->sendfile();
+ if ($result)
+ {
+ dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_stripe');
+ }
+ else
+ {
+ dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_stripe');
+ }
+ }
+}
+
+
+print "\n