Try to introduce param forcesandbox to test online payment easier
This commit is contained in:
parent
9676b83574
commit
b9ca66943f
@ -93,7 +93,7 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
|
||||
global $conf;
|
||||
|
||||
$ref=str_replace(' ','',$ref);
|
||||
|
||||
|
||||
if ($type == 'free')
|
||||
{
|
||||
$out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
|
||||
@ -535,7 +535,7 @@ function hash_call($methodName,$nvpStr)
|
||||
|
||||
// TODO problem with triggers
|
||||
$API_version="56";
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha')) // We can force sand box with param 'forcesandbox'
|
||||
{
|
||||
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
||||
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
|
||||
|
||||
@ -48,7 +48,7 @@ $API_version="56";
|
||||
' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=
|
||||
' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token=
|
||||
*/
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha')) // We can force sand box with param 'forcesandbox'
|
||||
{
|
||||
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
||||
$API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
|
||||
|
||||
@ -296,9 +296,10 @@ if ($action == 'dopayment')
|
||||
//if ($currency == 'USD') $PAYPAL_API_DEVISE="USD";
|
||||
if (! empty($currency)) $PAYPAL_API_DEVISE=$currency;
|
||||
|
||||
// Show var initialized by include fo paypal lib at begin of this file
|
||||
dol_syslog("Submit Paypal form", LOG_DEBUG);
|
||||
dol_syslog("PAYPAL_API_USER: $PAYPAL_API_USER", LOG_DEBUG);
|
||||
//dol_syslog("PAYPAL_API_PASSWORD: $PAYPAL_API_PASSWORD", LOG_DEBUG); // No password into log files
|
||||
dol_syslog("PAYPAL_API_PASSWORD: ".preg_replace('/./', '*', $PAYPAL_API_PASSWORD), LOG_DEBUG); // No password into log files
|
||||
dol_syslog("PAYPAL_API_SIGNATURE: $PAYPAL_API_SIGNATURE", LOG_DEBUG);
|
||||
dol_syslog("PAYPAL_API_SANDBOX: $PAYPAL_API_SANDBOX", LOG_DEBUG);
|
||||
dol_syslog("PAYPAL_API_OK: $PAYPAL_API_OK", LOG_DEBUG);
|
||||
@ -515,11 +516,11 @@ if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_r
|
||||
|
||||
|
||||
// Show sandbox warning
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||
if (! empty($conf->paypal->enabled) && (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox'
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning');
|
||||
}
|
||||
if (! empty($conf->stripe->enabled) && empty($conf->global->STRIPE_LIVE))
|
||||
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
|
||||
}
|
||||
@ -534,6 +535,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n"
|
||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||
print '<input type="hidden" name="e" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
|
||||
print "\n";
|
||||
print '<!-- Form to send a payment -->'."\n";
|
||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||
@ -1389,6 +1391,7 @@ if (preg_match('/^dopayment/',$action))
|
||||
print '<input type="hidden" name="e" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
|
||||
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
|
||||
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
|
||||
|
||||
print '
|
||||
<table id="dolpaymenttable" summary="Payment form" class="center">
|
||||
|
||||
@ -282,7 +282,7 @@ if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', '
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||
}
|
||||
@ -296,6 +296,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n"
|
||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
|
||||
print "\n";
|
||||
print '<!-- Form to send a Paypal payment -->'."\n";
|
||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||
|
||||
@ -346,7 +346,7 @@ if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', '
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($conf->global->STRIPE_LIVE))
|
||||
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
|
||||
{
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||
}
|
||||
@ -360,6 +360,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n"
|
||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
|
||||
print "\n";
|
||||
print '<!-- Form to send a Stripe payment -->'."\n";
|
||||
print '<!-- STRIPE_API_SANDBOX = '.$conf->global->STRIPE_API_SANDBOX.' -->'."\n";
|
||||
@ -1118,6 +1119,7 @@ if (preg_match('/^dopayment/',$action))
|
||||
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 '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
|
||||
|
||||
print '
|
||||
<table id="dolpaymenttable" summary="Payment form" class="center">
|
||||
|
||||
@ -33,19 +33,19 @@ global $conf;
|
||||
//use \includes\stripe as stripe;
|
||||
$stripe = array();
|
||||
|
||||
if (empty($conf->global->STRIPE_LIVE))
|
||||
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
|
||||
{
|
||||
$stripe = array(
|
||||
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
|
||||
"publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$stripe = array(
|
||||
"secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY,
|
||||
"publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/includes/stripe/lib/Stripe.php";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user