Jump to content

[PT] Apresentem-se


GCosta

Recommended Posts

Boas companheiros,

 

Também por cá ando e se precisarem de ajuda, basta que digam alguma coisa por PM.

 

Acabei de desenvolver o módulo MultiBanco para a versão 4.3.1 e 4.41 com sucesso e se assim o entenderem poderei aqui disponibilizá-la GRATUITAMENTE.

 

Saudações

 

Jony

multibanco.jpg

Link to comment
Share on other sites

  • 3 weeks later...
Boas companheiros,

 

Também por cá ando e se precisarem de ajuda, basta que digam alguma coisa por PM.

 

Acabei de desenvolver o módulo MultiBanco para a versão 4.3.1 e 4.41 com sucesso e se assim o entenderem poderei aqui disponibilizá-la GRATUITAMENTE.

 

Saudações

 

Jony

 

Olá Jony,

 

estou interessado nisso de pagamento por multibanco.

Será que podes ajudar/disponibilizar ?

 

Abraço,

JMota

Link to comment
Share on other sites

  • 1 month later...

Boas companheiros,

 

A pedido de várias famílias, aqui vai o código fonte básico para o módulo em causa.

 

Criam o ficheiro com o nome multibanco.php e colocam-no na pasta:

 

/modules/gateways

 

 

PS - No meu caso concreto, ainda fiz mais uma ou duas alterações, de forma a que esses valores sejam enviados automaticamente no PDF do Aviso de Pagamento...

 

Aqui segue o Código:

 

==========================================================================

 

<?php

 

function multibanco_config() {

$configarray = array(

"FriendlyName" => array("Type" => "System", "Value"=>"Pagamentos Por Multibanco"),

"Entidade" => array("FriendlyName" => "Entidade", "Type" => "text", "Size" => "20", ),

"SubEntidade" => array("FriendlyName" => "SubEntidade", "Type" => "text", "Size" => "20", ),

);

return $configarray;

}

 

function multibanco_link($params) {

 

# Variaveis Especificas do Gateway

$gatewayentidade = $params['Entidade'];

$gatewaysubentidade = $params['SubEntidade'];

 

# Variaveis vindas da Ordem

$invoiceid = $params['invoiceid'];

$description = $params["description"];

$amount = $params['amount']; # Format: ##.##

$currency = $params['currency']; # Currency Code

 

$referencia = GenerateMbRef($gatewayentidade,$gatewaysubentidade,$invoiceid,$amount);

 

 

# Variaveis vindas do Cliente

$firstname = $params['clientdetails']['firstname'];

$lastname = $params['clientdetails']['lastname'];

$email = $params['clientdetails']['email'];

$address1 = $params['clientdetails']['address1'];

$address2 = $params['clientdetails']['address2'];

$city = $params['clientdetails']['city'];

$state = $params['clientdetails']['state'];

$postcode = $params['clientdetails']['postcode'];

$country = $params['clientdetails']['country'];

$phone = $params['clientdetails']['phonenumber'];

 

# Variaveis do Sistema

$companyname = $params['companyname'];

$systemurl = $params['systemurl'];

$currency = $params['currency'];

 

# Codigo de Submissão do Gateway

 

$code = '

<div style="width: 300px; color: #666; font-size: 12px; line-height: 12px; padding: 10px; border: solid 1px #222;">

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tbody>

<tr>

<td valign="top" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px;">

<img src="/clientes/images/multibanco.jpg" alt="left" width="60px" />

</td>

<td valign="middle" align="center" width="100%" style="padding-left: 10px; border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

Pagamento por<br><b>Multibanco / HomeBanking</b>

</td>

</tr>

</tbody>

</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tbody>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Entidade:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

'.$gatewayentidade.'

</td>

</tr>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Referência:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

'.$referencia.'

</td>

</tr>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Valor:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

€ '.$amount.'

</td>

</tr>

</tbody>

</table>

 

 

 

</div>

<br />

<input type="button" value=" Imprimir " onclick="javascript:window.print()" class="oculta">

 

';

 

return $code;

}

 

 

 

 

//INICIO TRATAMENTO DEFINIÇÕES REGIONAIS

function format_number($number)

