Fix link for endpoint
This commit is contained in:
parent
fe3fe60efc
commit
79c37f2226
@ -142,23 +142,32 @@ function showOnlinePaymentUrl($type, $ref)
|
|||||||
/**
|
/**
|
||||||
* Return string with full Url
|
* Return string with full Url
|
||||||
*
|
*
|
||||||
* @param int $mode 0=True url, 1=Url formated with colors
|
* @param int $mode 0=True url, 1=Url formated with colors
|
||||||
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...)
|
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...)
|
||||||
* @param string $ref Ref of object
|
* @param string $ref Ref of object
|
||||||
* @param int $amount Amount (required for $type='free' only)
|
* @param int $amount Amount (required for $type='free' only)
|
||||||
* @param string $freetag Free tag
|
* @param string $freetag Free tag
|
||||||
* @return string Url string
|
* @param string $localorexternal 0=Url for browser, 1=Url for external access
|
||||||
|
* @return string Url string
|
||||||
*/
|
*/
|
||||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag')
|
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag', $localorexternal=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $dolibarr_main_url_root;
|
||||||
|
|
||||||
$ref=str_replace(' ', '', $ref);
|
$ref=str_replace(' ', '', $ref);
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
|
// Define $urlwithroot
|
||||||
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
$urltouse = DOL_MAIN_URL_ROOT;
|
||||||
|
if ($localorexternal) $urltouse = $urlwithroot;
|
||||||
|
|
||||||
if ($type == 'free')
|
if ($type == 'free')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
|
$out=$urltouse.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':'');
|
||||||
if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
||||||
{
|
{
|
||||||
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
|
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
|
||||||
@ -167,7 +176,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
|||||||
}
|
}
|
||||||
elseif ($type == 'order')
|
elseif ($type == 'order')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
|
$out=$urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
|
||||||
if ($mode == 1) $out.='order_ref';
|
if ($mode == 1) $out.='order_ref';
|
||||||
if ($mode == 0) $out.=urlencode($ref);
|
if ($mode == 0) $out.=urlencode($ref);
|
||||||
$out.=($mode?'</font>':'');
|
$out.=($mode?'</font>':'');
|
||||||
@ -185,7 +194,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
|||||||
}
|
}
|
||||||
elseif ($type == 'invoice')
|
elseif ($type == 'invoice')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
|
$out=$urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
|
||||||
if ($mode == 1) $out.='invoice_ref';
|
if ($mode == 1) $out.='invoice_ref';
|
||||||
if ($mode == 0) $out.=urlencode($ref);
|
if ($mode == 0) $out.=urlencode($ref);
|
||||||
$out.=($mode?'</font>':'');
|
$out.=($mode?'</font>':'');
|
||||||
@ -203,7 +212,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
|||||||
}
|
}
|
||||||
elseif ($type == 'contractline')
|
elseif ($type == 'contractline')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
|
$out=$urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
|
||||||
if ($mode == 1) $out.='contractline_ref';
|
if ($mode == 1) $out.='contractline_ref';
|
||||||
if ($mode == 0) $out.=urlencode($ref);
|
if ($mode == 0) $out.=urlencode($ref);
|
||||||
$out.=($mode?'</font>':'');
|
$out.=($mode?'</font>':'');
|
||||||
@ -221,7 +230,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
|||||||
}
|
}
|
||||||
elseif ($type == 'member' || $type == 'membersubscription')
|
elseif ($type == 'member' || $type == 'membersubscription')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
|
$out=$urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
|
||||||
if ($mode == 1) $out.='member_ref';
|
if ($mode == 1) $out.='member_ref';
|
||||||
if ($mode == 0) $out.=urlencode($ref);
|
if ($mode == 0) $out.=urlencode($ref);
|
||||||
$out.=($mode?'</font>':'');
|
$out.=($mode?'</font>':'');
|
||||||
@ -239,7 +248,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
|||||||
}
|
}
|
||||||
if ($type == 'donation')
|
if ($type == 'donation')
|
||||||
{
|
{
|
||||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
|
$out=$urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':'');
|
||||||
if ($mode == 1) $out.='donation_ref';
|
if ($mode == 1) $out.='donation_ref';
|
||||||
if ($mode == 0) $out.=urlencode($ref);
|
if ($mode == 0) $out.=urlencode($ref);
|
||||||
$out.=($mode?'</font>':'');
|
$out.=($mode?'</font>':'');
|
||||||
|
|||||||
@ -41,6 +41,10 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
if ($action == 'setvalue' && $user->admin)
|
if ($action == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -190,7 +194,7 @@ if (empty($conf->stripeconnect->enabled))
|
|||||||
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.$conf->global->STRIPE_TEST_WEBHOOK_KEY.'">';
|
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.$conf->global->STRIPE_TEST_WEBHOOK_KEY.'">';
|
||||||
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' ';
|
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").' ';
|
||||||
$url = dol_buildpath('/public/stripe/ipn.php?test', 2);
|
$url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||||
$out.= '<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.'">';
|
$out.= '<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.'">';
|
||||||
$out.= ajax_autoselect("onlinetestwebhookurl", 0);
|
$out.= ajax_autoselect("onlinetestwebhookurl", 0);
|
||||||
print '<br>'.$out;
|
print '<br>'.$out;
|
||||||
@ -225,7 +229,7 @@ if (empty($conf->stripeconnect->enabled))
|
|||||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_KEY.'">';
|
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_KEY.'">';
|
||||||
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' ';
|
$out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").' ';
|
||||||
$url = dol_buildpath('/public/stripe/ipn.php', 2);
|
$url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||||
$out.= '<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.'">';
|
$out.= '<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.'">';
|
||||||
$out.= ajax_autoselect("onlinelivewebhookurl", 0);
|
$out.= ajax_autoselect("onlinelivewebhookurl", 0);
|
||||||
print '<br>'.$out;
|
print '<br>'.$out;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user