WebhostingNZ.com Posted June 17, 2018 Report Posted June 17, 2018 (edited) 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 June 17, 2018 by WebhostingNZ.com Quote
Blesta Addons Posted June 17, 2018 Report Posted June 17, 2018 Normally this should be done via the module, which module your are using ? in the renewService() when the module return a error for the renew action. Quote
WebhostingNZ.com Posted June 17, 2018 Author Report Posted June 17, 2018 Hey @Blesta Addons I'm using a module I have written. I am wanting to know what is the format to return the error then? return "error" ; return $this->input->errors() ? Quote
Tyson Posted June 19, 2018 Report Posted June 19, 2018 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; } Michael and WebhostingNZ.com 2 Quote
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.