Fix trans

This commit is contained in:
Laurent Destailleur 2019-11-08 10:24:03 +01:00
parent f11943126a
commit d1c49c7021
4 changed files with 18 additions and 30 deletions

View File

@ -97,22 +97,28 @@ function payment_supplier_prepare_head(Paiement $object)
*/
function getValidOnlinePaymentMethods($paymentmethod = '')
{
global $conf;
global $conf, $langs;
$validpaymentmethod=array();
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled))
{
$langs->load("paypal");
$validpaymentmethod['paypal']='valid';
}
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))
{
$langs->load("paybox");
$validpaymentmethod['paybox']='valid';
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
{
$langs->load("stripe");
$validpaymentmethod['stripe']='valid';
}
// TODO Add trigger
return $validpaymentmethod;
}
@ -173,6 +179,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
}
//if ($mode) $out.='&noidempotency=1';
}
elseif ($type == 'order')
{

View File

@ -20,7 +20,6 @@ ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment user
ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment user interface for a free amount
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL to offer a %s online payment user interface for a member subscription
ToOfferALinkForOnlinePaymentOnDonation=URL to offer a %s online payment, user interface for payment of donation
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL (required only for free payment) to add your own payment comment tag.
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your Paybox with url <b>%s</b> to have payment created automatically when validated by Paybox.
YourPaymentHasBeenRecorded=This page confirms that your payment has been recorded. Thank you.
YourPaymentHasNotBeenRecorded=Your payment has NOT been recorded and the transaction has been canceled. Thank you.

View File

@ -21,7 +21,7 @@ ToOfferALinkForOnlinePaymentOnInvoice=URL to offer a %s online payment user inte
ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment user interface for a contract line
ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment user interface for a free amount
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL to offer a %s online payment user interface for a member subscription
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL (required only for free payment) to add your own payment comment tag.
YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any of those URL (mandatory only for free payment) to add your own payment comment tag.<br>For free payment, you may also add the parameter <strong>&noidempotency=1</strong> so the same link with same tag can be used several times (some payment mode may limit the payment to 1 for each different link without this parameter)
SetupStripeToHavePaymentCreatedAutomatically=Setup your Stripe with url <b>%s</b> to have payment created automatically when validated by Stripe.
AccountParameter=Account parameters
UsageParameter=Usage parameters

View File

@ -63,10 +63,10 @@ $action=GETPOST('action', 'aZ09');
// tag (a free text, required if type is empty)
// currency (iso code)
$suffix=GETPOST("suffix", 'aZ09');
$amount=price2num(GETPOST("amount", 'alpha'));
if (! GETPOST("currency", 'alpha')) $currency=$conf->currency;
else $currency=GETPOST("currency", 'alpha');
$suffix = GETPOST("suffix", 'aZ09');
$amount = price2num(GETPOST("amount", 'alpha'));
if (! GETPOST("currency", 'alpha')) $currency = $conf->currency;
else $currency = GETPOST("currency", 'alpha');
$source = GETPOST("s", 'alpha')?GETPOST("s", 'alpha'):GETPOST("source", 'alpha');
$download = GETPOST('d', 'int')?GETPOST('d', 'int'):GETPOST('download', 'int');
@ -159,7 +159,7 @@ $urlko=preg_replace('/&$/', '', $urlko); // Remove last &
// Find valid payment methods
// Make special controls
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled))
{
@ -186,36 +186,18 @@ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->payp
dol_print_error('', "Paypal setup param PAYPAL_API_SIGNATURE not defined");
return -1;
}
$validpaymentmethod['paypal']='valid';
}
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))
{
$langs->load("paybox");
// TODO Chek setup is complete
$validpaymentmethod['paybox']='valid';
// No specific test for the moment
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
{
$langs->load("stripe");
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php';
/* already included into /stripe/config.php
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
*/
$validpaymentmethod['stripe']='valid';
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This include also /stripe/lib/stripe.lib.php, /includes/stripe/init.php, ...
}
// TODO Replace previous set of $validpaymentmethod with this line:
//$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod);
// Initialize $validpaymentmethod
$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod);
// Check security token