{

$verifySepDecimal = number_format(99,2);

 

$valorTmp = $number;

 

$sepDecimal = substr($verifySepDecimal, 2, 1);

 

$hasSepDecimal = True;

 

$i=(strlen($valorTmp)-1);

 

for($i;$i!=0;$i-=1)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)==","){

$hasSepDecimal = True;

$valorTmp = trim(substr($valorTmp,0,$i))."@".trim(substr($valorTmp,1+$i));

break;

}

}

 

if($hasSepDecimal!=True){

$valorTmp=number_format($valorTmp,2);

 

$i=(strlen($valorTmp)-1);

 

for($i;$i!=1;$i--)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)==","){

$hasSepDecimal = True;

$valorTmp = trim(substr($valorTmp,0,$i))."@".trim(substr($valorTmp,1+$i));

break;

}

}

}

 

for($i=1;$i!=(strlen($valorTmp)-1);$i++)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)=="," || substr($valorTmp,$i,1)==" "){

$valorTmp = trim(substr($valorTmp,0,$i)).trim(substr($valorTmp,1+$i));

break;

}

}

 

if (strlen(strstr($valorTmp,'@'))>0){

$valorTmp = trim(substr($valorTmp,0,strpos($valorTmp,'@'))).trim($sepDecimal).trim(substr($valorTmp,strpos($valorTmp,'@')+1));

}

 

return $valorTmp;

}

//FIM TRATAMENTO DEFINIÇÕES REGIONAIS

 

 

//INICIO REF MULTIBANCO

 

function GenerateMbRef($ent_id, $subent_id, $order_id, $order_value)

{

 

 

$order_id ="0000".$order_id;

 

$order_value = format_number($order_value);

 

//Apenas sao considerados os 4 caracteres mais a direita do order_id

$order_id = substr($order_id, (strlen($order_id) - 4), strlen($order_id));

 

 

if ($order_value < 1){

echo "Lamentamos mas é impossível gerar uma referência MB para valores inferiores a 1 Euro";

return;

}

if ($order_value >= 1000000){

echo "<b>AVISO:</b> Pagamento fraccionado por exceder o valor limite para pagamentos no sistema Multibanco<br>";

}

while ($order_value >= 1000000){

GenerateMbRef($order_id++, 999999.99);

$order_value -= 999999.99;

}

 

 

//cálculo dos check digits

 

 

$chk_str = sprintf('%05u%03u%04u%08u', $ent_id, $subent_id, $order_id, round($order_value*100));

 

$chk_array = array(3, 30, 9, 90, 27, 76, 81, 34, 49, 5, 50, 15, 53, 45, 62, 38, 89, 17, 73, 51);

 

for ($i = 0; $i < 20; $i++)

{

$chk_int = substr($chk_str, 19-$i, 1);

$chk_val += ($chk_int%10)*$chk_array[$i];

}

 

$chk_val %= 97;

 

$chk_digits = sprintf('%02u', 98-$chk_val);

 

return $subent_id." ".substr($chk_str, 8, 3)." ".substr($chk_str, 11, 1).$chk_digits;

 

}

 

?>

 

 

 

==========================================================================

 

Depois é só ir à configuração do WHMCS e activar, como qualquer outro módulo de PAGAMENTO normal.

 

Agradeço que façam aqui, qualquer comentário ou sugestão, mas apenas posso informar-vos que está a trabalha na perfeição, com os meus Clientes.

 

Cumsp.

 

JN

Edited by jonyzinho
Link to comment
Share on other sites

Fiquei sem perceber como são geradas as referências MultiBanco e se utiliza alguma gateway especifica. Será que pode explicar melhor o funcionamento?

 

Caro cenourinha e restantes,

 

Eu trabalho com a IfThen, que actualmente, fornecem o modulo para gerar referencias MB para o WHMCS. Parece-me que seja o mesmo que o código colocado no outro post.

 

Cumps,

Miguel

Edited by bstorm
Link to comment
Share on other sites

Boas companheiros,

 

A pedido de várias famílias, aqui vai o código fonte básico para o módulo em causa.

 

Criam o ficheiro com o nome multibanco.php e colocam-no na pasta:

 

/modules/gateways

 

 

