Jump to content

souzadavi

Senior Member
  • Content count

    87
  • Joined

  • Last visited

Everything posted by souzadavi

  1. Hello guys please could you add a class at link on footer of viewinvoicetemplate.tpl to default template? SEARCH FOR: <a href="clientarea.php"> REPLACE FOR: <a href="clientarea.php" class="btn btn-success"> RESULT: Thanks
  2. souzadavi

    Licensing Addon

    Hello, I'm trying to use the addon: https://docs.whmcs.com/Licensing_Addon looks easy but I'm getting so many errors. I using the examplo code file. But i'm getting the follows errors: - Domain Invalid - License Suspended - License Suspended for Duplicate Trials Use (7,11) My CODE in under here: /**************** INICIO LICENCA ***************/ function meuCartaoPagamento_check_license($licensekey, $localkey='') { $whmcsurl = 'https://whmcs.meudominio.com.br/'; $licensing_secret_key = 'secretKey'; $localkeydays = 90; $allowcheckfaildays = 5; $check_token = time() . md5(mt_rand(100000000, mt_getrandmax()) . $licensekey); $checkdate = date("Ymd"); $domain = $_SERVER['SERVER_NAME']; $usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']; $dirpath = dirname(__FILE__); $verifyfilepath = 'modules/servers/licensing/verify.php'; $localkeyvalid = false; if ($localkey) { $localkey = str_replace("\n", '', $localkey); # Remove the line breaks $localdata = substr($localkey, 0, strlen($localkey) - 32); # Extract License Data $md5hash = substr($localkey, strlen($localkey) - 32); # Extract MD5 Hash if ($md5hash == md5($localdata . $licensing_secret_key)) { $localdata = strrev($localdata); # Reverse the string $md5hash = substr($localdata, 0, 32); # Extract MD5 Hash $localdata = substr($localdata, 32); # Extract License Data $localdata = base64_decode($localdata); $localkeyresults = json_decode($localdata, true); $originalcheckdate = $localkeyresults['checkdate']; if ($md5hash == md5($originalcheckdate . $licensing_secret_key)) { $localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - $localkeydays, date("Y"))); if ($originalcheckdate > $localexpiry) { $localkeyvalid = true; $results = $localkeyresults; $validdomains = explode(',', $results['validdomain']); if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) { $localkeyvalid = false; $localkeyresults['status'] = "Invalid"; $results = array(); } $validips = explode(',', $results['validip']); if (!in_array($usersip, $validips)) { $localkeyvalid = false; $localkeyresults['status'] = "Invalid"; $results = array(); } $validdirs = explode(',', $results['validdirectory']); if (!in_array($dirpath, $validdirs)) { $localkeyvalid = false; $localkeyresults['status'] = "Invalid"; $results = array(); } } } } } if (!$localkeyvalid) { $responseCode = 0; $postfields = array( 'licensekey' => $licensekey, 'domain' => $domain, 'ip' => $usersip, 'dir' => $dirpath, ); if ($check_token) $postfields['check_token'] = $check_token; $query_string = ''; foreach ($postfields AS $k=>$v) { $query_string .= $k.'='.urlencode($v).'&'; } if (function_exists('curl_exec')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } else { $responseCodePattern = '/^HTTP\/\d+\.\d+\s+(\d+)/'; $fp = @fsockopen($whmcsurl, 80, $errno, $errstr, 5); if ($fp) { $newlinefeed = "\r\n"; $header = "POST ".$whmcsurl . $verifyfilepath . " HTTP/1.0" . $newlinefeed; $header .= "Host: ".$whmcsurl . $newlinefeed; $header .= "Content-type: application/x-www-form-urlencoded" . $newlinefeed; $header .= "Content-length: ".@strlen($query_string) . $newlinefeed; $header .= "Connection: close" . $newlinefeed . $newlinefeed; $header .= $query_string; $data = $line = ''; @stream_set_timeout($fp, 20); @fputs($fp, $header); $status = @socket_get_status($fp); while (!@feof($fp)&&$status) { $line = @fgets($fp, 1024); $patternMatches = array(); if (!$responseCode && preg_match($responseCodePattern, trim($line), $patternMatches) ) { $responseCode = (empty($patternMatches[1])) ? 0 : $patternMatches[1]; } $data .= $line; $status = @socket_get_status($fp); } @fclose ($fp); } } if ($responseCode != 200) { $localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - ($localkeydays + $allowcheckfaildays), date("Y"))); if ($originalcheckdate > $localexpiry) { $results = $localkeyresults; } else { $results = array(); $results['status'] = "Invalid"; $results['description'] = "Remote Check Failed"; return $results; } } else { preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $data, $matches); $results = array(); foreach ($matches[1] AS $k=>$v) { $results[$v] = $matches[2][$k]; } } if (!is_array($results)) { die("Invalid License Server Response"); } if ($results['md5hash']) { if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) { $results['status'] = "Invalid"; $results['description'] = "MD5 Checksum Verification Failed"; return $results; } } if ($results['status'] == "Active") { $results['checkdate'] = $checkdate; $data_encoded = json_encode($results); $data_encoded = base64_encode($data_encoded); $data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded; $data_encoded = strrev($data_encoded); $data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key); $data_encoded = wordwrap($data_encoded, 80, "\n", true); $results['localkey'] = $data_encoded; } $results['remotecheck'] = true; } unset($postfields,$data,$matches,$whmcsurl,$licensing_secret_key,$checkdate,$usersip,$localkeydays,$allowcheckfaildays,$md5hash); return $results; } function meuCartaoPagamento_licenca($licensekey){ $localkey = ""; $base = __DIR__."/meuCartaoPagamento-licenca.txt"; if (!file_exists($base)) { ///first check $results = meuCartaoPagamento_check_license($licensekey); $localkey = $results['localkey']; }else{ /// LER O ARQUIVO $handle = fopen($base, "r"); if ($handle) { $txt = explode("::", trim(fgets($handle))); fclose($handle); if($txt == false){ }else{ $licensekey = $txt[0]; $localkey = $txt[1]; $results = meuCartaoPagamento_check_license($licensekey, $localkey); } } } if(isset($results['localkey']) && $results['status'] == "Active"){ $textfile = fopen($base, "w") or die("Não foi possível abrir o arquivo."); $contents = $licensekey."::".$results['localkey']."::".date('Y h:i:s A'); fwrite($textfile, $contents); fclose($textfile); } // Interpret response switch ($results['status']) { case "Active": return "Active"; case "Invalid": return "Invalid". print_r($results, true)."TxtFile:".$licensekey."::".$localkey; //break; case "Expired": //die("Chave de Licença Expirada"); return "Expired". print_r($results, true); //break; case "Suspended": //die("Chave de Licença Suspensa"); return "Suspended". print_r($results, true); //break; default: //die("Resposta Inválida"); return "Erro". print_r($results, true); //break; } } /**************** FIM LICENCA ***************/ To stop the errors i disabled the domain check. So my products details is: But I still getting error, any help will be appreciated. My Check code is right? Thanks.
  3. souzadavi

    POP3 Connection Error

    Hi @brian! i thought you are from WHMCS team. Sorry about it. The other thing I did to fix this problem is changing the cron on cPanel. Cron's was running other php version of WHMCS. Crons was 7.2 and WHMCS was 7.3. And for some how the cron error message was sent to me every 5 minutes. After change bootstrap file and php version the annoying error message is gone. In cPanel command crons config's: /opt/cpanel/ea-php73/root/usr/bin/php -q /home/username/WHMCScronsFolders/pop.php
  4. souzadavi

    POP3 Connection Error

    I think the problem is because I'm using custom cron folder. The pop.php file dont find the file boostrap.php.... Looks like is a small bug in pop.php file. I just copy the file boostrap.php from my custom's cron folder to the WHMCS root folder. @brian! please could you fix it own pop.php file? The pop.php file should consider custom cron folder. thanks
  5. souzadavi

    POP3 Connection Error

    I got this error too for long time.... looking the log a found it: [02-Oct-2019 10:16:33 America/Sao_Paulo] PHP Warning: main(/home/link/whmcs/bootstrap.php): failed to open stream: No such file or directory in /home/link/whmcs/pop.php on line 0 [02-Oct-2019 10:16:33 America/Sao_Paulo] PHP Fatal error: main(): Failed opening required '/home/link/whmcs/bootstrap.php' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home/link/whmcs/pop.php on line 0 There is any way to fix it? thanks
  6. In this new version I cant add new type of brands. Before 7.8 i did a Hooks that work fine. There is anyway to add new credit card brands in WHMCS 7.8? My hook that was working before 7.8: add_hook('ClientAreaPageCart', 1, function($vars) { $array = array('Visa', 'Master', 'Amex', 'Elo', 'Aura', 'JCB', 'Diners','Discover','Hipercard', 'Elo Débito'); return array("acceptedcctypes" => $array); }); Thanks
  7. souzadavi

    How to add new credit cards brand?

    I'm trying to add on: /whmcs/assets/js/jquery.payment.js { type: 'elo', patterns: [4011|438935|45(1416|76)|50(4175|6699|67|90[4-7])|63(6297|6368)], format: defaultFormat, length: [12, 13, 14, 15, 16, 17, 18, 19], cvcLength: [3], luhn: true }, But still not working, there is another place to add the brands type?? thanks
  8. They change so many things in credit card process. And they didn't post any news about how this was changed. I've been working around it. And I did some fix in my credit card module. The example in github https://github.com/WHMCS/developer-docs/blob/master/payment-gateways/tokenised-remote-storage.md help me out how to fix it.
  9. souzadavi

    How to disable credit card check 7.8

    There is no way to disable it at all, I'm using my own credit card it's too bad because I cant simulate another credit card errors... This plugins should possible to be disable in WHMCS configs. thanks
  10. Hello, I'm updating a script that was working on 7.7, but now on version 7.8.... I cant use sandbox credit card numbers to test the module.. How to disable credit card check at: whmcs.com/creditcard.php?invoiceid=12716 I cant use credit card numbers for sandbox tests of payment module. How to disable the javascript check? Thanks
  11. souzadavi

    New API? /api/delete

    The example here: https://github.com/WHMCS/sample-merchant-gateway/blob/master/modules/gateways/merchantgateway.php work perfect! I did like there and the things work... thanks!
  12. souzadavi

    New API? /api/delete

    At example: https://github.com/WHMCS/developer-docs/blob/master/payment-gateways/tokenised-remote-storage.md on case DELETE there is a CURL for api delete. But at documentation there is no information about it. Please could explain about this new DELETE function: The DOCS should be update to help the adjustment for new version 7.8 of WHMCS.
  13. souzadavi

    How to disable credit card check 7.8

    ???? no answer ??? Please is it too hard to understand my guess?? Anyone could help?? thanks
  14. souzadavi

    New API? /api/delete

    In the URL: https://github.com/WHMCS/developer-docs/blob/master/payment-gateways/tokenised-remote-storage.md The action parameter is "delete", but in WHMCS 7.7 version my module remove credit card with action "clear" like this: if($_POST['remove'] == 1 && $_GET['action'] != "clear"){ return array( "status" => "success", "gatewayid" => NULL, "rawdata" => "Cartão Removido",); } My new one after read the manual: case 'delete': return [ 'status' => 'success', "rawdata" => "Cartão Removido: ". $gatewayid, ]; break; Both is it right? action clear ou delete will do the job? The gatewayid do not need to send? it's been really hard to deploy credit card module, because it working only in production Thanks
  15. Hello guys, the multiple credit cards in WHMCS is great. I developed a credicard payment module with tokenised storage. I'm bit lost, because I didn't find any documentation about the changes. Some of my users are complain that the module not working in 7.8. But at docs i didn't find any changes yet. The DOC in: https://developers.whmcs.com/payment-gateways/tokenised-remote-storage/ got any changes? How will I save 2 cards in WHMCS now? How will I know wich card the user selected to pay the bill? There is no example for tokenised storage cards in: https://github.com/WHMCS/sample-merchant-gateway/blob/master/modules/gateways/merchantgateway.php Please could you give the direction? Thanks a lot.
  16. Thanks to replied, I've been continue this topic in:
  17. souzadavi

    New API? /api/delete

    But I need to pass to whmcs which credit card a need to delete, before was easy because was only one... Now, how I know which credit card I should delete in whmcs? So how do I delete a credit card token when user request? Thanks to write back.
  18. souzadavi

    How to disable credit card check 7.8

    i forgot to add the image to clarify try my guess. thanks
  19. No answer yet, how I know wich credit card i will delete? Where the others tokens will be saved??
  20. Hello guys, I'm creating customs WHMCS forms, to get better conversions. After registration I run the action AcceptOrder, but the status still in pending. My question is: how to change the order status to active from external API? thanks!!!!
  21. Hello in: https://developers.whmcs.com/api-reference/addtransaction/ the request parameter fees is wrong, the right is fee, why whmcs team still keeping this mistake? How to get it updated? thanks
  22. souzadavi

    Third Party Gateway

    Hello I created a payment module from this information: https://developers.whmcs.com/payment-gateways/third-party-gateway/ I created the callback file. But from this way all of my payments should be confirmed in time of payment, not later... There is any possibilite to call the callback later? Was so good if there is anyway to call the callback from the button try to capture in invoice admin. . thanks
  23. souzadavi

    Third Party Gateway

    @steven99 when the user hit the pay button I send the user to the bank page to insert the debit card password and after filled up the password, the bank send the user back to my invoice page sometimes the status of this payment come like "waiting" not all the time, just sometimes, here is the deal, because I need check it back again in couple minutes, and the bank doesnt have a payment notification service or something similar, I need get the payment ID that I saved from the json bank return and check in the bank if the status changed to paid. The deal is how and when I do this check. The button from admin invoice (try to capture) was fine because there is not a lot invoice paid on this method, automatic check should be awesome but I really don't have a clue to how to do it from nice way to not waste too much resource from server. Any information will be great!!! Ps.: I just created the module, the name is Brazilian debit card (cartão de débito pro Brasil). thanks for your reply 🙂
  24. Hello, I'm receiving this message: Error: Whoops\Exception\ErrorException: Allowed memory size of 805306368 bytes exhausted (tried to allocate 4096 bytes) in /home/username/vendor/phpmailer/phpmailer/class.smtp.php:659 Stack trace: #0 /home/username/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError(1, 'Allowed memory ...', '/home/username/...', 659) #1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown() #2 {main} Is it normal? Why is it using so much memory? this trouble start 3 months ago, I'm increasing memory every month. Ps.: this happened 50 minutes after daily cronjob. Any info will be great... thanks....
×

Important Information

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