Jump to content

Cancellation Request Logic


yomyyo

Recommended Posts

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 by yomyyo
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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 by upalm
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 by yomyyo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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