Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Kian last won the day on November 13

Kian had the most liked content!

Community Reputation

151 Excellent

About Kian

  • Rank
    Senior Member

Recent Profile Visitors

6,766 profile views
  1. Kian

    Payment method according to invoice amount

    I feel my awkwardness for posting that script. I coded it a lot of time ago for unknown reasons 😄 As I said earlier it's not very elegant and @brian! is right about multi-currency. Anyway it loops through all gateway key/value pairs to find the one with the highest limit according to invoice amount. Example: <?php $InvoiceTotal = 35; $Gateways['banktransfer'] = 10; $Gateways['bnlpositivity'] = 20; $Gateways['gestpay'] = 30; $Gateways['nexi'] = 40; foreach ($Gateways as $k => $v) { echo 'Use ' . strtoupper($k) . ' gateway when amount is greater than or equal to ' . $v . '<br>'; echo 'Is ' . $InvoiceTotal . ' (invoice amount) greater than or equal to ' . $v . '?<br>'; if ($InvoiceTotal >= $v) { echo 'Yes! Let\'s use ' . strtoupper($k); } else { echo 'Nope!'; } echo '<br><br>'; } /* Prints... Use BANKTRANSFER gateway when amount is greater than or equal to 10 Is 35 (invoice amount) greater than or equal to 10? Yes! Let's use BANKTRANSFER Use BNLPOSITIVITY gateway when amount is greater than or equal to 20 Is 35 (invoice amount) greater than or equal to 20? Yes! Let's use BNLPOSITIVITY Use GESTPAY gateway when amount is greater than or equal to 30 Is 35 (invoice amount) greater than or equal to 30? Yes! Let's use GESTPAY Use NEXI gateway when amount is greater than or equal to 40 Is 35 (invoice amount) greater than or equal to 40? Nope! */ Long story short GESTPAY will be used as gateway. If invoice amount changes to 40 the gateway will be set to NEXI. If it drops to 15 BANKTRANSFER and so on. As I said for sure there are better ways but now I wanna start playing League of Legends 😛
  2. Kian

    Payment method according to invoice amount

    For sure there are more elegant ways but this hook should work. <?php use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientAreaPageViewInvoice', 1, function($vars) { $Data = Capsule::select(Capsule::raw('SELECT total, paymentmethod FROM tblinvoices WHERE id = "' . $vars['invoiceid'] . '" LIMIT 1')); /** * Use Gateway System Name as key and amount as value * * Invoice total 10 -> banktransfer * Invoice total 15 -> banktransfer * Invoice total 20 -> katamaze_bnlpositivity * Invoice total 30 -> katamaze_gestpay * Invoice total 40 -> katamaze_nexi */ $Gateways['banktransfer'] = 10; $Gateways['katamaze_bnlpositivity'] = 20; $Gateways['katamaze_gestpay'] = 30; $Gateways['katamaze_nexi'] = 40; foreach ($Gateways as $k => $v) { if ($Data[0]->total >= $v) { $AssignedGateway = $k; } } if ($AssignedGateway != $Data[0]->paymentmethod) { localAPI('UpdateInvoice', array('invoiceid' => $vars['invoiceid'], 'paymentmethod' => $AssignedGateway), $adminUsername); header('Location: viewinvoice.php?id=' . $vars['invoiceid']); die(); } }); Every time customer changes payment method or view the invoice, the hook triggers and set the correct payment method depending on invoice total.
  3. There are modules with some of the features you're looking for in Marketplace. For sure there's nothing for this and frankly I don't get what's the point of multi-tier affiliate markeing 😟 Watch out GDPR 😛
  4. Kian

    Auto Apply Credit

    This one should work. <?php use Illuminate\Database\Capsule\Manager as Capsule; add_hook('InvoiceCreation', 1, function($vars) { $Data = Capsule::select(Capsule::raw('SELECT t1.total, t2.credit FROM tblinvoices AS t1 LEFT JOIN tblclients AS t2 ON t1.userid = t2.id WHERE t1.id = "' . $vars['invoiceid'] . '" LIMIT 1')); $CreditBalance = $Data[0]->credit; $TotalDue = $Data[0]->total; // Apply Credit only if Credit Balance is greater than zero if ($CreditBalance) { $postData = array( 'invoiceid' => $vars['invoiceid'], 'amount' => ($CreditBalance < $TotalDue ? $CreditBalance : $TotalDue) // If Credit Balance is less than Total Due there will be a partial payment ); $results = localAPI('ApplyCredit', $postData, $adminUsername); } });
  5. Hi, Need more details but you can untick Require Domain (Setup > Products/Services > Products/Services > Your hosting package > Edit > Details tab > Require Domain).
  6. Kian

    Auto Apply Credit

    On InvoiceCreated or InvoiceCreationPreEmail hook points run ApplyCredit API function.
  7. One quick question. Do you have Level 2 tax rate in Australia?
  8. For sure your PHP version is 7.1.24 but Cron is running with an older version hence the error. Make sure that Cron deamon uses a recent version of PHP.
  9. I'm sorry for asking so many questions but do you need to filter by all 143 entity types you have in Australia?
  10. Use InvoiceChangeGateway hook point. As soon as the gateway changes run: UPDATE tblinvoices SET paymentmethod = '{PAYMENT}' WHERE id = {INVOICE_ID} LIMIT 1
  11. Thanks for the GUID. It works. I was planning to store the following parameters: ABN Status (Active, Cancelled) Effective from YYYY-MM-DD Entity Status (Active, Cancelled) Effective from YYYY-MM-DD Type Code (DTT, PRV, IND) Description (Discretionary Trading Trust, Australian Private Company, Individual/Sole Trader) Name Legal/Business name (Nicole Kidman, Maximus Decimus Meridius LTD...) Effective from YYYY-MM-DD Address State Code (QLD, VIC) Postcode (4557, 3193) Effective from YYYY-MM-DD GST Status (Yes, No) Effective from YYYY-MM-DD ASIC Number (I have no idea of what is this value) Am I missing something? Should I remove some fields? I'm going to use these values on Invoices table and also for this panel. I also want to ask another question. VIES of European Union and ABN are very similar. When I use VIES I know that I can't flood them with too many requests. There are limits (max 10k checks per day, max 5 check per VAT Number etc.). I can't find anything about ABN limitations. What should I do? Descriptions are not final but yeah it makes more sense.
  12. Yes. All you need is a simple true/false for membership status. Yes, you can display any template you want based on the true/false status I have previously mentioned. Anyway could you please provide more details about your project with an example?
  13. Told ya 😄 Anyway I need some help for GUID. Take a look at the screenshot below. I check VAT Numbers using ABN Lookup via Web Service when customers register on WHMCS, update their VAT Numbers and automatically with Daily Cron of WHMCS. This way your RCTI will work in line with what ABN says (eg. Valid VAT Number yes/no, registered for GST yes/no). I keep a copy of all checks locally on WHMCS storing entity names, ABN status, GST, business localtions - I still have to decide what values are relevant. When you issue the RCTI, I take a snapshot of ABN and GST status and adjust it accordingly (VAT exemption, <75$ AUD rule, 49%, statement by supplier etc.). There's log where you can review changes to VAT Numbers and GST status. Moreover you can optionally receive a recap via email on a daily basis if there's something to notify. This new toy works on paper but I can't test ABN Lookup functionalities without GUID. I can't register on ABN since I'm not Australian so... 😋 Can someone PM me his/her GUID?
  14. It gets the job done. I used it like crazy for an entire year and it's fine. It's a bit old-school in some aspects but who cares? 🤭 reviews... that place where people judge complex stuff after 5 minutes of use. Full of fake reviews and sponsored honest ones. Not to mention star rating system and thumbs up/down that make absolutely no sense.
  15. Kian

    Invoice Paid Email Notification

    On InvoicePaid run a query to scan the invoice looking for product IDs you need: SELECT id FROM tblhosting WHERE packageid IN ('1', '2', '3') LIMIT 1 Replace 1, 2 and 3 with IDs of your VPS/Server plans. If the query returns true you could SendEmail via API but the problem is that it doesn't let you specify a recipient. You have to autoload PHPMailer, load your SMTP settings from tblconfiguration, retreive the recepient and send the email. In this post I have already described this approach. I know it's boring but there's no other way 🙂

Important Information

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