Jump to content

How to handle service when it fails to renew


WebhostingNZ.com

Recommended Posts

Hey,

I currently have the below in my code.  A couple of times now a domain has failed to renew, this could be because the domain isn't registered, it's been moved to a different provider or many other reasons.  Blesta always seems to think the domain/service has been renewed is there a way to code so blesta will not mark it as renewed and move on?  I am aware of the CORE to add email for failed renew, but how do I code so it's even known to have failed?  The Dev Manual doesn't mention a return code on renewService() for a fail.   (I will be adding a mail() hack in for now so we at least know but would love a proper fix and to do it the right way).

$this->log("Domain Renew","Domain: " . serialize($fields->domain) . "| Term: " . $term,"input",true);
$response = $metaname->renew_domain_name($fields->domain, $term);
$this->log("Domain Renew",serialize($response),"output",true);

[EDIT] This should have been put in extensions forum sorry.

Thanks,
Daniel.

Edited by WebhostingNZ.com
Link to comment
Share on other sites

Return values for Module::renewService($package, $service, $parent_package = null, $parent_service = null) are either null or a set of meta fields (an array) containing the key value pairs "key", "value", and "encrypted":

public function renewService($package, $service, $parent_package = null, $parent_service = null)
{
	// Attempt to perform the renewal
	$renewal = ...;

	$service_fields = $this->serviceFieldsToObject($service->fields);

	if (there is an error) {
		// Error
		$this->Input->setErrors(['error' => ['type' => 'The service could not be renewed because of this error!']]);
	} else {
		// Success, the service was renewed. Update and return the meta fields
		return [
			[
				'key' => 'mymodule_renew_email',
				'value' => $service_fields->mymodule_renew_email,
				'encrypted' => 0
			],
			[
				'key' => 'mymodule_expiry_date',
				'value' => $renewal->expiry_date,
				'encrypted' => 0
			]
		];
	}

	// Return null to not change any meta fields
	return null;
}

 

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.

Loading...
×
×
  • Create New...