*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
';
$out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'
';
$url = getStripePaymentUrl(0, $type, $ref);
$out .= '
';
$out .= ajax_autoselect("stripeurl", 0);
return $out;
}
/**
* Return string with full Url
*
* @param int $mode 0=True url, 1=Url formated with colors
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...)
* @param string $ref Ref of object
* @param int $amount Amount
* @param string $freetag Free tag
* @return string Url string
*/
function getStripePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag')
{
global $conf;
$ref = str_replace(' ', '', $ref);
if ($type == 'free')
{
$out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : '');
}
if ($type == 'order')
{
$out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref='.($mode ? '' : '');
if ($mode == 1) $out .= 'order_ref';
if ($mode == 0) $out .= urlencode($ref);
$out .= ($mode ? '' : '');
}
if ($type == 'invoice')
{
$out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref='.($mode ? '' : '');
if ($mode == 1) $out .= 'invoice_ref';
if ($mode == 0) $out .= urlencode($ref);
$out .= ($mode ? '' : '');
}
if ($type == 'contractline')
{
$out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref='.($mode ? '' : '');
if ($mode == 1) $out .= 'contractline_ref';
if ($mode == 0) $out .= urlencode($ref);
$out .= ($mode ? '' : '');
}
if ($type == 'membersubscription')
{
$out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref='.($mode ? '' : '');
if ($mode == 1) $out .= 'member_ref';
if ($mode == 0) $out .= urlencode($ref);
$out .= ($mode ? '' : '');
}
// For multicompany
$out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
return $out;
}
/**
* Show footer of company in HTML pages
*
* @param Societe $fromcompany Third party
* @param Translate $langs Output language
* @return void
*/
function html_print_stripe_footer($fromcompany, $langs)
{
global $conf;
// Juridical status
$line1 = "";
if ($fromcompany->forme_juridique_code)
{
$line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
// Capital
if ($fromcompany->capital)
{
$line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
}
$reg = array();
// Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
{
$field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
}
// Prof Id 2
if ($fromcompany->idprof2)
{
$field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
}
// Second line of company infos
$line2 = "";
// Prof Id 3
if ($fromcompany->idprof3)
{
$field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
}
// Prof Id 4
if ($fromcompany->idprof4)
{
$field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '')
{
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
print '