Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by steven99

  1. So to confirm you're using the built-in Stripe module and not a custom one? The gateway logs isn't showing any of that activity either? I would be curious to know what the POST contents were. Doing a ClientAreaPageCreditCardCheckout hook with session and other checking might help on that.
  2. I would go off a client custom field so it could be dynamic and no hard coding of ids. You would need to check what the notification is and if it is auto response then abort and if not just continue.
  3. You can leave the access hash field blank unless you have created an API token as described in this plesk article. If you did do a api token, then you would put that in to the access hash. The username and password would be an administrator username and password. I would recommend to use an additional admin user and not the main / your admin user.
  4. The hook mentioned there was to send a copy of all replies in a single message using the EmailPreSend hook and that may work but wont be a thread. What you need is the different email headers sent along to make messages thread-able and I don't think you can add headers via hooks. The ticket system in whmcs is really limited compared to a dedicated system like SupportPal.
  5. Using the AfterRegistrarRegistration hook and internal classes, you should be able to do that with: <?php use WHMCS\Domain\Domain; add_hook('AfterRegistrarRegistration', 1, function ($vars) { $Domain = Domain::find($vars['domainid']); if ($Domain) { $Domain->hasDnsManagement = true; $Domain->save(); } }); Have not tested that, just what should work.
  6. Don't think there is out of the box and don't think there is an admin template for the client list. An injection hook could be used perhaps but would need to match up row to row or use the color of td's background to output the group.
  7. API doesn't seem to have rating so you'll need to do database edits in the tblticketreplies table -> rating column.
  8. Well, that might be the case but still using internal classes and expanding on that: <?php //@author: steven99 function getOrderByInvoiceId($invoiceID) { $Invoice = Invoice::find($invoiceID); if ($Invoice) { if (isset($Invoice->order->id) and $Invoice->order->id) return [$Invoice->order->id]; else { //Ugh, we need to find it. $OrderIDs = []; foreach($Invoice->items as $item) { //Is it an addon item? if ($item->addon) $OrderID = $item->addon->orderid; //Is it a service item? elseif ($item->service) $OrderID = $item->service->orderid; //is it a domain itme/ elseif ($item->domain) $OrderID = $item->domain->orderid; if (!in_array($OrderID, $OrderIDs)) { $OrderIDs[] = $OrderID; } } return $OrderIDs; } } else return [] }
  9. You could enable 2FA but they would need to complete the actual setup steps for it to be required. A client custom field, require2FA, and a hook checking that and 2FA status could be done to redirect them to the 2FA setup page on any page loads. A quick search of the marketplace and on here didn't find a module or hook to do this however. With that said, personally if a client was constantly doing payment disputes they would no longer be a client.
  10. Don't think that is possible out of box. Using the ShoppingCartValidateCheckout hook you could check if a hosting package or one within a group or any other items besides registration is in the cart and if not return an error.
  11. Internal classes have this: $Invoice = Invoice::find($InvoiceNumber); if ($Invoice and isset($Invoice->order->id) and $Invoice->order->id) $OrderID = $Invoice->order->id;
  12. Okay, well pick a hook that suites when you want to run and go from there. https://developers.whmcs.com/hooks/hook-index
  13. Code to do validation, escaping, etc is extra but yup would agree.
  14. When do you want the hook to fire? Let's say after the server modules does the create: <?php add_hook('AfterModuleCreate', 1, function($vars) { if (isset($vars['domain']) and !empty($vars['domain'])) { if (function_exists("exec")) { exec("/path/to/script/shell.sh ".$vars['domain'], $Output, $result_code); // Shell scripts should return "0" when successful and any other number when failed if ($result_code === 0) { // Yay, we are successful, now process output if really wanted foreach($Output as $line) { if ($line === "some output") { // Run more processing } } } else { throw new Exception("Uh oh batman, the joker got away"); } } else throw new Exception("Dude, the security here is nice but we can't do anything"); } else throw new Exception("Uh oh, domain isn't given and it should be but it isn't but it reallly should have been!!!"); }); Just note shell_exec, exec, and the other such functions can be disabled for security and so that is the case you would need to have that removed for this to be possible.
  15. Couple items in the _capture function wanted to note: Line 157 - $postfields but that does not exist but rather $postFields does -- note the "f" and "F" -- PHP is CaSe sensitive. Line 221 - $gatewayModuleName doesn't exist 242 - add a logging entry with $response print_r'd . 257 - add a logging entry indicating it declined and print_r $response . I am sort of thinking line 221 is the issue where addinvoicepayment is expecting a gateway name and isn't getting one but doesn't error until after it has done all the invoice payment steps and $invoice_res does not equal success and thus you get the declined error. That is why I suggest to add a logging entry after that and before returns.
  16. To get existing Stripe tokens, just use GetPayMethods API call or get them via $client->payMethods when using the classes method. Once you have that, you get the remote_token variable and that will be a json array of: {"customer":"cus_xxxxxxxxxx","method":"pm_xxxxxxxxxxxxxx"} Where customer is the stripe customer token and method is the stripe payment token. Though the docs are not clear, surprised I know, on this, if you look at the example response given on the GetPayMethods -> remote_token it shows similar to the above and viewing a payment method in the admin shows this. Then when you're storing Stripe info, you use $client->createRemoteCardPayMethod() and pass the same json array to it in the remoteToken variable.
  17. Had forgotten the payment methods changed how the gateway id is stored where in older WHMCS it was in the clear in the clients table. But I would not suggest doing database changes anyhow. So with that in mind the addon / hook method is the way to go for this and any php developer with knowledge of stripe and whmcs gateway functions or one that will read docs should be able to do it.
  18. If Stripe can copy the customer objects and their tokens to a new account, then an whmcs addon or even a hook to inject a form on the client summary page and a hook to accept that forms action could be used to assign a stripe customer to a whmcs client. Now it would have to be per client and manually but at least it could be done without direct database changes.
  19. How is the addon not working exactly? Like does it give an error or an entry in the module log to indicate issues? Just a rough thinking how I would do such an addon, there isn't much that could stop it from working.
  20. It depends on which WHMCS version you are using. If WHMCS 8+, then it should be using Stripe elements and expecting a token and card data never touches WHMCS as that happens within Stripe's form and that just returns a token. WHMCS before 8 uses Stripe API to get the token AND it stores the card data because that goes through WHMCS. Stripe's flow should be, on any system and not just WHMCS, Load page with Stripe.js and init elements form Client enters card data, hits submit Javascript listening for the submit stripe.createToken is fired submitting the form's elements to stripe using stripe's javascript libs and functions Token is received Payment form gets submitted to backend and that form holds client id, token, and any other info but not the card info and no way to get that Backend checks the token is valid, invoice is valid, etc Backend then creates a Stripe customer object or updates an existing one if a customer token is known Backend then charges the invoice against the customer object's primary source or source selected Show success or failure message
  21. Are you doing a logTransaction just before you return and if so is that showing up? It seems like it is doing its job but then another return is happening or not returning anything. Sorta hard to know without seeing the complete code. Past that, I would say you're hitting a WHMCS bug but uh I would imagine there would be lots more posts about this if that was the case.
  22. Can be done via the ClientAreaPageCart hook, checking the $vars['products'] array against the client's active products and then unsetting products found and returning $vars or just $vars['products'] to do an override . No template editing is needed and doing so would add logic that should not be in templates.
  23. The above return is correct for capture, however, capture is, AFAIK, only done during crons or the admin manually hitting capture in the admin invoice page. On the client invoice page, that uses an input function -- remoteinput and returns to there or a callback file. What happens when you try to capture via the admin? The sample modules at https://github.com/whmcs/ may help a bit but some items are missing there. I am sure there is a open source gateway laying around some where.
  24. The above code wont work because mysql_query was removed in PHP 7 and really using WHMCS internal classes and making WHMCS do the heavy lifting for database access is the preferred way, at least IMO. As such, here you go in a untested rewrite: <?php require("../init.php"); use WHMCS\User\Client; /* * @Author steven99 * Get status of current status of client and welcome them back or have them login . * NOTE: This will only work within WHMCS and not an external page as it requires * the same PHP session to be used */ global $_LANG; if (isset($_SESSION['UID']) and is_numeric($_SESSION['UID'])) { $Client = Client::find($_SESSION['UID']); if ($Client) {?> <?=$_LANG['welcomeback']?> <?=$Client->firstname?> <a href="clientarea.php?action=details"><strong><?=$_LANG['clientareanavdetails']?></a> <a href="logout.php"><strong><?=$_LANG['logouttitle']?></strong></a> <?php } } else {?> <?=$_LANG['please']?> <a href="clientarea.php" title="Login"><strong><?=$_LANG['loginbutton']?></strong></a><?=$_LANG['or']?> <a href="register.php" title="Register"><strong><?=$_LANG['clientregistertitle']?></strong></a> <?php }
  • 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