PS - No meu caso concreto, ainda fiz mais uma ou duas alterações, de forma a que esses valores sejam enviados automaticamente no PDF do Aviso de Pagamento...

 

Aqui segue o Código:

 

==========================================================================

 

<?php

 

function multibanco_config() {

$configarray = array(

"FriendlyName" => array("Type" => "System", "Value"=>"Pagamentos Por Multibanco"),

"Entidade" => array("FriendlyName" => "Entidade", "Type" => "text", "Size" => "20", ),

"SubEntidade" => array("FriendlyName" => "SubEntidade", "Type" => "text", "Size" => "20", ),

);

return $configarray;

}

 

function multibanco_link($params) {

 

# Variaveis Especificas do Gateway

$gatewayentidade = $params['Entidade'];

$gatewaysubentidade = $params['SubEntidade'];

 

# Variaveis vindas da Ordem

$invoiceid = $params['invoiceid'];

$description = $params["description"];

$amount = $params['amount']; # Format: ##.##

$currency = $params['currency']; # Currency Code

 

$referencia = GenerateMbRef($gatewayentidade,$gatewaysubentidade,$invoiceid,$amount);

 

 

# Variaveis vindas do Cliente

$firstname = $params['clientdetails']['firstname'];

$lastname = $params['clientdetails']['lastname'];

$email = $params['clientdetails']['email'];

$address1 = $params['clientdetails']['address1'];

$address2 = $params['clientdetails']['address2'];

$city = $params['clientdetails']['city'];

$state = $params['clientdetails']['state'];

$postcode = $params['clientdetails']['postcode'];

$country = $params['clientdetails']['country'];

$phone = $params['clientdetails']['phonenumber'];

 

# Variaveis do Sistema

$companyname = $params['companyname'];

$systemurl = $params['systemurl'];

$currency = $params['currency'];

 

# Codigo de Submissão do Gateway

 

$code = '

<div style="width: 300px; color: #666; font-size: 12px; line-height: 12px; padding: 10px; border: solid 1px #222;">

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tbody>

<tr>

<td valign="top" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px;">

<img src="/clientes/images/multibanco.jpg" alt="left" width="60px" />

</td>

<td valign="middle" align="center" width="100%" style="padding-left: 10px; border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

Pagamento por<br><b>Multibanco / HomeBanking</b>

</td>

</tr>

</tbody>

</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tbody>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Entidade:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

'.$gatewayentidade.'

</td>

</tr>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Referência:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

'.$referencia.'

</td>

</tr>

<tr>

<td valign="top" align="left" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

<strong>Valor:</strong>

</td>

<td valign="top" align="right" style="border-bottom: solid 1px #222; padding-top: 5px; padding-bottom: 5px; font-size: 12px; font-family: Verdana;">

€ '.$amount.'

</td>

</tr>

</tbody>

</table>

 

 

 

</div>

<br />

<input type="button" value=" Imprimir " onclick="javascript:window.print()" class="oculta">

 

';

 

return $code;

}

 

 

 

 

//INICIO TRATAMENTO DEFINIÇÕES REGIONAIS

function format_number($number)

{

$verifySepDecimal = number_format(99,2);

 

$valorTmp = $number;

 

$sepDecimal = substr($verifySepDecimal, 2, 1);

 

$hasSepDecimal = True;

 

$i=(strlen($valorTmp)-1);

 

for($i;$i!=0;$i-=1)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)==","){

$hasSepDecimal = True;

$valorTmp = trim(substr($valorTmp,0,$i))."@".trim(substr($valorTmp,1+$i));

break;

}

}

 

if($hasSepDecimal!=True){

$valorTmp=number_format($valorTmp,2);

 

$i=(strlen($valorTmp)-1);

 

for($i;$i!=1;$i--)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)==","){

$hasSepDecimal = True;

$valorTmp = trim(substr($valorTmp,0,$i))."@".trim(substr($valorTmp,1+$i));

break;

}

}

}

 

for($i=1;$i!=(strlen($valorTmp)-1);$i++)

{

if(substr($valorTmp,$i,1)=="." || substr($valorTmp,$i,1)=="," || substr($valorTmp,$i,1)==" "){

$valorTmp = trim(substr($valorTmp,0,$i)).trim(substr($valorTmp,1+$i));

break;

}

}

 

