Skip to content

Commit

Permalink
Correção da verificação da versão php
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelo-machado-gn committed Aug 25, 2022
1 parent 315fb2d commit f85174e
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions gerencianet.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ function gerencianet_config_validate($params)
*/
function gerencianet_link($gatewayParams)
{
/* **************************************** Verifica se a versão do PHP é compatível com o módulo ******************************** */

if (version_compare(PHP_VERSION, '7.3') < 0) {
$errorMsg = 'A versão do PHP do servidor onde o WHMCS está hospedado não é compatível com o módulo Gerencianet.';
if ($gatewayParams['debug'] == "on")
logTransaction('gerencianet', $errorMsg, 'Erro de Versão');

return send_errors(array('Erro Inesperado: Ocorreu um erro inesperado. Entre em contato com o responsável do site.'));
}
// Creating table 'tblgerencianetpix'
createGerencianetPixTable();

Expand Down Expand Up @@ -416,15 +425,7 @@ function gerencianet_link($gatewayParams)
$gatewayParams['paramsBoleto'] = $_POST;
$errorMessages = array();
$errorMessages = validationParams($gatewayParams);
/* **************************************** Verifica se a versão do PHP é compatível com a API ******************************** */

if (version_compare(PHP_VERSION, '7.3') < 0) {
$errorMsg = 'A versão do PHP do servidor onde o WHMCS está hospedado não é compatível com o módulo Gerencianet. Atualize o PHP para uma versão igual ou superior à versão 5.4.39';
if ($gatewayParams['debug'] == "on")
logTransaction('gerencianet', $errorMsg, 'Erro de Versão');

return send_errors(array('Erro Inesperado: Ocorreu um erro inesperado. Entre em contato com o responsável do site.'));
}

/* ************************************************ Define mensagens de erro ***************************************************/


Expand Down Expand Up @@ -476,14 +477,6 @@ function gerencianet_link($gatewayParams)
if ($existingCharge) {
return $code;
}

if (version_compare(PHP_VERSION, '7.3') < 0) {
$errorMsg = 'A versão do PHP do servidor onde o WHMCS está hospedado não é compatível com o módulo Gerencianet. Atualize o PHP para uma versão igual ou superior à versão 5.4.39';
if ($gatewayParams['debug'] == "on")
logTransaction('gerencianet', $errorMsg, 'Erro de Versão');

return send_errors(array('Erro Inesperado: Ocorreu um erro inesperado. Entre em contato com o responsável do site.'));
}
$invoiceAmount = $gatewayParams['amount'];
if ($invoiceAmount < $minValue) {
$limitMsg = "<div id=limit-value-msg style='font-weight:bold; color:#cc0000;'>Transação Não permitida: Você está tentando pagar uma fatura de<br> R$ $invoiceAmount. Para gerar o boleto Gerencianet, o valor mínimo do pedido deve ser de R$ $minValue</div>";
Expand Down

0 comments on commit f85174e

Please sign in to comment.