diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index b2eadfce654195308e79e61b6171e42b91d9376e..54f8cb1980ffe625a0851e00b9cbafd4f487cc09 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -8,6 +8,7 @@ PAYPAL_API_SANDBOX=Mode test/sandbox PAYPAL_API_USER=API username PAYPAL_API_PASSWORD=API password PAYPAL_API_SIGNATURE=API signature +PAYPAL_SSLVERSION=Curl SSL Version PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only PaypalModeIntegral=Integral PaypalModeOnlyPaypal=PayPal only diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index fd649b825bc21237d340fc0ce8c4539a69c5a08b..89065cb7c77f3873c86cef4b9ba5299a05c5e347 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -51,6 +51,8 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYPAL_API_SIGNATURE",GETPOST('PAYPAL_API_SIGNATURE','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_SSLVERSION",GETPOST('PAYPAL_SSLVERSION','alpha'),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYPAL_CREDITOR",GETPOST('PAYPAL_CREDITOR','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY','alpha'),'chaine',0,'',$conf->entity); @@ -119,6 +121,7 @@ print '<br>'; print '<table class="noborder" width="100%">'; +// Account Parameters $var=true; print '<tr class="liste_titre">'; print '<td>'.$langs->trans("AccountParameter").'</td>'; @@ -151,6 +154,13 @@ print '<input size="64" type="text" name="PAYPAL_API_SIGNATURE" value="'.$conf-> print '<br>'.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF'; print '</td></tr>'; +$var=!$var; +print '<tr '.$bc[$var].'><td class="fieldrequired">'; +print $langs->trans("PAYPAL_SSLVERSION").'</td><td>'; +print $form->selectarray("PAYPAL_SSLVERSION",array('1'=> $langs->trans('TLSv1'),'6'=> $langs->trans('TLSv1.2')),$conf->global->PAYPAL_SSLVERSION); +print '</td></tr>'; + +// Usage Parameters $var=true; print '<tr class="liste_titre">'; print '<td>'.$langs->trans("UsageParameter").'</td>'; diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 824f312a9afbf7033f30b0560b3e4dd2ca8c9dbb..f06624cb076afcc168e12071933d5393fa3255a1 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -702,8 +702,8 @@ function hash_call($methodName,$nvpStr) exit;*/ curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); - //curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 - curl_setopt($ch, CURLOPT_SSLVERSION, 1); // Force TLSv1 + // TLSv1 by default or change to TLSv1.2 in module configuration + curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION)?1:$conf->global->PAYPAL_SSLVERSION)); //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);