Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/16/20 in all areas

  1. Greetings, I'm developing a module to setup a user on my server and sync their usage data to whmcs. I've successfully contextualized usage metrics now the big issue here is how whmcs track usage metrics my progress so far is below: I've created a new class which implements "ProviderInterface" below is the code for "metrics" function public function metrics() { return [ new Metric( 'disk', 'Disk Utilized', MetricInterface::TYPE_SNAPSHOT, new MegaBytes, new Usage(0) ) ]; } usage function is public function usage() { $serverData = $this->apiCall('stats'); $usage = []; foreach ($serverData as $data) { $usage[$data['username']] = $this->wrapUserData($data); } return $usage; } tenantusage function is public function tenantUsage($tenant) { $userData = $this->apiCall('user_stats'); return $this->wrapUserData($userData); } helper wrapuserdata function is: private function wrapUserData($data) { $wrapped = []; foreach ($this->metrics() as $metric) { $key = $metric->systemName(); if ($data[$key]) { $value = $data[$key]; $metric = $metric->withUsage( new Usage($value) ); } $wrapped[] = $metric; } return $wrapped; } And lastly helper apicall function which delibrately sends a value somewhat emulating an api call for now. private function apiCall($action) { if($action == "stats"){ return [ [ "username" => "kamran@domain.com", //this represents my username which is provided to whmcs "disk" => 100 ] ]; } else{ return [ [ "disk" => 100 ] ]; } } Okay so far in the above mentioned code, date and time updates but usage details are not updating. BTW I'm checking metrics using module parameters using $params["metricStats"][0]["currentvalue"] So please help me with the below mentioned questions. What is the correct way to return "usage()" function including what should be the identifier of the tenant(i.e. the key of value usage object where key should be serviceid?accountid?userid? of the tenant)? Whenever cron job "TenantUsageMetrics" runs only "usage()" function is invoked and never "tenantusage()" why? Also if my syntax is wrong a possible example would be tremendous. Thank you for hearing me out!
    1 point
  2. You can use $templatefile instead. That way you can target the specific .tpl files. You can target them all with this: {if $templatefile|strpos:"password-reset"===0} <p>Shown on Password Reset pages</p> {/if}
    1 point
  3. Greetings, I'm developing a module for my service which tracks usage information and my current module works fine, usage metrics which released for WHMCS v7.9 attracted me and hence found a use case for my service but the issue that I am facing is usage data won't update (not even once!) I've followed all these links including Usage billing feature doc, Usage metrics provisioning module doc and class doc whereas have posted my relevant code and details on whmcs community under whmcs 7.9 beta discussion but did not recieve any help so far on this issue below is the link for that post: If anyone in the community(either from WHMCS staff or anyone ) knows what's wrong and can help it'll be much appreciated as this feature is quite important for my organization. Thank you!
    1 point
  4. don't be shy - i'm volunteering you (and your coding colleagues) for a week or two in Houston - all expenses paid by WHMCS. ✈️
    1 point
  5. Hi @zomex, Please refer to the release notes and module documentation which will hopefully clarify: https://docs.whmcs.com/Version_7.9.0_Release_Notes#PayPal_Checkout https://docs.whmcs.com/PayPal_Checkout#Supported_Payment_Types
    1 point
  6. Hi @zomex, That would work to allow clients to checkout using the new module and make a one-time payment. On the renewal invoice, the familiar PayPal buttons would be displayed allowing users to create a subscription or make a one-time payment. @slim, Such an option wasn't in the original scope of work, but that you for the suggestion, we are going to investigate the feasibility of adding such an option in the new PayPal module too.
    1 point
  7. I wish it was like this but its not. Let's say that you receive a payment for a VPS that costs 100 euro + 22% VAT from the following customer: Italian Public Administration Split Payment WHMCS doesn't know anything about cross out sentences. As result you forced your customer to pay 22 euro for VAT that was not due to Split Payment. Here are the consequences: You charged 122 euro instead of 100 You issued an electronic invoice of 100 + 22% with Split Payment Your customer (Public Administration) paid 22% to Revenue Agency and 22% to your company At the end of the day the customer paid 144 euro instead of 122 and you stole 22 euro not from me or from my grandma but from State. What's the point of issuing the invoice correctly on a third-party platform when this mess happened? You'll need to refund 22 euro issuing a credit note followed by an electronic credit note that I can hardly imagine. But I can imagine a lot of unhappy Public Administrations, state-owned companies and corporations. Here is another example. In WHMCS Add Funds invoices are something special. They're VAT-free for no damn reason. In most EU countries (but I'd say that it's the same everywhere!) you are not allowed to issue an invoice without VAT unless there's a valid reason (eg. VIES, extra-EU, Split Payment, credit usage, special tax regime...). The fact that you're adding funds doesn't make it special so here's the thing. A customer uploads 100 euro of credit and on my third-party platform I issue the correct invoice: Subtotal 81.97 euro Tax (22%) 18.03 euro Total 100 euro In the meantime on WHMCS the customer didn't pay VAT. Here are the consequences: In 2020 WHMCS creates 18.03 euro of money out of nowhere Toc toc... hello Mr. White I'm the Revenue Agency. We need to talk Bonus distaster 1 🍬 In 2022 VAT raises from 22% to 23% Payment received in 2020 I used 50% of 18.03 euro in 2021 with 22% VAT I spend the rest in in 2022 wih 23% VAT Bonus disaster 2 🍬 In Italy you're not allowed to postpone invoicing later than 12 days (if you have electronic invoicing) or 1 month for other countries (generally). Here we have 3 years of delay. If you are italian it means that you're going to pay a fine of 28 euro for each invoice if you report yourself to Revenue Agency or 250 euro if you don't say anything... for an invoice of 81.97 euro. Cool. Go figure out how to fix this mess. I stop here but I cloud go on for days. Sadly not 🙁 as you can see from my first example we've two problems here: issue invoice correctly and charge the right amounts to end-customers. Having perfect invoices on an external system doesn't fix the problem with wrong amounts charged to customers. I remember India and Tunisia but I bet that there are more countries. I can't determine who is using it. Frankly I don't even know if it's true that they really need to use revenue stamps but customers asked to "unlock" this feature and I don't ask question. Italy and EU are enough for me. I don't need to find new problems.
    1 point
  8. I suspect there probably is a book too. 😮 i've said for years that they should get you directly involved to sort the mess out... at least to get the basic structure correct going forward in v8.
    1 point
×
×
  • 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