Brandonito Posted June 28, 2018 Share Posted June 28, 2018 So, first, to clear up the first go-to questions: PHP and MySQL Error logging is enabled both through WHMCS, Apache and PHP itself, and in the case of Apache and PHP, is also piped to a Graylog cluster I have logModuleCall --everywhere-- to help debug issues like this. Our tblmodulelog is enormous (about 5 GB after 6 months) but our DB server is optimized for writes. Crons are running properly Nowhere in our custom code do we explicitly set "Cancelled;" we only set "Terminated" Failed transactions are not a denominator - some have them, some dont With the exception of a small number of edge cases (which are all 'read' and no 'write'), we use the API over manual DB voodoo even if it means increased complexity or lower performance Environment: Ubuntu 16.04, updated weekly, on AWS EC2 Amazon RDS (MySQL vanilla) Apache2 PHP 7.0 (FPM) ionCube (latest) authorize.net CIM as gateway WHMCS kept up to date Ok, so onto the problem. We have a number of custom modules (written by me), but most importantly, we've written a module that helps us to enforce contract agreements - the idea is, we have a few products that we place on discount in exchange for a lower price; in exchange, the customer agrees to a one-year term with a penalty should they cancel or stop paying before the term is up. Anyway, semantics at this point, becuase WHMCS doesn't even get to the point where it's supposed to trigger the terminate call, even though it takes all the steps prior to that. So, the normal flow is like this: User signs up, is presented with contract terms, then consents to them and enters their payment info; After a few months, customer stops paying (NSF on card, expired card etc. but this applies only to non-customer initiated cancellations); Customer is notified their payment failed. After 3 days, their account is suspended; 33 days after the payment fails, the account is terminated, and the contract is breached; A new invoice is generated that includes the early cancellation fee; The system attempts to charge the customer through the payment gateway. But, it seems sometimes what's been happening is this: User signs up, is presented with contract terms, then consents to them and enters their payment info; After a few months, out of the frickin blue, the customer accounts flops over to "canceled," no cancellation request is made, the customer did not log in, no log entries are recorded, and no module termination triggers are fired! The customer is completely unaware this has happened, as termination triggers have not fired. Things I've checked: Manual termination action (Works) Activity logs (Nothing recorded) PHP errors (Nothing recorded) MySQL errors (Nothing recorded) Gateway log (Some have declined, some don't, no errors) Crons (Tested and confirmed working) Automation configuration - auto suspension and auto termination are checked Database log tables directly in case it wasnt recording the UserID correctly (through a query like 'SELECT * FROM tblgatewaylog WHERE data LIKE '%<userid>%'; -- all log tables checked, nothing obvious appears) From a code perspective: We have a provisioning module which fires a manual hook This hook is intercepted by the contracts "addon." This works when the terminate is called manually. However, about 50% of the time, the provisioning module terminate call isn't even firing! The product flips to 'Canceled' but there's nothing in the logs. Reiterating, nowhere in our code do we actually set 'Canceled;' it's only terminate Am I missing anything?? I could try and decouple the custom module, but I don't see the point, as it doesn't even trigger the provisioning module terminate call in the first place. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.