yomyyo Posted December 23, 2019 Share Posted December 23, 2019 (edited) Hello, I wanted to figure out how cancellation requests are processed. When customers choose to cancel a service, and choose End of Billing Period specifically, is there any hooks that fire on the End of Billing Period? That way, once the time comes I can fire a request to my service and suspend their account. I have Immediate Cancellation done through the CancellationRequest hook, but is there any way for me to get data at the end of a billing period? Thank you Edited December 23, 2019 by yomyyo 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 24, 2019 Share Posted December 24, 2019 16 hours ago, yomyyo said: I wanted to figure out how cancellation requests are processed. When customers choose to cancel a service, and choose End of Billing Period specifically, is there any hooks that fire on the End of Billing Period? That way, once the time comes I can fire a request to my service and suspend their account. I have Immediate Cancellation done through the CancellationRequest hook, but is there any way for me to get data at the end of a billing period? I would have thought with cancellation at end of billing period being a cron task, you would use either PreAutomationTask or PostAutomationTask - depending on whether you want to do what you want after cancellation, or just before. 0 Quote Link to comment Share on other sites More sharing options...
yomyyo Posted December 24, 2019 Author Share Posted December 24, 2019 Thanks for the tip! I'll look into those and see what I can find 0 Quote Link to comment Share on other sites More sharing options...
upalm Posted December 24, 2019 Share Posted December 24, 2019 (edited) @yomyyo Hey, could you please share the simple Immediate Cancellation hook ( CancellationRequest) that cancels the service right after the billion period is over? It would be very kind of you. Does it auto cancel the immediate cancellation requests as well? As I do not have any module attached to the service and this hook would automate the major tasks. Edited December 24, 2019 by upalm 0 Quote Link to comment Share on other sites More sharing options...
yomyyo Posted December 24, 2019 Author Share Posted December 24, 2019 5 hours ago, brian! said: I would have thought with cancellation at end of billing period being a cron task, you would use either PreAutomationTask or PostAutomationTask - depending on whether you want to do what you want after cancellation, or just before. What does $vars['task'] of PreAutomationTask or PostAutomationTask return? Whats a good way I can do testing with these hooks so I can get the right values? Thank you for all the help! 0 Quote Link to comment Share on other sites More sharing options...
yomyyo Posted December 24, 2019 Author Share Posted December 24, 2019 (edited) 24 minutes ago, upalm said: @yomyyo Hey, could you please share the simple Immediate Cancellation hook ( CancellationRequest) that cancels the service right after the billion period is over? It would be very kind of you. Does it auto cancel the immediate cancellation requests as well? As I do not have any module attached to the service and this hook would automate the major tasks. @upalm I just have something very simple like the following: add_hook("CancellationRequest", 1, function($vars){ $userid = $vars['userid']; $relid = $vars['relid']; //Call GetClientsProducts API using user id $results = //API CALL $products = $results['products']['product']; //Loop through $products until we find a product that matches $relid foreach(....){ if($productid == $relid){ //Send a curl request to my product and delete their user account } } }); The problem with my code is that CancellationRequest runs immediately, regardless of whether or not the user chose to cancel at the end of the billing period or not. Edited December 24, 2019 by yomyyo 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.