Fix: Minor fix in paypal and paybox modules
This commit is contained in:
parent
3b0b8b4559
commit
984d6e12a2
@ -61,8 +61,15 @@ function llxFooterPayBox()
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a redirect form to paybox form
|
* Create a redirect form to paybox form
|
||||||
* \return int 1 if OK, -1 if ERROR
|
*
|
||||||
|
* @param $PRICE
|
||||||
|
* @param $CURRENCY
|
||||||
|
* @param $EMAIL
|
||||||
|
* @param $urlok
|
||||||
|
* @param $urlko
|
||||||
|
* @param $TAG
|
||||||
|
* @return int 1 if OK, -1 if ERROR
|
||||||
*/
|
*/
|
||||||
function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
|
function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,6 +132,7 @@ function html_print_paypal_footer($fromcompany,$langs)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send redirect to paypal to browser
|
* Send redirect to paypal to browser
|
||||||
|
*
|
||||||
* @param $paymentAmount
|
* @param $paymentAmount
|
||||||
* @param $currencyCodeType
|
* @param $currencyCodeType
|
||||||
* @param $paymentType
|
* @param $paymentType
|
||||||
|
|||||||
@ -53,10 +53,10 @@ $langs->load("paybox");
|
|||||||
// tag (a free text, required if type is empty)
|
// tag (a free text, required if type is empty)
|
||||||
// currency (iso code)
|
// currency (iso code)
|
||||||
|
|
||||||
$suffix=GETPOST("suffix");
|
$suffix=GETPOST("suffix",'alpha');
|
||||||
$amount=GETPOST("amount");
|
$amount=GETPOST("amount");
|
||||||
if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE;
|
if (! GETPOST("currency",'alpha')) $currency=$conf->global->MAIN_MONNAIE;
|
||||||
else $currency=GETPOST("currency");
|
else $currency=GETPOST("currency",'alpha');
|
||||||
|
|
||||||
if (! GETPOST("action"))
|
if (! GETPOST("action"))
|
||||||
{
|
{
|
||||||
@ -81,18 +81,18 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolib
|
|||||||
$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?';
|
$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?';
|
||||||
$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?';
|
$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?';
|
||||||
|
|
||||||
$TAG=GETPOST("tag");
|
$TAG=GETPOST("tag",'alpha');
|
||||||
$FULLTAG=GETPOST("fulltag"); // fulltag is tag with more informations
|
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
||||||
|
|
||||||
if (!empty($TAG))
|
if (!empty($TAG))
|
||||||
{
|
{
|
||||||
$urlok.='tag='.$TAG.'&';
|
$urlok.='tag='.urlencode($TAG).'&';
|
||||||
$urlko.='tag='.$TAG.'&';
|
$urlko.='tag='.urlencode($TAG).'&';
|
||||||
}
|
}
|
||||||
if (!empty($FULLTAG))
|
if (!empty($FULLTAG))
|
||||||
{
|
{
|
||||||
$urlok.='fulltag='.$FULLTAG.'&';
|
$urlok.='fulltag='.urlencode($FULLTAG).'&';
|
||||||
$urlko.='fulltag='.$FULLTAG.'&';
|
$urlko.='fulltag='.urlencode($FULLTAG).'&';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +103,6 @@ if ($_REQUEST["action"] == 'dopayment')
|
|||||||
{
|
{
|
||||||
$PRICE=price2num(GETPOST("newamount"),'MT');
|
$PRICE=price2num(GETPOST("newamount"),'MT');
|
||||||
$EMAIL=GETPOST("EMAIL");
|
$EMAIL=GETPOST("EMAIL");
|
||||||
$ID=GETPOST("id");
|
|
||||||
|
|
||||||
$mesg='';
|
$mesg='';
|
||||||
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
||||||
@ -115,7 +114,7 @@ if ($_REQUEST["action"] == 'dopayment')
|
|||||||
{
|
{
|
||||||
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
|
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
|
||||||
|
|
||||||
print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
|
print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG);
|
||||||
|
|
||||||
session_destroy();
|
session_destroy();
|
||||||
exit;
|
exit;
|
||||||
@ -142,9 +141,9 @@ print '<center>';
|
|||||||
print '<form id="dolpaymentform" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form id="dolpaymentform" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="dopayment">';
|
print '<input type="hidden" name="action" value="dopayment">';
|
||||||
print '<input type="hidden" name="amount" value="'.$_REQUEST["amount"].'">';
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
|
||||||
print '<input type="hidden" name="tag" value="'.$_REQUEST["tag"].'">';
|
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">';
|
||||||
print '<input type="hidden" name="suffix" value="'.$_REQUEST["suffix"].'">';
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">';
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a Paybox payment -->'."\n";
|
print '<!-- Form to send a Paybox payment -->'."\n";
|
||||||
print '<!-- PAYBOX_CREDITOR = '.$conf->global->PAYPAL_CREDITOR.' -->'."\n";
|
print '<!-- PAYBOX_CREDITOR = '.$conf->global->PAYPAL_CREDITOR.' -->'."\n";
|
||||||
|
|||||||
@ -59,10 +59,10 @@ $urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?';
|
|||||||
// tag (a free text, required if type is empty)
|
// tag (a free text, required if type is empty)
|
||||||
// currency (iso code)
|
// currency (iso code)
|
||||||
|
|
||||||
$suffix=GETPOST("suffix");
|
$suffix=GETPOST("suffix",'alpha');
|
||||||
$amount=GETPOST("amount");
|
$amount=GETPOST("amount");
|
||||||
if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE;
|
if (! GETPOST("currency",'alpha')) $currency=$conf->global->MAIN_MONNAIE;
|
||||||
else $currency=GETPOST("currency");
|
else $currency=GETPOST("currency",'alpha');
|
||||||
|
|
||||||
if (! GETPOST("action"))
|
if (! GETPOST("action"))
|
||||||
{
|
{
|
||||||
@ -84,8 +84,8 @@ if (! GETPOST("action"))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Complete urls
|
// Complete urls
|
||||||
$TAG=GETPOST("tag");
|
$TAG=GETPOST("tag",'alpha');
|
||||||
$FULLTAG=GETPOST("fulltag"); // fulltag is tag with more informations
|
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
|
||||||
if (!empty($TAG))
|
if (!empty($TAG))
|
||||||
{
|
{
|
||||||
$urlok.='tag='.urlencode($TAG).'&';
|
$urlok.='tag='.urlencode($TAG).'&';
|
||||||
@ -136,7 +136,6 @@ if (GETPOST("action") == 'dopayment')
|
|||||||
{
|
{
|
||||||
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
|
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
|
||||||
$EMAIL=GETPOST("EMAIL");
|
$EMAIL=GETPOST("EMAIL");
|
||||||
$ID=GETPOST("id");
|
|
||||||
$PAYPAL_PAYMENT_TYPE='Sale';
|
$PAYPAL_PAYMENT_TYPE='Sale';
|
||||||
|
|
||||||
$shipToName=GETPOST("shipToName");
|
$shipToName=GETPOST("shipToName");
|
||||||
@ -194,7 +193,7 @@ if (GETPOST("action") == 'dopayment')
|
|||||||
$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
||||||
|
|
||||||
// A redirect is added if API call successfull
|
// A redirect is added if API call successfull
|
||||||
RedirectToPaypal($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
||||||
|
|
||||||
print '</body></html>'."\n";
|
print '</body></html>'."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -223,9 +222,9 @@ print '<center>'."\n";
|
|||||||
print '<form id="dolpaymentform" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
print '<form id="dolpaymentform" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
print '<input type="hidden" name="action" value="dopayment">'."\n";
|
print '<input type="hidden" name="action" value="dopayment">'."\n";
|
||||||
print '<input type="hidden" name="amount" value="'.$_REQUEST["amount"].'">'."\n";
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'."\n";
|
||||||
print '<input type="hidden" name="tag" value="'.$_REQUEST["tag"].'">'."\n";
|
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
||||||
print '<input type="hidden" name="suffix" value="'.$_REQUEST["suffix"].'">'."\n";
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a Paypal payment -->'."\n";
|
print '<!-- Form to send a Paypal payment -->'."\n";
|
||||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user