Merge remote-tracking branch 'uptream/develop' into 6.0-multijournal
This commit is contained in:
commit
cedf5fb0ed
@ -65,7 +65,7 @@ class modStripe extends DolibarrModules
|
|||||||
$this->picto='stripe@stripe';
|
$this->picto='stripe@stripe';
|
||||||
|
|
||||||
// Data directories to create when module is enabled.
|
// 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.
|
// 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");
|
$this->config_page_url = array("stripe.php@stripe");
|
||||||
|
|||||||
@ -117,17 +117,33 @@ CREATE TABLE llx_product_attribute_combination
|
|||||||
entity INT DEFAULT 1 NOT NULL
|
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);
|
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_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_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);
|
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);
|
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);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,5 +19,6 @@
|
|||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity);
|
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);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ YourEMail=Email to receive payment confirmation
|
|||||||
Creditor=Creditor
|
Creditor=Creditor
|
||||||
PaymentCode=Payment code
|
PaymentCode=Payment code
|
||||||
PayBoxDoPayment=Go on payment
|
PayBoxDoPayment=Go on payment
|
||||||
|
ToPay=Do payment
|
||||||
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
|
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
|
||||||
Continue=Next
|
Continue=Next
|
||||||
ToOfferALinkForOnlinePayment=URL for %s payment
|
ToOfferALinkForOnlinePayment=URL for %s payment
|
||||||
|
|||||||
@ -16,15 +16,17 @@ ThisIsTransactionId=This is id of transaction: <b>%s</b>
|
|||||||
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
|
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
|
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
|
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
|
||||||
NewPaypalPaymentReceived=New Paypal payment received
|
NewOnlinePaymentReceived=New online payment received
|
||||||
NewPaypalPaymentFailed=New Paypal payment tried but failed
|
NewOnlinePaymentFailed=New online payment tried but failed
|
||||||
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||||
ReturnURLAfterPayment=Return URL after payment
|
ReturnURLAfterPayment=Return URL after payment
|
||||||
ValidationOfPaypalPaymentFailed=Validation of Paypal payment failed
|
ValidationOfOnlinePaymentFailed=Validation of online payment failed
|
||||||
PaypalConfirmPaymentPageWasCalledButFailed=Payment confirmation page for Paypal was called by Paypal but confirmation failed
|
PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error
|
||||||
SetExpressCheckoutAPICallFailed=SetExpressCheckout API call failed.
|
SetExpressCheckoutAPICallFailed=SetExpressCheckout API call failed.
|
||||||
DoExpressCheckoutPaymentAPICallFailed=DoExpressCheckoutPayment API call failed.
|
DoExpressCheckoutPaymentAPICallFailed=DoExpressCheckoutPayment API call failed.
|
||||||
DetailedErrorMessage=Detailed Error Message
|
DetailedErrorMessage=Detailed Error Message
|
||||||
ShortErrorMessage=Short Error Message
|
ShortErrorMessage=Short Error Message
|
||||||
ErrorCode=Error Code
|
ErrorCode=Error Code
|
||||||
ErrorSeverityCode=Error Severity Code
|
ErrorSeverityCode=Error Severity Code
|
||||||
|
OnlinePaymentSystem=Online payment system
|
||||||
|
PaypalLiveEnabled=Paypal live enabled (otherwise test/sandbox mode)
|
||||||
@ -9,6 +9,7 @@ ThisScreenAllowsYouToPay=This screen allow you to make an online payment to %s.
|
|||||||
ThisIsInformationOnPayment=This is information on payment to do
|
ThisIsInformationOnPayment=This is information on payment to do
|
||||||
ToComplete=To complete
|
ToComplete=To complete
|
||||||
YourEMail=Email to receive payment confirmation
|
YourEMail=Email to receive payment confirmation
|
||||||
|
STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||||
Creditor=Creditor
|
Creditor=Creditor
|
||||||
PaymentCode=Payment code
|
PaymentCode=Payment code
|
||||||
StripeDoPayment=Go on payment
|
StripeDoPayment=Go on payment
|
||||||
@ -38,4 +39,4 @@ STRIPE_TEST_SECRET_KEY=Secret test key
|
|||||||
STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key
|
STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key
|
||||||
STRIPE_LIVE_SECRET_KEY=Secret live key
|
STRIPE_LIVE_SECRET_KEY=Secret live key
|
||||||
STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key
|
STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key
|
||||||
StripeLiveEnabled=Stripe live enabled
|
StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode)
|
||||||
@ -44,8 +44,6 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$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);
|
$result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST('PAYPAL_API_USER','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",GETPOST('PAYPAL_API_PASSWORD','alpha'),'chaine',0,'',$conf->entity);
|
$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
|
* View
|
||||||
@ -127,13 +140,21 @@ print '<td>'.$langs->trans("AccountParameter").'</td>';
|
|||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">';
|
print '<td class="titlefield fieldrequired">';
|
||||||
print $langs->trans("PAYPAL_API_SANDBOX").'</td><td>';
|
print $langs->trans("PaypalLiveEnabled").'</td><td>';
|
||||||
print $form->selectyesno("PAYPAL_API_SANDBOX",$conf->global->PAYPAL_API_SANDBOX,1);
|
if (empty($conf->global->PAYPAL_API_SANDBOX))
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=0">';
|
||||||
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=1">';
|
||||||
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">';
|
print '<tr class="oddeven"><td class="fieldrequired">';
|
||||||
print $langs->trans("PAYPAL_API_USER").'</td><td>';
|
print $langs->trans("PAYPAL_API_USER").'</td><td>';
|
||||||
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
|
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
* \file htdocs/public/paybox/paymentko.php
|
* \file htdocs/public/paybox/paymentko.php
|
||||||
* \ingroup paybox
|
* \ingroup paybox
|
||||||
* \brief File to show page after a failed payment
|
* \brief File to show page after a failed payment
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -52,6 +51,8 @@ $langs->load("stripe");
|
|||||||
|
|
||||||
$object = new stdClass(); // For triggers
|
$object = new stdClass(); // For triggers
|
||||||
|
|
||||||
|
$paymentmethod='paybox';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -72,51 +73,74 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
|||||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
|
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
|
||||||
|
|
||||||
|
|
||||||
// Appel des triggers
|
if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($db);
|
|
||||||
$result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
|
||||||
// Send an email
|
|
||||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
|
||||||
{
|
{
|
||||||
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
// Get on url call
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$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'];
|
||||||
|
|
||||||
// Define link to login card
|
// Appel des triggers
|
||||||
$appli=constant('DOL_APPLICATION_TITLE');
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
$interface=new Interfaces($db);
|
||||||
{
|
$result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf);
|
||||||
$appli=$conf->global->MAIN_APPLICATION_TITLE;
|
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||||
if (preg_match('/\d\.\d/', $appli))
|
// Fin appel triggers
|
||||||
{
|
|
||||||
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"];
|
// Send an email
|
||||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentFailed");
|
$sendemail = '';
|
||||||
$content=$langs->transnoentitiesnoconv("NewPayboxPaymentFailed")."\n".$fulltag;
|
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
|
||||||
$mailfile = new CMailFile($topic, $sendto, $from, $content);
|
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
if ($sendemail)
|
||||||
if ($result)
|
{
|
||||||
{
|
$sendto=$sendemail;
|
||||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paybox');
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
}
|
|
||||||
else
|
// Define link to login card
|
||||||
{
|
$appli=constant('DOL_APPLICATION_TITLE');
|
||||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox');
|
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."<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
||||||
|
$content.="tag=".$fulltag."\npaymentType=".$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, '_paybox');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($_SESSION['ipaddress']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
* \file htdocs/public/paybox/paymentok.php
|
* \file htdocs/public/paybox/paymentok.php
|
||||||
* \ingroup paybox
|
* \ingroup paybox
|
||||||
* \brief File to show page after a successful payment
|
* \brief File to show page after a successful payment
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -62,6 +61,8 @@ if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
|||||||
|
|
||||||
$object = new stdClass(); // For triggers
|
$object = new stdClass(); // For triggers
|
||||||
|
|
||||||
|
$paymentmethod='paybox';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -97,7 +98,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
|||||||
|
|
||||||
// Get on url call
|
// Get on url call
|
||||||
/*
|
/*
|
||||||
$token = $PAYBOXTOKEN;
|
$onlinetoken = $PAYBOXTOKEN;
|
||||||
*/
|
*/
|
||||||
$fulltag = $FULLTAG;
|
$fulltag = $FULLTAG;
|
||||||
/*$payerID = $PAYBOXPAYERID;
|
/*$payerID = $PAYBOXPAYERID;
|
||||||
@ -108,7 +109,7 @@ $FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
|||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag);
|
dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
|||||||
else $appli.=" ".DOL_VERSION;
|
else $appli.=" ".DOL_VERSION;
|
||||||
|
|
||||||
$urlback=$_SERVER["REQUEST_URI"];
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentReceived");
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||||
$content="";
|
$content="";
|
||||||
if (! empty($tmptag['MEM']))
|
if (! empty($tmptag['MEM']))
|
||||||
@ -162,10 +163,11 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content.=$langs->transnoentitiesnoconv("NewPayboxPaymentReceived")."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n";
|
||||||
}
|
}
|
||||||
$content.="<br>\n";
|
$content.="<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
||||||
$content.="tag=".$fulltag."<br>\n";
|
$content.="tag=".$fulltag."<br>\n";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -24,7 +24,6 @@
|
|||||||
* \file htdocs/public/payment/newpayment.php
|
* \file htdocs/public/payment/newpayment.php
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \brief File to offer a way to make a payment for a particular Dolibarr entity
|
* \brief File to offer a way to make a payment for a particular Dolibarr entity
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -43,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
//if (empty($conf->paypal->enabled)) accessforbidden('',0,0,1);
|
// No check on module enabled. Done later according to $validpaymentmethod
|
||||||
|
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -115,7 +114,7 @@ $ref=$REF=GETPOST('ref','alpha');
|
|||||||
$TAG=GETPOST("tag",'alpha');
|
$TAG=GETPOST("tag",'alpha');
|
||||||
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
||||||
$SECUREKEY=GETPOST("securekey"); // Secure key
|
$SECUREKEY=GETPOST("securekey"); // Secure key
|
||||||
if ($paymentmethod) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod;
|
if ($paymentmethod && ! preg_match('/'.preg_quote('PM='.$paymentmethod,'/').'/', $FULLTAG)) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod;
|
||||||
|
|
||||||
if (! empty($SOURCE))
|
if (! empty($SOURCE))
|
||||||
{
|
{
|
||||||
@ -502,9 +501,12 @@ if (GETPOST("source") == 'order')
|
|||||||
$result=$order->fetch_thirdparty($order->socid);
|
$result=$order->fetch_thirdparty($order->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$order->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=$order->total_ttc;
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id;
|
$fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id;
|
||||||
//$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," ");
|
||||||
@ -609,9 +611,12 @@ if (GETPOST("source") == 'invoice')
|
|||||||
$result=$invoice->fetch_thirdparty($invoice->socid);
|
$result=$invoice->fetch_thirdparty($invoice->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id;
|
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id;
|
||||||
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
|
||||||
@ -733,35 +738,38 @@ if (GETPOST("source") == 'contractline')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$contractline->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if ($contractline->fk_product)
|
{
|
||||||
{
|
$amount=$contractline->total_ttc;
|
||||||
$product=new Product($db);
|
if ($contractline->fk_product)
|
||||||
$result=$product->fetch($contractline->fk_product);
|
{
|
||||||
|
$product=new Product($db);
|
||||||
|
$result=$product->fetch($contractline->fk_product);
|
||||||
|
|
||||||
// We define price for product (TODO Put this in a method in product class)
|
// We define price for product (TODO Put this in a method in product class)
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
{
|
{
|
||||||
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
||||||
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
||||||
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht = $product->price;
|
$pu_ht = $product->price;
|
||||||
$pu_ttc = $product->price_ttc;
|
$pu_ttc = $product->price_ttc;
|
||||||
$price_base_type = $product->price_base_type;
|
$price_base_type = $product->price_base_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$pu_ttc;
|
$amount=$pu_ttc;
|
||||||
if (empty($amount))
|
if (empty($amount))
|
||||||
{
|
{
|
||||||
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
$amount=price2num($amount);
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||||
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
|
||||||
@ -911,9 +919,12 @@ if (GETPOST("source") == 'membersubscription')
|
|||||||
$subscription=new Subscription($db);
|
$subscription=new Subscription($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$subscription->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=$subscription->total_ttc;
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||||
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
||||||
@ -1035,35 +1046,42 @@ if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.
|
|||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
if ($found && ! $error) // We are in a management option and no error
|
if ($action != 'dopayment')
|
||||||
{
|
{
|
||||||
// Buttons for all payments registration methods
|
if ($found && ! $error) // We are in a management option and no error
|
||||||
|
|
||||||
if (! empty($conf->paypal->enabled))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral';
|
// Buttons for all payments registration methods
|
||||||
|
|
||||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
if (! empty($conf->paypal->enabled))
|
||||||
{
|
{
|
||||||
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
|
if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral';
|
||||||
}
|
|
||||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
|
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
||||||
{
|
{
|
||||||
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
|
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
|
||||||
}
|
}
|
||||||
|
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
|
||||||
|
{
|
||||||
|
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->paybox->enabled))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Other methods
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (! empty($conf->paypal->enabled))
|
|
||||||
{
|
{
|
||||||
|
dol_print_error_email('ERRORNEWPAYMENTPAYPAL');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Other methods
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error_email('ERRORNEWPAYMENTPAYPAL');
|
// Print
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
* \brief File to show page after a failed payment.
|
* \brief File to show page after a failed payment.
|
||||||
* This page is called by payment system with url provided to it competed with parameter TOKEN=xxx
|
* This page is called by payment system with url provided to it competed with parameter TOKEN=xxx
|
||||||
* This token can be used to get more informations.
|
* This token can be used to get more informations.
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -53,16 +52,40 @@ $langs->load("companies");
|
|||||||
$langs->load("paybox");
|
$langs->load("paybox");
|
||||||
$langs->load("paypal");
|
$langs->load("paypal");
|
||||||
|
|
||||||
$PAYPALTOKEN=GETPOST('TOKEN');
|
if (! empty($conf->paypal->enabled))
|
||||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
{
|
||||||
$PAYPALPAYERID=GETPOST('PAYERID');
|
$PAYPALTOKEN=GETPOST('TOKEN');
|
||||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
||||||
|
$PAYPALPAYERID=GETPOST('PAYERID');
|
||||||
|
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
||||||
|
}
|
||||||
|
// TODO Other payment method
|
||||||
|
|
||||||
$FULLTAG=GETPOST('FULLTAG');
|
$FULLTAG=GETPOST('FULLTAG');
|
||||||
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
||||||
|
|
||||||
|
|
||||||
|
// Detect $paymentmethod
|
||||||
|
$paymentmethod='';
|
||||||
|
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg))
|
||||||
|
{
|
||||||
|
$paymentmethod=$reg[1];
|
||||||
|
}
|
||||||
|
if (empty($paymentmethod))
|
||||||
|
{
|
||||||
|
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("paymentmethod=".$paymentmethod);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$validpaymentmethod=array();
|
$validpaymentmethod=array();
|
||||||
if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
|
if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
|
||||||
if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
|
if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
|
||||||
|
if (! empty($conf->stripe->enabled)) $validpaymentmethod['stripe']='stripe';
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -90,50 +113,94 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
|||||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
|
|
||||||
// Appel des triggers
|
if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($db);
|
|
||||||
$result=$interface->run_triggers('PAYMENTONLINE_PAYMENT_KO',$object,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
|
||||||
// Send an email
|
|
||||||
if (! empty($conf->paypal->enabled))
|
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
// Get on url call
|
||||||
{
|
$fulltag = $FULLTAG;
|
||||||
// Get on url call
|
$onlinetoken = empty($PAYPALTOKEN)?$_SESSION['onlinetoken']:$PAYPALTOKEN;
|
||||||
$token = $PAYPALTOKEN;
|
$payerID = empty($PAYPALPAYERID)?$_SESSION['payerID']:$PAYPALPAYERID;
|
||||||
$fulltag = $FULLTAG;
|
// Set by newpayment.php
|
||||||
$payerID = $PAYPALPAYERID;
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
// Set by newpayment.php
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
// From env
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
// From env
|
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
|
||||||
|
|
||||||
|
// Appel des triggers
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
$interface=new Interfaces($db);
|
||||||
|
$result=$interface->run_triggers('PAYMENTONLINE_PAYMENT_KO',$object,$user,$langs,$conf);
|
||||||
|
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
// Send an email
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$sendemail = '';
|
||||||
|
if (! empty($conf->paypal->enabled))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
||||||
|
{
|
||||||
|
$sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Send an email
|
||||||
|
if (! empty($conf->paybox->enabled))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
||||||
|
{
|
||||||
|
$sendemail = $conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Send an email
|
||||||
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL))
|
||||||
|
{
|
||||||
|
$sendemail = $conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$urlback=$_SERVER["REQUEST_URI"];
|
if ($sendemail)
|
||||||
$topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentFailed");
|
{
|
||||||
$content=$langs->transnoentitiesnoconv("NewPaypalPaymentFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
$sendto=$sendemail;
|
||||||
$mailfile = new CMailFile($topic, $sendto, $from, $content);
|
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
// Define link to login card
|
||||||
if ($result)
|
$appli=constant('DOL_APPLICATION_TITLE');
|
||||||
{
|
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
{
|
||||||
}
|
$appli=$conf->global->MAIN_APPLICATION_TITLE;
|
||||||
else
|
if (preg_match('/\d\.\d/', $appli))
|
||||||
{
|
{
|
||||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
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."<br>\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, '_payment');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($_SESSION['ipaddress']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
@ -150,7 +217,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
|||||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||||
|
|
||||||
if (! empty($conf->global->PAYPAL_MESSAGE_KO)) print $conf->global->PAYPAL_MESSAGE_KO;
|
if (! empty($conf->global->PAYMENT_MESSAGE_KO)) print $conf->global->PAYMENT_MESSAGE_KO;
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
* \brief File to show page after a successful payment
|
* \brief File to show page after a successful payment
|
||||||
* This page is called by payment system with url provided to it completed with parameter TOKEN=xxx
|
* This page is called by payment system with url provided to it completed with parameter TOKEN=xxx
|
||||||
* This token can be used to get more informations.
|
* This token can be used to get more informations.
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -88,10 +87,10 @@ if (! empty($conf->paypal->enabled))
|
|||||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
||||||
$PAYPALPAYERID=GETPOST('PAYERID');
|
$PAYPALPAYERID=GETPOST('PAYERID');
|
||||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
||||||
$FULLTAG=GETPOST('FULLTAG');
|
|
||||||
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$FULLTAG=GETPOST('FULLTAG');
|
||||||
|
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
||||||
$source=GETPOST('source');
|
$source=GETPOST('source');
|
||||||
$ref=GETPOST('ref');
|
$ref=GETPOST('ref');
|
||||||
|
|
||||||
@ -116,6 +115,7 @@ else
|
|||||||
$validpaymentmethod=array();
|
$validpaymentmethod=array();
|
||||||
if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
|
if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
|
||||||
if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
|
if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
|
||||||
|
if (! empty($conf->stripe->enabled)) $validpaymentmethod['stripe']='stripe';
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
||||||
@ -169,7 +169,7 @@ if (! empty($conf->paypal->enabled))
|
|||||||
if ($PAYPALTOKEN)
|
if ($PAYPALTOKEN)
|
||||||
{
|
{
|
||||||
// Get on url call
|
// Get on url call
|
||||||
$token = $PAYPALTOKEN;
|
$onlinetoken = $PAYPALTOKEN;
|
||||||
$fulltag = $FULLTAG;
|
$fulltag = $FULLTAG;
|
||||||
$payerID = $PAYPALPAYERID;
|
$payerID = $PAYPALPAYERID;
|
||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
@ -179,17 +179,17 @@ if (! empty($conf->paypal->enabled))
|
|||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
||||||
|
|
||||||
// Validate record
|
// Validate record
|
||||||
if (! empty($paymentType))
|
if (! empty($paymentType))
|
||||||
{
|
{
|
||||||
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
|
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
|
||||||
$resArray=getDetails($token);
|
$resArray=getDetails($onlinetoken);
|
||||||
//var_dump($resarray);
|
//var_dump($resarray);
|
||||||
|
|
||||||
dol_syslog("We call DoExpressCheckoutPayment token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
|
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
|
||||||
$resArray=confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
$resArray=confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
||||||
|
|
||||||
$ack = strtoupper($resArray["ACK"]);
|
$ack = strtoupper($resArray["ACK"]);
|
||||||
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||||
@ -233,6 +233,17 @@ if (! empty($conf->paypal->enabled))
|
|||||||
|
|
||||||
if ($ispaymentok)
|
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'];
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($db);
|
$interface=new Interfaces($db);
|
||||||
@ -250,6 +261,7 @@ if ($ispaymentok)
|
|||||||
// TODO Remove local option to keep only the generic one ?
|
// TODO Remove local option to keep only the generic one ?
|
||||||
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||||
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||||
|
if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
@ -261,8 +273,21 @@ if ($ispaymentok)
|
|||||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$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
|
//$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"];
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
$topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived");
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||||
$content="";
|
$content="";
|
||||||
if (! empty($tmptag['MEM']))
|
if (! empty($tmptag['MEM']))
|
||||||
@ -279,9 +304,9 @@ if ($ispaymentok)
|
|||||||
}
|
}
|
||||||
$content.="<br>\n";
|
$content.="<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("PaymentSystem").': '.$paymentmethod."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
||||||
$content.="tag=".$fulltag." token=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
||||||
|
|
||||||
$ishtml=dol_textishtml($content); // May contain urls
|
$ishtml=dol_textishtml($content); // May contain urls
|
||||||
|
|
||||||
@ -301,6 +326,17 @@ if ($ispaymentok)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// 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'];
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($db);
|
$interface=new Interfaces($db);
|
||||||
@ -322,6 +358,7 @@ else
|
|||||||
// TODO Remove local option to keep only the generic one ?
|
// TODO Remove local option to keep only the generic one ?
|
||||||
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||||
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||||
|
if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
@ -333,15 +370,28 @@ else
|
|||||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$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
|
//$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"];
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
$topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed");
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
|
||||||
$content="";
|
$content="";
|
||||||
$content.=$langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed")."\n";
|
$content.=$langs->transnoentitiesnoconv("PaymentSystemConfirmPaymentPageWasCalledButFailed")."\n";
|
||||||
$content.="\n";
|
$content.="\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("PaymentSystem").': '.$paymentmethod."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
||||||
$content.="tag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
||||||
|
|
||||||
$ishtml=dol_textishtml($content); // May contain urls
|
$ishtml=dol_textishtml($content); // May contain urls
|
||||||
|
|
||||||
|
|||||||
@ -265,7 +265,7 @@ $conf->dol_hide_leftmenu=1;
|
|||||||
|
|
||||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
if (! empty($PAYPAL_API_SANDBOX))
|
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||||
{
|
{
|
||||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||||
}
|
}
|
||||||
@ -418,9 +418,12 @@ if (GETPOST("source") == 'order')
|
|||||||
$result=$order->fetch_thirdparty($order->socid);
|
$result=$order->fetch_thirdparty($order->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$order->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=$order->total_ttc;
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id;
|
$fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id;
|
||||||
//$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," ");
|
||||||
@ -525,9 +528,12 @@ if (GETPOST("source") == 'invoice')
|
|||||||
$result=$invoice->fetch_thirdparty($invoice->socid);
|
$result=$invoice->fetch_thirdparty($invoice->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id;
|
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id;
|
||||||
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
|
||||||
@ -649,35 +655,38 @@ if (GETPOST("source") == 'contractline')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$contractline->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if ($contractline->fk_product)
|
{
|
||||||
{
|
$amount=$contractline->total_ttc;
|
||||||
$product=new Product($db);
|
if ($contractline->fk_product)
|
||||||
$result=$product->fetch($contractline->fk_product);
|
{
|
||||||
|
$product=new Product($db);
|
||||||
|
$result=$product->fetch($contractline->fk_product);
|
||||||
|
|
||||||
// We define price for product (TODO Put this in a method in product class)
|
// We define price for product (TODO Put this in a method in product class)
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
{
|
{
|
||||||
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
||||||
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
||||||
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht = $product->price;
|
$pu_ht = $product->price;
|
||||||
$pu_ttc = $product->price_ttc;
|
$pu_ttc = $product->price_ttc;
|
||||||
$price_base_type = $product->price_base_type;
|
$price_base_type = $product->price_base_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$pu_ttc;
|
$amount=$pu_ttc;
|
||||||
if (empty($amount))
|
if (empty($amount))
|
||||||
{
|
{
|
||||||
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
$amount=price2num($amount);
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||||
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
|
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
|
||||||
@ -827,9 +836,12 @@ if (GETPOST("source") == 'membersubscription')
|
|||||||
$subscription=new Subscription($db);
|
$subscription=new Subscription($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount=$subscription->total_ttc;
|
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
|
||||||
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
{
|
||||||
$amount=price2num($amount);
|
$amount=$subscription->total_ttc;
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||||
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
* \brief File to show page after a failed payment.
|
* \brief File to show page after a failed payment.
|
||||||
* This page is called by paypal with url provided to payal competed with parameter TOKEN=xxx
|
* This page is called by paypal with url provided to payal competed with parameter TOKEN=xxx
|
||||||
* This token can be used to get more informations.
|
* This token can be used to get more informations.
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -63,6 +62,8 @@ if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
|||||||
|
|
||||||
$object = new stdClass(); // For triggers
|
$object = new stdClass(); // For triggers
|
||||||
|
|
||||||
|
$paymentmethod='paypal';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -81,22 +82,12 @@ $tracepost = "";
|
|||||||
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
|
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
|
||||||
|
|
||||||
|
if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($db);
|
|
||||||
$result=$interface->run_triggers('PAYPAL_PAYMENT_KO',$object,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
|
||||||
// Send an email
|
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
|
||||||
{
|
{
|
||||||
// Get on url call
|
// Get on url call
|
||||||
$token = $PAYPALTOKEN;
|
|
||||||
$fulltag = $FULLTAG;
|
$fulltag = $FULLTAG;
|
||||||
$payerID = $PAYPALPAYERID;
|
$onlinetoken = empty($PAYPALTOKEN)?$_SESSION['onlinetoken']:$PAYPALTOKEN;
|
||||||
|
$payerID = empty($PAYPALPAYERID)?$_SESSION['payerID']:$PAYPALPAYERID;
|
||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
@ -104,38 +95,60 @@ if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
|||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
|
// Appel des triggers
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
$interface=new Interfaces($db);
|
||||||
|
$result=$interface->run_triggers('PAYPAL_PAYMENT_KO',$object,$user,$langs,$conf);
|
||||||
|
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
// Send an email
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$sendemail = '';
|
||||||
|
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||||
|
|
||||||
// Define link to login card
|
if ($sendemail)
|
||||||
$appli=constant('DOL_APPLICATION_TITLE');
|
{
|
||||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
$sendto=$sendemail;
|
||||||
{
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
$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"];
|
// Define link to login card
|
||||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentFailed");
|
$appli=constant('DOL_APPLICATION_TITLE');
|
||||||
$content=$langs->transnoentitiesnoconv("NewPaypalPaymentFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
{
|
||||||
$mailfile = new CMailFile($topic, $sendto, $from, $content);
|
$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;
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
if ($result)
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
|
||||||
{
|
$content="";
|
||||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal');
|
$content.=$langs->transnoentitiesnoconv("ValidationOfOnlinePaymentFailed")."\n";
|
||||||
}
|
$content.="\n";
|
||||||
else
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
|
||||||
{
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n";
|
||||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal');
|
$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, '_paypal');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($_SESSION['ipaddress']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
* \brief File to show page after a successful payment
|
* \brief File to show page after a successful payment
|
||||||
* This page is called by paypal with url provided to payal completed with parameter TOKEN=xxx
|
* This page is called by paypal with url provided to payal completed with parameter TOKEN=xxx
|
||||||
* This token can be used to get more informations.
|
* This token can be used to get more informations.
|
||||||
* \author Laurent Destailleur
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -94,6 +93,8 @@ if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
|||||||
|
|
||||||
$object = new stdClass(); // For triggers
|
$object = new stdClass(); // For triggers
|
||||||
|
|
||||||
|
$paymentmethod='paypal';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -128,7 +129,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
|||||||
if ($PAYPALTOKEN)
|
if ($PAYPALTOKEN)
|
||||||
{
|
{
|
||||||
// Get on url call
|
// Get on url call
|
||||||
$token = $PAYPALTOKEN;
|
$onlinetoken = $PAYPALTOKEN;
|
||||||
$fulltag = $FULLTAG;
|
$fulltag = $FULLTAG;
|
||||||
$payerID = $PAYPALPAYERID;
|
$payerID = $PAYPALPAYERID;
|
||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
@ -138,18 +139,18 @@ if ($PAYPALTOKEN)
|
|||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
||||||
|
|
||||||
|
|
||||||
// Validate record
|
// Validate record
|
||||||
if (! empty($paymentType))
|
if (! empty($paymentType))
|
||||||
{
|
{
|
||||||
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_paypal');
|
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_paypal');
|
||||||
$resArray=getDetails($token);
|
$resArray=getDetails($onlinetoken);
|
||||||
//var_dump($resarray);
|
//var_dump($resarray);
|
||||||
|
|
||||||
dol_syslog("We call DoExpressCheckoutPayment token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
|
||||||
$resArray=confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
$resArray=confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
||||||
|
|
||||||
$ack = strtoupper($resArray["ACK"]);
|
$ack = strtoupper($resArray["ACK"]);
|
||||||
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||||
@ -202,7 +203,7 @@ if ($PAYPALTOKEN)
|
|||||||
else $appli.=" ".DOL_VERSION;
|
else $appli.=" ".DOL_VERSION;
|
||||||
|
|
||||||
$urlback=$_SERVER["REQUEST_URI"];
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived");
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||||
$content="";
|
$content="";
|
||||||
if (! empty($tmptag['MEM']))
|
if (! empty($tmptag['MEM']))
|
||||||
@ -215,12 +216,13 @@ if ($PAYPALTOKEN)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content.=$langs->transnoentitiesnoconv("NewPaypalPaymentReceived")."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n";
|
||||||
}
|
}
|
||||||
$content.="<br>\n";
|
$content.="<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
||||||
$content.="tag=".$fulltag." token=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
||||||
|
|
||||||
$ishtml=dol_textishtml($content); // May contain urls
|
$ishtml=dol_textishtml($content); // May contain urls
|
||||||
|
|
||||||
@ -285,13 +287,14 @@ if ($PAYPALTOKEN)
|
|||||||
else $appli.=" ".DOL_VERSION;
|
else $appli.=" ".DOL_VERSION;
|
||||||
|
|
||||||
$urlback=$_SERVER["REQUEST_URI"];
|
$urlback=$_SERVER["REQUEST_URI"];
|
||||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed");
|
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
|
||||||
$content="";
|
$content="";
|
||||||
$content.=$langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed")."\n";
|
$content.=$langs->transnoentitiesnoconv("PaymentSystemConfirmPaymentPageWasCalledButFailed")."\n";
|
||||||
$content.="\n";
|
$content.="\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."\n";
|
||||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
||||||
$content.="tag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
||||||
|
|
||||||
$ishtml=dol_textishtml($content); // May contain urls
|
$ishtml=dol_textishtml($content); // May contain urls
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/public/paybox/index.php
|
* \file htdocs/public/stripe/index.php
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \brief A redirect page to an error
|
* \brief A redirect page to an error
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
165
htdocs/public/stripe/paymentko.php
Normal file
165
htdocs/public/stripe/paymentko.php
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.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/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='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
|
$conf->dol_hide_topmenu=1;
|
||||||
|
$conf->dol_hide_leftmenu=1;
|
||||||
|
|
||||||
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
|
||||||
|
// Show ko message
|
||||||
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
|
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||||
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||||
|
|
||||||
|
if (! empty($conf->global->STRIPE_MESSAGE_KO)) print $conf->global->STRIPE_MESSAGE_KO;
|
||||||
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter('', 'public');
|
||||||
|
|
||||||
|
$db->close();
|
||||||
199
htdocs/public/stripe/paymentok.php
Normal file
199
htdocs/public/stripe/paymentok.php
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.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/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='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
|
$conf->dol_hide_topmenu=1;
|
||||||
|
$conf->dol_hide_leftmenu=1;
|
||||||
|
|
||||||
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Show message
|
||||||
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
|
print '<div id="dolpaymentdiv" align="center">'."\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")."<br>\n";
|
||||||
|
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\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")."<br>\n";
|
||||||
|
$content.=$langs->trans("MemberId").': '.$tmptag['MEM']."<br>\n";
|
||||||
|
$content.=$langs->trans("Link").': <a href="'.$url.'">'.$url.'</a>'."<br>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n";
|
||||||
|
}
|
||||||
|
$content.="<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n";
|
||||||
|
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\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</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter('', 'public');
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -47,15 +47,15 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
|
|
||||||
$result=dolibarr_set_const($db, "STRIPE_LIVE",GETPOST('STRIPE_LIVE','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_LIVE",GETPOST('STRIPE_LIVE','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_TEST_SECRET_KEY",GETPOST('STRIPE_TEST_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
|
||||||
if (! $result > 0) $error++;
|
|
||||||
$result=dolibarr_set_const($db, "STRIPE_TEST_PUBLISHABLE_KEY",GETPOST('STRIPE_TEST_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_TEST_PUBLISHABLE_KEY",GETPOST('STRIPE_TEST_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_TEST_SECRET_KEY",GETPOST('STRIPE_TEST_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_LIVE_PUBLISHABLE_KEY",GETPOST('STRIPE_LIVE_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_LIVE_PUBLISHABLE_KEY",GETPOST('STRIPE_LIVE_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_CREDITOR",GETPOST('STRIPE_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
if (! $result > 0) $error++;
|
||||||
|
$result=dolibarr_set_const($db, "STRIPE_CREDITOR",GETPOST('STRIPE_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_CSS_URL",GETPOST('STRIPE_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_CSS_URL",GETPOST('STRIPE_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
@ -63,6 +63,8 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_KO",GETPOST('STRIPE_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_KO",GETPOST('STRIPE_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
|
$result=dolibarr_set_const($db, "STRIPE_PAYONLINE_SENDEMAIL",GETPOST('STRIPE_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||||
|
if (! $result > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -91,21 +93,22 @@ if ($action=="setlive")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$SECRET_TEST_KEY="sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test secret key
|
//$SECRET_TEST_KEY="sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test secret key
|
||||||
if (empty($conf->global->STRIPE_TEST_SECRET_KEY)) $conf->global->STRIPE_TEST_SECRET_KEY = $SECRET_TEST_KEY;
|
//if (empty($conf->global->STRIPE_TEST_SECRET_KEY)) $conf->global->STRIPE_TEST_SECRET_KEY = $SECRET_TEST_KEY;
|
||||||
$PUBLISHABLE_TEST_KEY="pk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test publishable key
|
//$PUBLISHABLE_TEST_KEY="pk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test publishable key
|
||||||
if (empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY)) $conf->global->STRIPE_TEST_PUBLISHABLE_KEY = $PUBLISHABLE_TEST_KEY;
|
//if (empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY)) $conf->global->STRIPE_TEST_PUBLISHABLE_KEY = $PUBLISHABLE_TEST_KEY;
|
||||||
|
|
||||||
$SECRET_LIVE_KEY="sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe live secret key
|
//$SECRET_LIVE_KEY="sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe live secret key
|
||||||
if (empty($conf->global->STRIPE_LIVE_SECRET_KEY)) $conf->global->STRIPE_LIVE_SECRET_KEY = $SECRET_LIVE_KEY;
|
//if (empty($conf->global->STRIPE_LIVE_SECRET_KEY)) $conf->global->STRIPE_LIVE_SECRET_KEY = $SECRET_LIVE_KEY;
|
||||||
$PUBLISHABLE_LIVE_KEY="pk_live_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe live publishable key
|
//$PUBLISHABLE_LIVE_KEY="pk_live_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe live publishable key
|
||||||
if (empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY)) $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY = $PUBLISHABLE_LIVE_KEY;
|
//if (empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY)) $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY = $PUBLISHABLE_LIVE_KEY;
|
||||||
|
|
||||||
llxHeader('',$langs->trans("StripeSetup"));
|
llxHeader('',$langs->trans("StripeSetup"));
|
||||||
|
|
||||||
@ -145,28 +148,28 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
|
||||||
print '<span class="titlefield fieldrequired">'.$langs->trans("STRIPE_TEST_SECRET_KEY").'</span></td><td>';
|
|
||||||
print '<input size="32" type="text" name="STRIPE_TEST_SECRET_KEY" value="'.$conf->global->STRIPE_TEST_SECRET_KEY.'">';
|
|
||||||
print '<br>'.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<span class="fieldrequired">'.$langs->trans("STRIPE_TEST_PUBLISHABLE_KEY").'</span></td><td>';
|
print '<span class="fieldrequired">'.$langs->trans("STRIPE_TEST_PUBLISHABLE_KEY").'</span></td><td>';
|
||||||
print '<input size="32" type="text" name="STRIPE_TEST_PUBLISHABLE_KEY" value="'.$conf->global->STRIPE_TEST_PUBLISHABLE_KEY.'">';
|
print '<input class="minwidth300" type="text" name="STRIPE_TEST_PUBLISHABLE_KEY" value="'.$conf->global->STRIPE_TEST_PUBLISHABLE_KEY.'">';
|
||||||
print '<br>'.$langs->trans("Example").': pk_test_xxxxxxxxxxxxxxxxxxxxxxxx';
|
print ' '.$langs->trans("Example").': pk_test_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_SECRET_KEY").'</span></td><td>';
|
print '<span class="titlefield fieldrequired">'.$langs->trans("STRIPE_TEST_SECRET_KEY").'</span></td><td>';
|
||||||
print '<input size="32" type="text" name="STRIPE_LIVE_SECRET_KEY" value="'.$conf->global->STRIPE_LIVE_SECRET_KEY.'">';
|
print '<input class="minwidth300" type="text" name="STRIPE_TEST_SECRET_KEY" value="'.$conf->global->STRIPE_TEST_SECRET_KEY.'">';
|
||||||
print '<br>'.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx';
|
print ' '.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_PUBLISHABLE_KEY").'</span></td><td>';
|
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_PUBLISHABLE_KEY").'</span></td><td>';
|
||||||
print '<input size="32" type="text" name="STRIPE_LIVE_PUBLISHABLE_KEY" value="'.$conf->global->STRIPE_LIVE_PUBLISHABLE_KEY.'">';
|
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_PUBLISHABLE_KEY" value="'.$conf->global->STRIPE_LIVE_PUBLISHABLE_KEY.'">';
|
||||||
print '<br>'.$langs->trans("Example").': pk_live_xxxxxxxxxxxxxxxxxxxxxxxx';
|
print ' '.$langs->trans("Example").': pk_live_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_SECRET_KEY").'</span></td><td>';
|
||||||
|
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_SECRET_KEY" value="'.$conf->global->STRIPE_LIVE_SECRET_KEY.'">';
|
||||||
|
print ' '.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -182,13 +185,13 @@ print "</tr>\n";
|
|||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("VendorName").'</td><td>';
|
print $langs->trans("VendorName").'</td><td>';
|
||||||
print '<input size="64" type="text" name="STRIPE_CREDITOR" value="'.$conf->global->STRIPE_CREDITOR.'">';
|
print '<input size="64" type="text" name="STRIPE_CREDITOR" value="'.$conf->global->STRIPE_CREDITOR.'">';
|
||||||
print '<br>'.$langs->trans("Example").': '.$mysoc->name;
|
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||||
print '<input size="64" type="text" name="STRIPE_CSS_URL" value="'.$conf->global->STRIPE_CSS_URL.'">';
|
print '<input size="64" type="text" name="STRIPE_CSS_URL" value="'.$conf->global->STRIPE_CSS_URL.'">';
|
||||||
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
|
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
@ -203,6 +206,12 @@ $doleditor=new DolEditor('STRIPE_MESSAGE_KO',$conf->global->STRIPE_MESSAGE_KO,''
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print $langs->trans("STRIPE_PAYONLINE_SENDEMAIL").'</td><td>';
|
||||||
|
print '<input size="32" type="email" name="STRIPE_PAYONLINE_SENDEMAIL" value="'.$conf->global->STRIPE_PAYONLINE_SENDEMAIL.'">';
|
||||||
|
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
@ -17,21 +17,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file stripe/config.php
|
* \file htdocs/public/stripe/config.php
|
||||||
* \ingroup Stripe
|
* \ingroup Stripe
|
||||||
* \brief Page to move config in api
|
* \brief Page to move config in api
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
||||||
|
|
||||||
|
global $stripe;
|
||||||
|
global $conf;
|
||||||
|
|
||||||
//use \includes\stripe as stripe;
|
//use \includes\stripe as stripe;
|
||||||
$stripe = array();
|
$stripe = array();
|
||||||
|
|
||||||
if(empty($conf->global->SKYPE_LIVE))
|
if (empty($conf->global->SKYPE_LIVE))
|
||||||
{
|
{
|
||||||
$stripe = array(
|
$stripe = array(
|
||||||
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
|
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
|
||||||
@ -46,4 +47,7 @@ else
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
\includes\stripe::setApiKey($stripe['secret_key']);
|
require_once DOL_DOCUMENT_ROOT."/includes/stripe/lib/Stripe.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
|
||||||
|
\Stripe\Stripe::setApiKey($stripe['secret_key']);
|
||||||
@ -73,6 +73,7 @@ function showStripePaymentUrl($type,$ref)
|
|||||||
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
||||||
$url=getStripePaymentUrl(0,$type,$ref);
|
$url=getStripePaymentUrl(0,$type,$ref);
|
||||||
$out.='<input type="text" id="stripeurl" class="quatrevingtpercent" value="'.$url.'"><br>';
|
$out.='<input type="text" id="stripeurl" class="quatrevingtpercent" value="'.$url.'"><br>';
|
||||||
|
$out.=ajax_autoselect("stripeurl", 0);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user