Work on merging all payment modes in one page
This commit is contained in:
parent
8f34de1036
commit
9146bb336e
@ -628,9 +628,10 @@ class Form
|
||||
* @param string $htmloption Options html on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300')
|
||||
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300',$usecodeaskey='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -684,11 +685,11 @@ class Form
|
||||
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
|
||||
{
|
||||
$foundselected=true;
|
||||
$out.= '<option value="'.$row['rowid'].'" selected>';
|
||||
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.$row['rowid'].'">';
|
||||
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
|
||||
}
|
||||
$out.= dol_trunc($row['label'],$maxlength,'middle');
|
||||
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';
|
||||
|
||||
@ -304,7 +304,7 @@ class FormActions
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.=$form->selectarray($htmlname, $arraylist, $selected);
|
||||
$out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
}
|
||||
|
||||
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
|
||||
|
||||
@ -201,5 +201,11 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
||||
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
|
||||
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_KO' where name = 'PAYPAL_MESSAGE_KO';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_CREDITOR' where name = 'PAYPAL_CREDITOR';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_CSS_URL' where name = 'PAYPAL_CSS_URL';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NEWFORMTEXT';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO';
|
||||
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ ToComplete=To complete
|
||||
YourEMail=Email to receive payment confirmation
|
||||
Creditor=Creditor
|
||||
PaymentCode=Payment code
|
||||
PayBoxDoPayment=Go on payment
|
||||
PayBoxDoPayment=Pay with Credit or Debit Card (Paybox)
|
||||
ToPay=Do payment
|
||||
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
|
||||
Continue=Next
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Dolibarr language file - Source file is en_US - paypal
|
||||
PaypalSetup=PayPal module setup
|
||||
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||
PaypalOrCBDoPayment=Pay with credit card or Paypal
|
||||
PaypalOrCBDoPayment=Pay with Paypal (Credit Card or Paypal)
|
||||
PaypalDoPayment=Pay with Paypal
|
||||
PAYPAL_API_SANDBOX=Mode test/sandbox
|
||||
PAYPAL_API_USER=API username
|
||||
@ -11,14 +11,14 @@ PAYPAL_SSLVERSION=Curl SSL Version
|
||||
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
|
||||
PaypalModeIntegral=Integral
|
||||
PaypalModeOnlyPaypal=PayPal only
|
||||
PAYPAL_CSS_URL=Optionnal URL of CSS style sheet on payment page
|
||||
ONLINE_PAYMENT_CSS_URL=Optionnal URL of CSS style sheet on online payment page
|
||||
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
|
||||
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 %s "sandbox" mode
|
||||
NewOnlinePaymentReceived=New online payment received
|
||||
NewOnlinePaymentFailed=New online payment tried but failed
|
||||
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||
ONLINE_PAYMENT_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||
ReturnURLAfterPayment=Return URL after payment
|
||||
ValidationOfOnlinePaymentFailed=Validation of online payment failed
|
||||
PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error
|
||||
|
||||
@ -12,7 +12,7 @@ YourEMail=Email to receive payment confirmation
|
||||
STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||
Creditor=Creditor
|
||||
PaymentCode=Payment code
|
||||
StripeDoPayment=Go on payment
|
||||
StripeDoPayment=Pay with Credit or Debit Card (Stripe)
|
||||
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
|
||||
Continue=Next
|
||||
ToOfferALinkForOnlinePayment=URL for %s payment
|
||||
|
||||
@ -35,7 +35,7 @@ $langs->load("paybox");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
|
||||
@ -53,17 +53,17 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",GETPOST('PAYBOX_PBX_IDENTIFIANT','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CREDITOR",GETPOST('PAYBOX_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_CSS_URL",GETPOST('PAYBOX_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_OK",GETPOST('PAYBOX_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_KO",GETPOST('ONLINE_PAYMENT_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -170,35 +170,35 @@ print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("VendorName").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYBOX_CREDITOR" value="'.$conf->global->PAYBOX_CREDITOR.'">';
|
||||
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
|
||||
print '<br>'.$langs->trans("Example").': '.$mysoc->name;
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYBOX_CSS_URL" value="'.$conf->global->PAYBOX_CSS_URL.'">';
|
||||
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageOK").'</td><td>';
|
||||
$doleditor=new DolEditor('PAYBOX_MESSAGE_OK',$conf->global->PAYBOX_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageKO").'</td><td>';
|
||||
$doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
|
||||
print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
|
||||
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ $action = GETPOST('action','alpha');
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST('PAYPAL_API_USER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",GETPOST('PAYPAL_API_PASSWORD','alpha'),'chaine',0,'',$conf->entity);
|
||||
@ -52,11 +52,11 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_SSLVERSION",GETPOST('PAYPAL_SSLVERSION','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_CREDITOR",GETPOST('PAYPAL_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_CSS_URL",GETPOST('PAYPAL_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST('PAYPAL_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
@ -64,13 +64,13 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST('PAYPAL_MESSAGE_OK'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -209,7 +209,7 @@ print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||
print '<input size="64" type="text" name="PAYPAL_CSS_URL" value="'.$conf->global->PAYPAL_CSS_URL.'">';
|
||||
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -222,21 +222,21 @@ print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageOK").'</td><td>';
|
||||
$doleditor=new DolEditor('PAYPAL_MESSAGE_OK',$conf->global->PAYPAL_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageKO").'</td><td>';
|
||||
$doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
|
||||
print '<input size="32" type="email" name="PAYPAL_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYPAL_PAYONLINE_SENDEMAIL.'">';
|
||||
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
|
||||
if (! empty($desc)) $nvpstr = $nvpstr . "&DESC=" . urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
|
||||
|
||||
|
||||
$_SESSION["Payment_Amount"] = $paymentAmount;
|
||||
$_SESSION["FinalPaymentAmt"] = $paymentAmount;
|
||||
$_SESSION["currencyCodeType"] = $currencyCodeType;
|
||||
$_SESSION["PaymentType"] = $paymentType;
|
||||
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR ']; // Payer ip
|
||||
|
||||
@ -164,7 +164,7 @@ print '<!-- Form to sign -->'."\n";
|
||||
|
||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
|
||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
// Define logo and logosmall
|
||||
$logosmall=$mysoc->logo_small;
|
||||
|
||||
@ -162,7 +162,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
||||
*/
|
||||
|
||||
$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->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -171,9 +171,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
|
||||
|
||||
// Common variables
|
||||
$creditor=$mysoc->name;
|
||||
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
|
||||
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
|
||||
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||
|
||||
// Check link validity
|
||||
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||
@ -194,7 +194,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">';
|
||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">';
|
||||
print "\n";
|
||||
print '<!-- Form to send a Paybox payment -->'."\n";
|
||||
print '<!-- PAYBOX_CREDITOR = '.$conf->global->PAYPAL_CREDITOR.' -->'."\n";
|
||||
print '<!-- ONLINE_PAYMENT_CREDITOR = '.$conf->global->ONLINE_PAYMENT_CREDITOR.' -->'."\n";
|
||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||
print '<!-- urlok = '.$urlok.' -->'."\n";
|
||||
print '<!-- urlko = '.$urlko.' -->'."\n";
|
||||
@ -202,14 +202,14 @@ print "\n";
|
||||
|
||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
|
||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
// Define logo and logosmall
|
||||
$logosmall=$mysoc->logo_small;
|
||||
$logo=$mysoc->logo;
|
||||
$paramlogo='PAYBOX_LOGO_'.$suffix;
|
||||
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo='';
|
||||
@ -234,11 +234,11 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text='';
|
||||
if (! empty($conf->global->PAYBOX_NEWFORM_TEXT))
|
||||
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||
{
|
||||
$langs->load("members");
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYBOX_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYBOX_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
|
||||
@ -82,26 +82,26 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// 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('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
// Send an email
|
||||
$sendemail = '';
|
||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
|
||||
if ($sendemail)
|
||||
{
|
||||
$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))
|
||||
@ -114,7 +114,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
|
||||
$content="";
|
||||
@ -126,7 +126,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
$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)
|
||||
{
|
||||
@ -137,12 +137,12 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($_SESSION['ipaddress']);
|
||||
}
|
||||
|
||||
$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->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -156,7 +156,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
|
||||
|
||||
if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
|
||||
|
||||
|
||||
$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->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -105,7 +105,7 @@ $fulltag = $FULLTAG;
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
@ -115,7 +115,7 @@ dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$payment
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
|
||||
|
||||
if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||
|
||||
|
||||
// Appel des triggers
|
||||
@ -127,9 +127,9 @@ if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
|
||||
|
||||
// Send an email
|
||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||
{
|
||||
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
||||
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
@ -148,7 +148,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||
|
||||
@ -16,8 +16,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For paypal test: https://developer.paypal.com/
|
||||
* For paybox test: ???
|
||||
* For Paypal test: https://developer.paypal.com/
|
||||
* For Paybox test: ???
|
||||
* For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -52,7 +53,7 @@ $langs->load("companies");
|
||||
$langs->load("errors");
|
||||
$langs->load("paybox"); // File with generic data
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$action=GETPOST('action','aZ09');
|
||||
|
||||
// Input are:
|
||||
// type ('invoice','order','contractline'),
|
||||
@ -160,6 +161,7 @@ if (! empty($conf->paypal->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||
|
||||
// Check parameters
|
||||
$PAYPAL_API_OK="";
|
||||
if ($urlok) $PAYPAL_API_OK=$urlok;
|
||||
$PAYPAL_API_KO="";
|
||||
@ -180,29 +182,6 @@ if (! empty($conf->paypal->enabled))
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check security token
|
||||
$valid=true;
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
|
||||
{
|
||||
if ($SOURCE && $REF) $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $SOURCE . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical
|
||||
else $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$token = $conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
}
|
||||
if ($SECUREKEY != $token) $valid=false;
|
||||
|
||||
if (! $valid)
|
||||
{
|
||||
print '<div class="error">Bad value for key.</div>';
|
||||
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$validpaymentmethod['paypal']='valid';
|
||||
}
|
||||
|
||||
@ -212,10 +191,24 @@ if (! empty($conf->paybox->enabled))
|
||||
|
||||
// TODO
|
||||
|
||||
$validpaymentmethod['paybox']='valid';
|
||||
$validpaymentmethod['paybox']='valid';
|
||||
}
|
||||
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
$langs->load("stripe");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php';
|
||||
/* already included into /stripe/config.php
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
||||
*/
|
||||
|
||||
$validpaymentmethod['stripe']='valid';
|
||||
}
|
||||
|
||||
// TODO Add check of other payment mode
|
||||
|
||||
|
||||
// Check security token
|
||||
@ -242,9 +235,18 @@ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
||||
}
|
||||
|
||||
|
||||
if (empty($validpaymentmethod))
|
||||
{
|
||||
print 'No active payment module (Paypal, Stripe, Paybox, ...)';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
||||
// Common variables
|
||||
$creditor=$mysoc->name;
|
||||
$paramcreditor='ONLINE_PAYMENT_CREDITOR';
|
||||
$paramcreditorlong='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||
if (! empty($conf->global->$paramcreditorlong)) $creditor=$conf->global->$paramcreditorlong;
|
||||
else if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||
|
||||
|
||||
|
||||
@ -252,7 +254,6 @@ if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'dopayment')
|
||||
{
|
||||
if ($paymentmethod == 'paypal')
|
||||
@ -312,7 +313,7 @@ if ($action == 'dopayment')
|
||||
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
||||
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
||||
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
||||
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
||||
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
|
||||
|
||||
// A redirect is added if API call successfull
|
||||
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
||||
@ -320,6 +321,162 @@ if ($action == 'dopayment')
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($paymentmethod == 'paybox')
|
||||
{
|
||||
$PRICE=price2num(GETPOST("newamount"),'MT');
|
||||
$email=GETPOST("email");
|
||||
|
||||
$origfulltag=GETPOST("fulltag",'alpha');
|
||||
|
||||
$mesg='';
|
||||
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
||||
elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
|
||||
elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email);
|
||||
elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
|
||||
elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok;
|
||||
elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko;
|
||||
|
||||
if (empty($mesg))
|
||||
{
|
||||
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
|
||||
|
||||
print_paybox_redirect($PRICE, $conf->currency, $email, $urlok, $urlko, $FULLTAG);
|
||||
|
||||
session_destroy();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($paymentmethod == 'stripe')
|
||||
{
|
||||
if (GETPOST('newamount')) $amount = GETPOST('newamount');
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'charge')
|
||||
{
|
||||
// Correct the amount according to unit of currency
|
||||
// See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support
|
||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||
if (! in_array($currency, $arrayzerounitcurrency)) $amount=$amount * 100;
|
||||
|
||||
dol_syslog("POST keys : ".join(',', array_keys($_POST)), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe');
|
||||
|
||||
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||
$email = GETPOST("stripeEmail",'alpha');
|
||||
|
||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe');
|
||||
|
||||
$error = 0;
|
||||
|
||||
try {
|
||||
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
||||
$customer = \Stripe\Customer::create(array(
|
||||
'email' => $email,
|
||||
'description' => ($email?'Customer for '.$email:null),
|
||||
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
||||
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
|
||||
));
|
||||
// TODO Add 'business_vat_id' ?
|
||||
|
||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
'customer' => $customer->id,
|
||||
'amount' => price2num($amount, 'MU'),
|
||||
'currency' => $currency,
|
||||
'description' => 'Stripe payment: '.$FULLTAG,
|
||||
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name),
|
||||
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
||||
));
|
||||
} catch(\Stripe\Error\Card $e) {
|
||||
// Since it's a decline, \Stripe\Error\Card will be caught
|
||||
$body = $e->getJsonBody();
|
||||
$err = $body['error'];
|
||||
|
||||
print('Status is:' . $e->getHttpStatus() . "\n");
|
||||
print('Type is:' . $err['type'] . "\n");
|
||||
print('Code is:' . $err['code'] . "\n");
|
||||
// param is '' in this case
|
||||
print('Param is:' . $err['param'] . "\n");
|
||||
print('Message is:' . $err['message'] . "\n");
|
||||
|
||||
$error++;
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
$action='';
|
||||
} catch (\Stripe\Error\RateLimit $e) {
|
||||
// Too many requests made to the API too quickly
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
} catch (\Stripe\Error\InvalidRequest $e) {
|
||||
// Invalid parameters were supplied to Stripe's API
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
} catch (\Stripe\Error\Authentication $e) {
|
||||
// Authentication with Stripe's API failed
|
||||
// (maybe you changed API keys recently)
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
} catch (\Stripe\Error\ApiConnection $e) {
|
||||
// Network communication with Stripe failed
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
} catch (\Stripe\Error\Base $e) {
|
||||
// Display a very generic error to the user, and maybe send
|
||||
// yourself an email
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
} catch (Exception $e) {
|
||||
// Something else happened, completely unrelated to Stripe
|
||||
$error++;
|
||||
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
$_SESSION["onlinetoken"] = $stripeToken;
|
||||
$_SESSION["FinalPaymentAmt"] = $amount;
|
||||
$_SESSION["currencyCodeType"] = $currency;
|
||||
$_SESSION["paymentType"] = '';
|
||||
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
|
||||
$_SESSION['payerID'] = is_object($customer)?$customer->id:'';
|
||||
$_SESSION['TRANSACTIONID'] = is_object($charge)?$charge->id:'';
|
||||
|
||||
dol_syslog("Action charge stripe result=".$error." ip=".$_SESSION['ipaddress'], LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Now call the redirect to paymentok or paymentko", LOG_DEBUG, 0, '_stripe');
|
||||
|
||||
if ($error)
|
||||
{
|
||||
header("Location: ".$urlko);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$urlok);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +485,7 @@ if ($action == 'dopayment')
|
||||
*/
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -345,19 +502,17 @@ if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', '
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
// Common variables
|
||||
$creditor=$mysoc->name;
|
||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
||||
|
||||
if (! empty($PAYPAL_API_SANDBOX))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||
}
|
||||
// Show sandbox warning
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning');
|
||||
}
|
||||
if (! empty($conf->stripe->enabled) && empty($conf->global->STRIPE_LIVE))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
|
||||
}
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
print '<div class="center">'."\n";
|
||||
@ -370,32 +525,35 @@ print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print "\n";
|
||||
print '<!-- Form to send a payment -->'."\n";
|
||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||
// Additionnal information for each payment system
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
|
||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||
}
|
||||
if (! empty($conf->paybox->enabled))
|
||||
{
|
||||
|
||||
}
|
||||
// TODO Add others
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n";
|
||||
}
|
||||
print '<!-- urlok = '.$urlok.' -->'."\n";
|
||||
print '<!-- urlko = '.$urlko.' -->'."\n";
|
||||
print "\n";
|
||||
|
||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
|
||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
// Define logo and logosmall
|
||||
$logosmall=$mysoc->logo_small;
|
||||
$logo=$mysoc->logo;
|
||||
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo='';
|
||||
@ -420,11 +578,11 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text='';
|
||||
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
|
||||
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||
{
|
||||
$langs->load("members");
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
@ -1067,25 +1225,27 @@ if ($action != 'dopayment')
|
||||
|
||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
||||
{
|
||||
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
|
||||
print '<br><input class="button buttonpayment buttonpaymentpaypal" 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").'">';
|
||||
print '<br><input class="button buttonpayment buttonpaymentpaypal" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->paybox->enabled))
|
||||
{
|
||||
|
||||
|
||||
print '<br><input class="button buttonpayment buttonpaymentpaybox" type="submit" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
|
||||
}
|
||||
|
||||
// TODO Other methods
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
print '<br><input class="button buttonpayment buttonpaymentstripe" type="submit" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error_email('ERRORNEWPAYMENTPAYPAL');
|
||||
dol_print_error_email('ERRORNEWPAYMENT');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1101,6 +1261,183 @@ print '</div>'."\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Add more content on page for some services
|
||||
if (preg_match('/^dopayment/',$action))
|
||||
{
|
||||
|
||||
// Strip
|
||||
if (GETPOST('dopayment_stripe','alpha'))
|
||||
{
|
||||
// Simple checkout
|
||||
/*
|
||||
print '<script src="https://checkout.stripe.com/checkout.js"
|
||||
class="stripe-button"
|
||||
data-key="'.$stripe['publishable_key'].'"
|
||||
data-amount="'.$ttc.'"
|
||||
data-currency="'.$conf->currency.'"
|
||||
data-description="'.$ref.'">
|
||||
</script>';
|
||||
*/
|
||||
|
||||
// Personalized checkout
|
||||
print '<style>
|
||||
/**
|
||||
* The CSS shown here will not be introduced in the Quickstart guide, but shows
|
||||
* how you can use CSS to style your Element s container.
|
||||
*/
|
||||
.StripeElement {
|
||||
background-color: white;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
box-shadow: 0 1px 3px 0 #e6ebf1;
|
||||
-webkit-transition: box-shadow 150ms ease;
|
||||
transition: box-shadow 150ms ease;
|
||||
}
|
||||
|
||||
.StripeElement--focus {
|
||||
box-shadow: 0 1px 3px 0 #cfd7df;
|
||||
}
|
||||
|
||||
.StripeElement--invalid {
|
||||
border-color: #fa755a;
|
||||
}
|
||||
|
||||
.StripeElement--webkit-autofill {
|
||||
background-color: #fefde5 !important;
|
||||
}
|
||||
</style>';
|
||||
|
||||
print '
|
||||
|
||||
<br>
|
||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">';
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
print '<input type="hidden" name="dopayment_stripe" value="1">'."\n";
|
||||
print '<input type="hidden" name="action" value="charge">'."\n";
|
||||
print '<input type="hidden" name="tag" value="'.$TAG.'">'."\n";
|
||||
print '<input type="hidden" name="source" value="'.$SOURCE.'">'."\n";
|
||||
print '<input type="hidden" name="ref" value="'.$REF.'">'."\n";
|
||||
print '<input type="hidden" name="fulltag" value="'.$FULLTAG.'">'."\n";
|
||||
print '<input type="hidden" name="suffix" value="'.$suffix.'">'."\n";
|
||||
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
|
||||
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
|
||||
|
||||
print '
|
||||
<table id="dolpaymenttable" summary="Payment form" class="center">
|
||||
<tbody><tr><td class="textpublicpayment">
|
||||
|
||||
<div class="form-row left">
|
||||
<label for="card-element">
|
||||
Credit or debit card
|
||||
</label>
|
||||
<div id="card-element">
|
||||
<!-- a Stripe Element will be inserted here. -->
|
||||
</div>
|
||||
|
||||
<!-- Used to display form errors -->
|
||||
<div id="card-errors" role="alert"></div>
|
||||
</div>
|
||||
<br>
|
||||
<button class="button" id="buttontopay">'.$langs->trans("ToPay").'</button>
|
||||
<img id="hourglasstopay" class="hidden" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/working.gif'.'">
|
||||
</td></tr></tbody></table>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<script src="https://js.stripe.com/v2/"></script>
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
|
||||
<script type="text/javascript" language="javascript">';
|
||||
?>
|
||||
|
||||
// Create a Stripe client
|
||||
var stripe = Stripe('<?php echo $stripe['publishable_key']; ?>');
|
||||
|
||||
// Create an instance of Elements
|
||||
var elements = stripe.elements();
|
||||
|
||||
// Custom styling can be passed to options when creating an Element.
|
||||
// (Note that this demo uses a wider set of styles than the guide below.)
|
||||
var style = {
|
||||
base: {
|
||||
color: '#32325d',
|
||||
lineHeight: '24px',
|
||||
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
|
||||
fontSmoothing: 'antialiased',
|
||||
fontSize: '16px',
|
||||
'::placeholder': {
|
||||
color: '#aab7c4'
|
||||
}
|
||||
},
|
||||
invalid: {
|
||||
color: '#fa755a',
|
||||
iconColor: '#fa755a'
|
||||
}
|
||||
};
|
||||
|
||||
// Create an instance of the card Element
|
||||
var card = elements.create('card', {style: style});
|
||||
|
||||
// Add an instance of the card Element into the `card-element` <div>
|
||||
card.mount('#card-element');
|
||||
|
||||
// Handle real-time validation errors from the card Element.
|
||||
card.addEventListener('change', function(event) {
|
||||
var displayError = document.getElementById('card-errors');
|
||||
if (event.error) {
|
||||
displayError.textContent = event.error.message;
|
||||
} else {
|
||||
displayError.textContent = '';
|
||||
}
|
||||
});
|
||||
|
||||
// Handle form submission
|
||||
var form = document.getElementById('payment-form');
|
||||
console.log(form);
|
||||
form.addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
stripe.createToken(card).then(function(result) {
|
||||
if (result.error) {
|
||||
// Inform the user if there was an error
|
||||
var errorElement = document.getElementById('card-errors');
|
||||
errorElement.textContent = result.error.message;
|
||||
} else {
|
||||
// Send the token to your server
|
||||
stripeTokenHandler(result.token);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function stripeTokenHandler(token) {
|
||||
// Insert the token ID into the form so it gets submitted to the server
|
||||
var form = document.getElementById('payment-form');
|
||||
var hiddenInput = document.createElement('input');
|
||||
hiddenInput.setAttribute('type', 'hidden');
|
||||
hiddenInput.setAttribute('name', 'stripeToken');
|
||||
hiddenInput.setAttribute('value', token.id);
|
||||
form.appendChild(hiddenInput);
|
||||
|
||||
// Submit the form
|
||||
jQuery('#buttontopay').hide();
|
||||
jQuery('#hourglasstopay').show();
|
||||
console.log("submit");
|
||||
form.submit();
|
||||
}
|
||||
|
||||
<?php
|
||||
print '</script>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
||||
|
||||
llxFooter('', 'public');
|
||||
|
||||
@ -51,6 +51,7 @@ $langs->load("bills");
|
||||
$langs->load("companies");
|
||||
$langs->load("paybox");
|
||||
$langs->load("paypal");
|
||||
$langs->load("stripe");
|
||||
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
@ -59,7 +60,12 @@ if (! empty($conf->paypal->enabled))
|
||||
$PAYPALPAYERID=GETPOST('PAYERID');
|
||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
||||
}
|
||||
// TODO Other payment method
|
||||
if (! empty($conf->paybox->enabled))
|
||||
{
|
||||
}
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
}
|
||||
|
||||
$FULLTAG=GETPOST('FULLTAG');
|
||||
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
||||
@ -106,7 +112,7 @@ $object = new stdClass(); // For triggers
|
||||
* 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, '_payment');
|
||||
dol_syslog("Callback url when an online payment is canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$tracepost = "";
|
||||
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||
@ -122,48 +128,29 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION['FinalPaymentAmt'];
|
||||
// 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
|
||||
|
||||
|
||||
// Send an email
|
||||
$sendemail = '';
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
||||
{
|
||||
$sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
}
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||
{
|
||||
$sendemail = $conf->global->ONLINE_PAYMENT_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($sendemail)
|
||||
{
|
||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||
$sendto=$sendemail;
|
||||
|
||||
|
||||
// Define link to login card
|
||||
$appli=constant('DOL_APPLICATION_TITLE');
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||
@ -176,7 +163,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
|
||||
$content="";
|
||||
@ -188,7 +175,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
$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)
|
||||
{
|
||||
@ -199,12 +186,12 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($_SESSION['ipaddress']);
|
||||
}
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -217,7 +204,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||
|
||||
if (! empty($conf->global->PAYMENT_MESSAGE_KO)) print $conf->global->PAYMENT_MESSAGE_KO;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
|
||||
@ -67,21 +67,6 @@ if (! empty($conf->paypal->enabled))
|
||||
if ($urlok) $PAYPAL_API_OK=$urlok;
|
||||
$PAYPAL_API_KO="";
|
||||
if ($urlko) $PAYPAL_API_KO=$urlko;
|
||||
if (empty($PAYPAL_API_USER))
|
||||
{
|
||||
dol_print_error('',"Paypal setup param PAYPAL_API_USER not defined");
|
||||
return -1;
|
||||
}
|
||||
if (empty($PAYPAL_API_PASSWORD))
|
||||
{
|
||||
dol_print_error('',"Paypal setup param PAYPAL_API_PASSWORD not defined");
|
||||
return -1;
|
||||
}
|
||||
if (empty($PAYPAL_API_SIGNATURE))
|
||||
{
|
||||
dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined");
|
||||
return -1;
|
||||
}
|
||||
|
||||
$PAYPALTOKEN=GETPOST('TOKEN');
|
||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
||||
@ -143,14 +128,14 @@ $object = new stdClass(); // For triggers
|
||||
* 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, '_payment');
|
||||
dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"])?dol_escape_htmltag($_SERVER["QUERY_STRING"]):'')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"])?dol_escape_htmltag($_SERVER["SCRIPT_URI"]):''), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$tracepost = "";
|
||||
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -166,69 +151,81 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
if ($PAYPALTOKEN)
|
||||
if ($paymentmethod == 'paypal')
|
||||
{
|
||||
// Get on url call
|
||||
$onlinetoken = $PAYPALTOKEN;
|
||||
$fulltag = $FULLTAG;
|
||||
$payerID = $PAYPALPAYERID;
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
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
|
||||
if (! empty($paymentType))
|
||||
{
|
||||
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
|
||||
$resArray=getDetails($onlinetoken);
|
||||
//var_dump($resarray);
|
||||
|
||||
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($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||
{
|
||||
$object->source = $source;
|
||||
$object->ref = $ref;
|
||||
$object->payerID = $payerID;
|
||||
$object->fulltag = $fulltag;
|
||||
$object->resArray = $resArray;
|
||||
|
||||
// resArray was built from a string like that
|
||||
// TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
|
||||
$PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]); // Should contains 'Completed'
|
||||
$TRANSACTIONID=urldecode($resArray["TRANSACTIONID"]);
|
||||
$TAXAMT=urldecode($resArray["TAXAMT"]);
|
||||
$NOTE=urldecode($resArray["NOTE"]);
|
||||
if ($PAYPALTOKEN)
|
||||
{
|
||||
// Get on url call
|
||||
$onlinetoken = $PAYPALTOKEN;
|
||||
$fulltag = $FULLTAG;
|
||||
$payerID = $PAYPALPAYERID;
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
$ispaymentok=True;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
||||
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
|
||||
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
|
||||
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
|
||||
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('','Session expired');
|
||||
}
|
||||
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
|
||||
if (! empty($paymentType))
|
||||
{
|
||||
dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_payment');
|
||||
$resArray=getDetails($onlinetoken);
|
||||
//var_dump($resarray);
|
||||
|
||||
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($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||
{
|
||||
$object->source = $source;
|
||||
$object->ref = $ref;
|
||||
$object->payerID = $payerID;
|
||||
$object->fulltag = $fulltag;
|
||||
$object->resArray = $resArray;
|
||||
|
||||
// resArray was built from a string like that
|
||||
// TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
|
||||
$PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]); // Should contains 'Completed'
|
||||
$TRANSACTIONID=urldecode($resArray["TRANSACTIONID"]);
|
||||
$TAXAMT=urldecode($resArray["TAXAMT"]);
|
||||
$NOTE=urldecode($resArray["NOTE"]);
|
||||
|
||||
$ispaymentok=True;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
||||
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
|
||||
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
|
||||
$ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
|
||||
$ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('','Session expired');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('','$PAYPALTOKEN not defined');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('','$PAYPALTOKEN not defined');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->paybox->enabled))
|
||||
{
|
||||
if ($paymentmethod == 'paybox') $ispaymentok = true; // We call this page only if payment is ok
|
||||
}
|
||||
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
if ($paymentmethod == 'stripe') $ispaymentok = true; // We call this page only if payment is ok
|
||||
}
|
||||
|
||||
|
||||
if ($ispaymentok)
|
||||
@ -240,10 +237,11 @@ if ($ispaymentok)
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// 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);
|
||||
@ -251,18 +249,14 @@ if ($ispaymentok)
|
||||
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->PAYMENT_MESSAGE_OK)) print $conf->global->PAYMENT_MESSAGE_OK;
|
||||
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||
|
||||
$sendemail = '';
|
||||
if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL;
|
||||
// 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 == '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;
|
||||
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
|
||||
// Send an email
|
||||
if ($sendemail)
|
||||
{
|
||||
@ -285,7 +279,7 @@ if ($ispaymentok)
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||
@ -333,33 +327,33 @@ else
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
print $langs->trans('DoExpressCheckoutPaymentAPICallFailed') . "<br>\n";
|
||||
print $langs->trans('DetailedErrorMessage') . ": " . $ErrorLongMsg."<br>\n";
|
||||
print $langs->trans('ShortErrorMessage') . ": " . $ErrorShortMsg."<br>\n";
|
||||
print $langs->trans('ErrorCode') . ": " . $ErrorCode."<br>\n";
|
||||
print $langs->trans('ErrorSeverityCode') . ": " . $ErrorSeverityCode."<br>\n";
|
||||
|
||||
|
||||
if ($mysoc->email) print "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
||||
|
||||
|
||||
$sendemail = '';
|
||||
if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL;
|
||||
// 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 == '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
|
||||
if ($sendemail)
|
||||
{
|
||||
@ -369,7 +363,7 @@ else
|
||||
$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))
|
||||
@ -382,7 +376,7 @@ else
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
|
||||
$content="";
|
||||
@ -392,12 +386,12 @@ else
|
||||
$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."\n";
|
||||
$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."\n";
|
||||
$content.="tag=".$fulltag."\ntoken=".$onlinetoken." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt;
|
||||
|
||||
|
||||
$ishtml=dol_textishtml($content); // May contain urls
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
|
||||
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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,
|
||||
@ -16,7 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For test: https://developer.paypal.com/
|
||||
* For paypal test: https://developer.paypal.com/
|
||||
* For paybox test: ???
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -242,7 +243,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
||||
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
||||
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
||||
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
||||
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
||||
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
|
||||
|
||||
// A redirect is added if API call successfull
|
||||
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
||||
@ -258,7 +259,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
||||
*/
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -267,9 +268,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
|
||||
|
||||
// Common variables
|
||||
$creditor=$mysoc->name;
|
||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
||||
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
||||
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||
|
||||
// Check link validity
|
||||
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||
@ -306,14 +307,14 @@ print "\n";
|
||||
|
||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
|
||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
// Define logo and logosmall
|
||||
$logosmall=$mysoc->logo_small;
|
||||
$logo=$mysoc->logo;
|
||||
$paramlogo='PAYBOX_LOGO_'.$suffix;
|
||||
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo='';
|
||||
@ -338,11 +339,11 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text='';
|
||||
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
|
||||
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||
{
|
||||
$langs->load("members");
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
|
||||
@ -91,7 +91,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
@ -104,7 +104,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
|
||||
// Send an email
|
||||
$sendemail = '';
|
||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
|
||||
if ($sendemail)
|
||||
{
|
||||
@ -153,7 +153,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -166,7 +166,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||
|
||||
if (! empty($conf->global->PAYPAL_MESSAGE_KO)) print $conf->global->PAYPAL_MESSAGE_KO;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
|
||||
|
||||
|
||||
$head='';
|
||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -135,7 +135,7 @@ if ($PAYPALTOKEN)
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
@ -170,7 +170,7 @@ if ($PAYPALTOKEN)
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||
if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
@ -180,9 +180,9 @@ if ($PAYPALTOKEN)
|
||||
// Fin appel triggers
|
||||
|
||||
// Send an email
|
||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||
{
|
||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
@ -201,7 +201,7 @@ if ($PAYPALTOKEN)
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||
@ -248,7 +248,7 @@ if ($PAYPALTOKEN)
|
||||
$result=$interface->run_triggers('PAYPAL_PAYMENT_KO',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
||||
$ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
|
||||
$ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
|
||||
@ -264,9 +264,9 @@ if ($PAYPALTOKEN)
|
||||
if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
||||
|
||||
// Send an email
|
||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||
{
|
||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
||||
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
@ -285,7 +285,7 @@ if ($PAYPALTOKEN)
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaymentFailed");
|
||||
$content="";
|
||||
|
||||
@ -183,9 +183,9 @@ if (! empty($conf->global->STRIPE_SECURITY_TOKEN))
|
||||
|
||||
// Common variables
|
||||
$creditor=$mysoc->name;
|
||||
$paramcreditor='STRIPE_CREDITOR_'.$suffix;
|
||||
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||
else if (! empty($conf->global->STRIPE_CREDITOR)) $creditor=$conf->global->STRIPE_CREDITOR;
|
||||
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||
|
||||
|
||||
|
||||
@ -297,7 +297,7 @@ if ($action == 'charge')
|
||||
}
|
||||
|
||||
$_SESSION["onlinetoken"] = $stripeToken;
|
||||
$_SESSION["Payment_Amount"] = $amount;
|
||||
$_SESSION["FinalPaymentAmt"] = $amount;
|
||||
$_SESSION["currencyCodeType"] = $currency;
|
||||
$_SESSION["paymentType"] = '';
|
||||
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
|
||||
@ -328,7 +328,7 @@ if ($action == 'charge')
|
||||
*/
|
||||
|
||||
$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";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -369,14 +369,14 @@ print "\n";
|
||||
|
||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||
|
||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
// Define logo and logosmall
|
||||
$logosmall=$mysoc->logo_small;
|
||||
$logo=$mysoc->logo;
|
||||
$paramlogo='STRIPE_LOGO_'.$suffix;
|
||||
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||
else if (! empty($conf->global->STRIPE_LOGO)) $logosmall=$conf->global->STRIPE_LOGO;
|
||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||
// Define urllogo
|
||||
$urllogo='';
|
||||
@ -401,11 +401,11 @@ if ($urllogo)
|
||||
|
||||
// Output introduction text
|
||||
$text='';
|
||||
if (! empty($conf->global->STRIPE_NEWFORM_TEXT))
|
||||
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||
{
|
||||
$langs->load("members");
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->STRIPE_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->STRIPE_NEWFORM_TEXT."<br>\n";
|
||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||
}
|
||||
if (empty($text))
|
||||
|
||||
@ -82,24 +82,24 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
$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 (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_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))
|
||||
@ -112,7 +112,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentFailed");
|
||||
$content="";
|
||||
@ -124,7 +124,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
$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)
|
||||
{
|
||||
@ -140,7 +140,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
||||
}
|
||||
|
||||
$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";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -153,7 +153,7 @@ 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;
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ 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";
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
$conf->dol_hide_topmenu=1;
|
||||
$conf->dol_hide_leftmenu=1;
|
||||
@ -105,7 +105,7 @@ if ($ispaymentok)
|
||||
// Set by newpayment.php
|
||||
$paymentType = $_SESSION['PaymentType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||
// From env
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
||||
@ -117,14 +117,14 @@ if ($ispaymentok)
|
||||
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;
|
||||
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||
|
||||
$sendemail = '';
|
||||
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
||||
|
||||
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||
|
||||
// Send an email
|
||||
if ($sendemail)
|
||||
{
|
||||
@ -147,7 +147,7 @@ if ($ispaymentok)
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
|
||||
$urlback=$_SERVER["REQUEST_URI"];
|
||||
$topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived");
|
||||
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
|
||||
|
||||
@ -37,7 +37,7 @@ $langs->load("paybox");
|
||||
$langs->load("stripe");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
|
||||
@ -55,17 +55,17 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (! $result > 0) $error++;
|
||||
$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);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||
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, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_OK",GETPOST('STRIPE_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||
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, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "STRIPE_PAYONLINE_SENDEMAIL",GETPOST('STRIPE_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -190,25 +190,25 @@ print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><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="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageOK").'</td><td>';
|
||||
$doleditor=new DolEditor('STRIPE_MESSAGE_OK',$conf->global->STRIPE_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MessageKO").'</td><td>';
|
||||
$doleditor=new DolEditor('STRIPE_MESSAGE_KO',$conf->global->STRIPE_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||
$doleditor->Create();
|
||||
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("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -343,6 +343,26 @@ input.smallpadd { /* Used for timesheet input */
|
||||
input.buttongen {
|
||||
vertical-align: middle;
|
||||
}
|
||||
input.buttonpayment {
|
||||
width: 300px;
|
||||
margin-bottom: 15px;
|
||||
background-image: none;
|
||||
}
|
||||
input.buttonpaymentpaypal {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 5px 4px;
|
||||
}
|
||||
input.buttonpaymentpaybox {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png',1) ?>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 5px 4px;
|
||||
}
|
||||
input.buttonpaymentstripe {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png',1) ?>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 5px 3px;
|
||||
}
|
||||
span.timesheetalreadyrecorded input {
|
||||
border: none;
|
||||
border-bottom: solid 1px rgba(0,0,0,0.4);
|
||||
@ -1224,21 +1244,6 @@ div#id-top {
|
||||
display:none;
|
||||
<?php } else { ?>
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
/*-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.4);
|
||||
box-shadow: 0 0 6px rgba(0,0,0,0.4); */
|
||||
/*
|
||||
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
|
||||
*/
|
||||
/*<?php if ($disableimages) { ?>
|
||||
height: 34px;
|
||||
<?php } else { ?>
|
||||
height: <?php print $heightmenu2; ?>px;
|
||||
<?php } ?>*/
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
@ -1310,15 +1315,6 @@ ul.tmenu { /* t r b l */
|
||||
display: table;
|
||||
}
|
||||
ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */
|
||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
/*
|
||||
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
||||
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
|
||||
*/
|
||||
}
|
||||
li.tmenu, li.tmenusel {
|
||||
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user