if (strlen(strstr($valorTmp,'@'))>0){

$valorTmp = trim(substr($valorTmp,0,strpos($valorTmp,'@'))).trim($sepDecimal).trim(substr($valorTmp,strpos($valorTmp,'@')+1));

}

 

return $valorTmp;

}

//FIM TRATAMENTO DEFINIÇÕES REGIONAIS

 

 

//INICIO REF MULTIBANCO

 

function GenerateMbRef($ent_id, $subent_id, $order_id, $order_value)

{

 

 

$order_id ="0000".$order_id;

 

$order_value = format_number($order_value);

 

//Apenas sao considerados os 4 caracteres mais a direita do order_id

$order_id = substr($order_id, (strlen($order_id) - 4), strlen($order_id));

 

 

if ($order_value < 1){

echo "Lamentamos mas é impossível gerar uma referência MB para valores inferiores a 1 Euro";

return;

}

if ($order_value >= 1000000){

echo "<b>AVISO:</b> Pagamento fraccionado por exceder o valor limite para pagamentos no sistema Multibanco<br>";

}

while ($order_value >= 1000000){

GenerateMbRef($order_id++, 999999.99);

$order_value -= 999999.99;

}

 

 

//cálculo dos check digits

 

 

$chk_str = sprintf('%05u%03u%04u%08u', $ent_id, $subent_id, $order_id, round($order_value*100));

 

$chk_array = array(3, 30, 9, 90, 27, 76, 81, 34, 49, 5, 50, 15, 53, 45, 62, 38, 89, 17, 73, 51);

 

for ($i = 0; $i < 20; $i++)

{

$chk_int = substr($chk_str, 19-$i, 1);

$chk_val += ($chk_int%10)*$chk_array[$i];

}

 

$chk_val %= 97;

 

$chk_digits = sprintf('%02u', 98-$chk_val);

 

return $subent_id." ".substr($chk_str, 8, 3)." ".substr($chk_str, 11, 1).$chk_digits;

 

}

 

?>

 

 

 

==========================================================================

 

Depois é só ir à configuração do WHMCS e activar, como qualquer outro módulo de PAGAMENTO normal.

 

Agradeço que façam aqui, qualquer comentário ou sugestão, mas apenas posso informar-vos que está a trabalha na perfeição, com os meus Clientes.

 

Cumsp.

 

JN

 

Viva,

 

quando indica que "...ainda fiz mais uma ou duas alterações, de forma a que esses valores sejam enviados automaticamente no PDF do Aviso de Pagamento..." como é que fez isso?

Pergunto por uma razão, o PDF não é gerado no ficheiro invoicepdf.tpl ?

Que variáveis introduziu no PDF ?

Será que pode dar uma ajuda, ou alguém pode dar uma ajuda?

 

Obrigado

JMota

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
Saudações terraquios...

 

kkkkk, brincadeira.

 

É que Brasileiro em forum gringo sabem como é!!

 

Angel, esta de parabéns com seu forum do portaldohost falta voltar o do whmcs...

 

[ ´ ]s

 

Plínio

 

O forum do whmcs está embutido no forum do Portal do Host!

 

/http://forum.portaldohost.com.br/forumdisplay.php?f=54

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
Efectuamos a integração da EasyPay no nosso sistema desenvolvendo um módulo especifico. Neste momento temos suporte para referências MB e Cartões de Crédito. Se houver interessados poderemos estudar a venda do módulo.

 

Concordo com a ideia cenourinha. Não seria má ideia de todo ;)

Porque não o colocam na secção Community Addons? Tenho que a certeza de que teriam sucesso...

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
Efectuamos a integração da EasyPay no nosso sistema desenvolvendo um módulo especifico. Neste momento temos suporte para referências MB e Cartões de Crédito. Se houver interessados poderemos estudar a venda do módulo.

 

Olá cenourinha,

 

Estou interessado em comprar o módulo WHMCS <> Easypay. Podes-me enviar para o meu e-mail (rhbkweb@gmail.com) o valor / custo do módulo?

 

Obrigado

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated