Correct link and renamed checkout by newpayment
This commit is contained in:
parent
d73374cc5b
commit
ce62736e6b
@ -16,6 +16,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/public/stripe/newpayment.php
|
||||
* \ingroup Stripe
|
||||
* \brief Page to do payment with Stripe
|
||||
*/
|
||||
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1);
|
||||
|
||||
@ -25,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/public/stripe/config.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
||||
|
||||
// Security check
|
||||
if (empty($conf->paypal->enabled)) accessforbidden('',0,0,1);
|
||||
if (empty($conf->stripe->enabled)) accessforbidden('',0,0,1);
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("other");
|
||||
@ -67,13 +73,13 @@ if (GETPOST("action") == 'charge')
|
||||
$token = GETPOST("stripeToken");
|
||||
$email = GETPOST("stripeEmail");
|
||||
|
||||
$customer = \Stripe\Customer::create(array(
|
||||
$customer = \stripe\Customer::create(array(
|
||||
'email' => $email,
|
||||
'card' => $token
|
||||
));
|
||||
|
||||
$ttc = round($ttc, 2);
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
$charge = \stripe\Charge::create(array(
|
||||
'customer' => $customer->id,
|
||||
'amount' => $ttc,
|
||||
'currency' => $conf->currency,
|
||||
@ -122,7 +128,7 @@ if (GETPOST("action") == 'charge')
|
||||
</td>
|
||||
|
||||
<td>
|
||||
Invoice #: <?php echo $invoice->ref; ?><br>
|
||||
<?php echo $langs->trans("Invoice") . ' : ' . $invoice->ref; ?><br>
|
||||
<?php echo $langs->trans('Date') . ' : ' . dol_print_date($invoice->date, 'day'); ?><br>
|
||||
<?php echo $langs->trans('DateMaxPayment') . ' : ' . dol_print_date($invoice->date_validation, 'day'); ?>
|
||||
</td>
|
||||
@ -112,6 +112,7 @@ function showStripePaymentUrl($type,$ref)
|
||||
$langs->load("paypal");
|
||||
$langs->load("paybox");
|
||||
$langs->load("stripe");
|
||||
|
||||
$servicename='Stripe';
|
||||
$out='<br><br>';
|
||||
$out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>';
|
||||
@ -139,11 +140,6 @@ function getStripePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
if ($type == 'free')
|
||||
{
|
||||
$out=DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
else $out.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
}
|
||||
}
|
||||
if ($type == 'order')
|
||||
{
|
||||
@ -151,17 +147,6 @@ function getStripePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
if ($mode == 1) $out.='order_ref';
|
||||
if ($mode == 0) $out.=urlencode($ref);
|
||||
$out.=($mode?'</font>':'');
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
else
|
||||
{
|
||||
$out.='&securekey='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)";
|
||||
if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
|
||||
$out.=($mode?'</font>':'');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($type == 'invoice')
|
||||
{
|
||||
@ -169,17 +154,6 @@ function getStripePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
if ($mode == 1) $out.='invoice_ref';
|
||||
if ($mode == 0) $out.=urlencode($ref);
|
||||
$out.=($mode?'</font>':'');
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
else
|
||||
{
|
||||
$out.='&securekey='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
|
||||
if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
|
||||
$out.=($mode?'</font>':'');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($type == 'contractline')
|
||||
{
|
||||
@ -187,17 +161,6 @@ function getStripePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
if ($mode == 1) $out.='contractline_ref';
|
||||
if ($mode == 0) $out.=urlencode($ref);
|
||||
$out.=($mode?'</font>':'');
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
else
|
||||
{
|
||||
$out.='&securekey='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
|
||||
if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
|
||||
$out.=($mode?'</font>':'');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($type == 'membersubscription')
|
||||
{
|
||||
@ -205,17 +168,6 @@ function getStripePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
if ($mode == 1) $out.='member_ref';
|
||||
if ($mode == 0) $out.=urlencode($ref);
|
||||
$out.=($mode?'</font>':'');
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN;
|
||||
else
|
||||
{
|
||||
$out.='&securekey='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.="hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)";
|
||||
if ($mode == 0) $out.= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $type . $ref, 2);
|
||||
$out.=($mode?'</font>':'');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For multicompany
|
||||
|
||||
Loading…
Reference in New Issue
Block a user